Skip to content

Commit 4e1491a

Browse files
committed
ts:gql-codegen:fix-Url-scalar-spec
1 parent ff60078 commit 4e1491a

1 file changed

Lines changed: 34 additions & 4 deletions

File tree

  • typescript/gql-codegen/src/actors/ts/graphql/generators/server/scalars

typescript/gql-codegen/src/actors/ts/graphql/generators/server/scalars/additional.ts

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable max-lines */
12
import ts from 'typescript';
23
import { buildSymmetricScalarSpec, ScalarSpec } from './mapping.js';
34
import { invokeMethod } from '../../../../shared.js';
@@ -52,16 +53,45 @@ export const additionalScalarsMapping = {
5253
[]
5354
)
5455
),
55-
Url: buildSymmetricScalarSpec(
56-
ts.factory.createCallExpression(
56+
Url: {
57+
inputSchema: invokeMethod(
58+
ts.factory.createCallExpression(
59+
ts.factory.createPropertyAccessExpression(
60+
ts.factory.createIdentifier('z'),
61+
'custom'
62+
),
63+
[ts.factory.createTypeReferenceNode('URL')],
64+
[]
65+
),
66+
'transform',
67+
[ts.factory.createArrowFunction(
68+
undefined,
69+
undefined,
70+
[ts.factory.createParameterDeclaration(
71+
undefined,
72+
undefined,
73+
'url'
74+
)],
75+
undefined,
76+
ts.factory.createToken(
77+
ts.SyntaxKind.EqualsGreaterThanToken
78+
),
79+
invokeMethod(
80+
ts.factory.createIdentifier('url'),
81+
'toString',
82+
[]
83+
)
84+
)]
85+
),
86+
outputSchema: ts.factory.createCallExpression(
5787
ts.factory.createPropertyAccessExpression(
5888
ts.factory.createIdentifier('z'),
5989
'custom'
6090
),
6191
[ts.factory.createTypeReferenceNode('URL')],
6292
[]
63-
)
64-
),
93+
),
94+
},
6595
Void: buildSymmetricScalarSpec(
6696
ts.factory.createCallExpression(
6797
ts.factory.createPropertyAccessExpression(

0 commit comments

Comments
 (0)