Skip to content

Commit 8175a00

Browse files
committed
Fix GlobalID type strings
1 parent 8dca207 commit 8175a00

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

tooling/graphql/types/codegen.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,22 @@ const schema: Schema = JSON.parse(schemaData);
1515
const globalIds = schema.data.__schema.types
1616
.filter(type => type.kind === 'SCALAR' && type.name.endsWith('ID'))
1717

18-
const scalarConfig = {
19-
scalars: {
20-
JSON: {
21-
input: 'any',
22-
output: 'any',
23-
},
24-
Time: {
25-
input: 'string',
26-
output: 'string',
27-
}
18+
const scalars = {
19+
JSON: {
20+
input: 'any',
21+
output: 'any',
22+
},
23+
Time: {
24+
input: 'string',
25+
output: 'string',
2826
}
2927
}
3028

3129

3230
globalIds.forEach(type => {
33-
const typeConfig = `\`gid://sagittarius/${type.name}/\${number}\``
31+
const typeConfig = `\`gid://sagittarius/${type.name.replace(/ID$/, '')}/\${number}\``
3432

35-
scalarConfig.scalars[type.name] = {
33+
scalars[type.name] = {
3634
input: typeConfig,
3735
output: typeConfig,
3836
};
@@ -47,7 +45,7 @@ const config: CodegenConfig = {
4745
"typescript"
4846
],
4947
config: {
50-
...scalarConfig,
48+
scalars,
5149
strictScalars: true,
5250
declarationKind: 'interface',
5351
}

0 commit comments

Comments
 (0)