Skip to content

Commit 8fd4ef6

Browse files
committed
fixed to use camelcase
1 parent 8e6e547 commit 8fd4ef6

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/yup/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const YupSchemaVisitor = (
3535
return [importYup];
3636
},
3737
InputObjectTypeDefinition: (node: InputObjectTypeDefinitionNode) => {
38-
const name = node.name.value;
38+
const name = tsVisitor.convertName(node.name.value);
3939
importTypes.push(name);
4040

4141
const shape = node.fields
@@ -53,7 +53,7 @@ export const YupSchemaVisitor = (
5353
).string;
5454
},
5555
EnumTypeDefinition: (node: EnumTypeDefinitionNode) => {
56-
const enumname = node.name.value;
56+
const enumname = tsVisitor.convertName(node.name.value);
5757
importTypes.push(enumname);
5858

5959
if (config.enumsAsTypes) {
@@ -161,12 +161,12 @@ const generateNameNodeYupSchema = (
161161
const typ = schema.getType(node.value);
162162

163163
if (typ && typ.astNode?.kind === "InputObjectTypeDefinition") {
164-
const enumName = typ.astNode.name.value;
164+
const enumName = tsVisitor.convertName(typ.astNode.name.value);
165165
return `${enumName}Schema()`;
166166
}
167167

168168
if (typ && typ.astNode?.kind === "EnumTypeDefinition") {
169-
const enumName = typ.astNode.name.value;
169+
const enumName = tsVisitor.convertName(typ.astNode.name.value);
170170
return `${enumName}Schema`;
171171
}
172172

test.graphql

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,15 @@ input EventArgumentInput {
6060
value: String!
6161
}
6262

63-
scalar Date
63+
input HTTPInput {
64+
method: HTTPMethod
65+
url: URL!
66+
}
67+
68+
enum HTTPMethod {
69+
GET
70+
POST
71+
}
72+
73+
scalar Date
74+
scalar URL

0 commit comments

Comments
 (0)