Skip to content

Commit d7682c8

Browse files
committed
update naming for references
1 parent ed6dd7c commit d7682c8

File tree

3 files changed

+45
-45
lines changed

3 files changed

+45
-45
lines changed

packages/data-schema/__tests__/CustomOperations.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,8 @@ describe('CustomOperation transform', () => {
12711271

12721272
expect(result).toMatchSnapshot();
12731273
expect(result).toContain('enum PostStatus');
1274-
expect(result).toContain('input PostInput');
1275-
expect(result).toContain('refCustomType(arg: PostInput): String');
1274+
expect(result).toContain('input postInput');
1275+
expect(result).toContain('refCustomType(arg: postInput): String');
12761276
});
12771277

12781278
test('custom operation query with ref to nested custom type argument', () => {
@@ -1299,8 +1299,8 @@ describe('CustomOperation transform', () => {
12991299
expect(result).toMatchSnapshot();
13001300
expect(result).toContain('enum PostInnerE1');
13011301
expect(result).toContain('input PostInnerInput');
1302-
expect(result).toContain('input PostInput');
1303-
expect(result).toContain('fcnCall(arg: PostInput)');
1302+
expect(result).toContain('input postInput');
1303+
expect(result).toContain('fcnCall(arg: postInput)');
13041304
});
13051305

13061306
test('custom operation mutation with multiple references to the same custom type', () => {
@@ -1324,9 +1324,9 @@ describe('CustomOperation transform', () => {
13241324
const result = s.transform().schema;
13251325

13261326
expect(result).toMatchSnapshot();
1327-
expect(result).toContain('input PostInput');
1327+
expect(result).toContain('input postInput');
13281328
expect(result).toContain(
1329-
'refCustomType(arg1: PostInput, arg2: PostInput)',
1329+
'refCustomType(arg1: postInput, arg2: postInput)',
13301330
);
13311331
});
13321332

@@ -1357,9 +1357,9 @@ describe('CustomOperation transform', () => {
13571357
const result = s.transform().schema;
13581358

13591359
expect(result).toMatchSnapshot();
1360-
expect(result).toContain('input PostInput');
1361-
expect(result).toContain('fnCall1(arg: PostInput)');
1362-
expect(result).toContain('fnCall2(arg: PostInput)');
1360+
expect(result).toContain('input postInput');
1361+
expect(result).toContain('fnCall1(arg: postInput)');
1362+
expect(result).toContain('fnCall2(arg: postInput)');
13631363
});
13641364

13651365
test('custom operation with inline custom type containing reference to another custom type', () => {
@@ -1384,7 +1384,7 @@ describe('CustomOperation transform', () => {
13841384
const result = s.transform().schema;
13851385

13861386
expect(result).toMatchSnapshot();
1387-
expect(result).toContain('input PostInput');
1387+
expect(result).toContain('input postInput');
13881388
expect(result).toContain('input FnCallArgInput');
13891389
expect(result).toContain('fnCall(arg: FnCallArgInput)');
13901390
});
@@ -1410,8 +1410,8 @@ describe('CustomOperation transform', () => {
14101410
const result = s.transform().schema;
14111411

14121412
expect(result).toMatchSnapshot();
1413-
expect(result).toContain('input PostInput');
1414-
expect(result).toContain('inlineCustomType(arg: PostInput)');
1413+
expect(result).toContain('input postInput');
1414+
expect(result).toContain('inlineCustomType(arg: postInput)');
14151415
});
14161416

14171417
test('custom operation with inline custom type referencing self-referential type', () => {
@@ -1437,7 +1437,7 @@ describe('CustomOperation transform', () => {
14371437
const result = s.transform().schema;
14381438

14391439
expect(result).toMatchSnapshot();
1440-
expect(result).toContain('input PostInput');
1440+
expect(result).toContain('input postInput');
14411441
expect(result).toContain('input InlineCustomTypeArgInput');
14421442
expect(result).toContain(
14431443
'inlineCustomType(arg: InlineCustomTypeArgInput)',
@@ -1471,8 +1471,8 @@ describe('CustomOperation transform', () => {
14711471
const result = s.transform().schema;
14721472

14731473
expect(result).toMatchSnapshot();
1474-
expect(result).toContain('input UpdateInput');
1475-
expect(result).toContain('input PostInput');
1474+
expect(result).toContain('input updateInput');
1475+
expect(result).toContain('input postInput');
14761476
expect(result).toContain('input InlineCustomTypeArgInput');
14771477
expect(result).toContain(
14781478
'inlineCustomType(arg: InlineCustomTypeArgInput)',

packages/data-schema/__tests__/__snapshots__/CustomOperations.test.ts.snap

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ exports[`CustomOperation transform custom operations with custom types and refs
1616
field: String
1717
}
1818
19-
input PostInput {
19+
input postInput {
2020
field: String
2121
}
2222
2323
type Mutation {
24-
refCustomType(arg: PostInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
24+
refCustomType(arg: postInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
2525
}"
2626
`;
2727

@@ -32,13 +32,13 @@ exports[`CustomOperation transform custom operations with custom types and refs
3232
number: Int
3333
}
3434
35-
input PostInput {
35+
input postInput {
3636
name: String
3737
number: Int
3838
}
3939
4040
type Mutation {
41-
refCustomType(arg1: PostInput, arg2: PostInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
41+
refCustomType(arg1: postInput, arg2: postInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
4242
}"
4343
`;
4444

@@ -54,13 +54,13 @@ type post
5454
enumField: values
5555
}
5656
57-
input PostInput {
57+
input postInput {
5858
field: String
5959
enumField: values
6060
}
6161
6262
type Mutation {
63-
refCustomType(arg: PostInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
63+
refCustomType(arg: postInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
6464
}"
6565
`;
6666

@@ -80,12 +80,12 @@ exports[`CustomOperation transform custom operations with custom types and refs
8080
field: String
8181
}
8282
83-
input PostInput {
83+
input postInput {
8484
field: String
8585
}
8686
8787
type Query {
88-
refCustomType(arg: PostInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
88+
refCustomType(arg: postInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
8989
}"
9090
`;
9191

@@ -118,13 +118,13 @@ enum PostStatus {
118118
COMPLETED
119119
}
120120
121-
input PostInput {
121+
input postInput {
122122
name: String
123123
status: PostStatus
124124
}
125125
126126
type Query {
127-
refCustomType(arg: PostInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
127+
refCustomType(arg: postInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
128128
}"
129129
`;
130130

@@ -174,12 +174,12 @@ input PostInnerInput {
174174
e1: PostInnerE1
175175
}
176176
177-
input PostInput {
177+
input postInput {
178178
inner: PostInnerInput
179179
}
180180
181181
type Query {
182-
fcnCall(arg: PostInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
182+
fcnCall(arg: postInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
183183
}"
184184
`;
185185

@@ -196,18 +196,18 @@ type update
196196
field: post
197197
}
198198
199-
input UpdateInput {
199+
input updateInput {
200200
title: String
201-
field: PostInput
201+
field: postInput
202202
}
203203
204-
input PostInput {
204+
input postInput {
205205
value: String
206-
child: UpdateInput
206+
child: updateInput
207207
}
208208
209209
input InlineCustomTypeArgInput {
210-
inner: PostInput
210+
inner: postInput
211211
}
212212
213213
type Mutation {
@@ -221,13 +221,13 @@ exports[`CustomOperation transform custom operations with custom types and refs
221221
name: String
222222
}
223223
224-
input PostInput {
224+
input postInput {
225225
name: String
226226
}
227227
228228
input FnCallArgInput {
229229
name: String
230-
status: PostInput
230+
status: postInput
231231
}
232232
233233
type Mutation {
@@ -242,13 +242,13 @@ exports[`CustomOperation transform custom operations with custom types and refs
242242
child: post
243243
}
244244
245-
input PostInput {
245+
input postInput {
246246
value: String
247-
child: PostInput
247+
child: postInput
248248
}
249249
250250
input InlineCustomTypeArgInput {
251-
inner: PostInput
251+
inner: postInput
252252
}
253253
254254
type Mutation {
@@ -263,13 +263,13 @@ exports[`CustomOperation transform custom operations with custom types and refs
263263
child: post
264264
}
265265
266-
input PostInput {
266+
input postInput {
267267
value: String
268-
child: PostInput
268+
child: postInput
269269
}
270270
271271
type Mutation {
272-
inlineCustomType(arg: PostInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
272+
inlineCustomType(arg: postInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
273273
}"
274274
`;
275275

@@ -280,14 +280,14 @@ exports[`CustomOperation transform custom operations with custom types and refs
280280
number: Int
281281
}
282282
283-
input PostInput {
283+
input postInput {
284284
name: String
285285
number: Int
286286
}
287287
288288
type Mutation {
289-
fnCall1(arg: PostInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
290-
fnCall2(arg: PostInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
289+
fnCall1(arg: postInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
290+
fnCall2(arg: postInput): String @function(name: "myFunc") @auth(rules: [{allow: public, provider: apiKey}])
291291
}"
292292
`;
293293

packages/data-schema/src/SchemaProcessor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ function generateInputTypes(
13611361
if (isRefField(fieldDef)) {
13621362
const refType = getRefType(fieldDef.data.link, originalTypeName);
13631363
if (refType.type === 'CustomType') {
1364-
const nestedInputTypeName = `${capitalize(fieldDef.data.link)}Input`;
1364+
const nestedInputTypeName = `${fieldDef.data.link}Input`;
13651365
processedFields[fieldName] = {
13661366
data: { type: 'ref', link: nestedInputTypeName },
13671367
};
@@ -1432,7 +1432,7 @@ function generateInputTypes(
14321432
if (isRefField(argDef)) {
14331433
const refType = getRefType(argDef.data.link, operationName);
14341434
if (refType.type === 'CustomType') {
1435-
const inputTypeName = `${capitalize(argDef.data.link)}Input`;
1435+
const inputTypeName = `${argDef.data.link}Input`;
14361436
argDefinitions.push(`${argName}: ${inputTypeName}`);
14371437

14381438
// Process the input type if it hasn't been processed yet

0 commit comments

Comments
 (0)