File tree Expand file tree Collapse file tree 3 files changed +3
-46
lines changed Expand file tree Collapse file tree 3 files changed +3
-46
lines changed Original file line number Diff line number Diff line change @@ -74,17 +74,13 @@ export interface ValidationSchemaPluginConfig extends TypeScriptPluginConfig {
74
74
*/
75
75
enumsAsTypes ?: boolean ;
76
76
/**
77
- * @description this is for yup schema. use this when you specified `schema: yup`
78
- */
79
- yup ?: YupSchemaPluginConfig ;
80
- /**
81
- * @description Generates yup schema as strict.
77
+ * @description Generates validation schema with more API based on directive schema.
82
78
* @exampleMarkdown
83
79
* ```yml
84
80
* generates:
85
81
* path/to/file.ts:
86
82
* plugins:
87
- * - graphql-codegen-validation-schema:
83
+ * - graphql-codegen-validation-schema
88
84
* config:
89
85
* schema: yup
90
86
* directives:
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ const generateNameNodeYupSchema = (
185
185
}
186
186
187
187
const primitive = yup4Scalar ( tsVisitor , node . value ) ;
188
- return config . yup ?. strict ? ` ${ primitive } .strict(true)` : primitive ;
188
+ return primitive ;
189
189
} ;
190
190
191
191
const maybeLazy = ( type : TypeNode , schema : string ) : string => {
Original file line number Diff line number Diff line change @@ -214,43 +214,4 @@ describe("yup", () => {
214
214
"export const PageTypeSchema = yup.mixed().oneOf(['PUBLIC', 'BASIC_AUTH'])"
215
215
) ;
216
216
} ) ;
217
- it ( "with yup.strict" , async ( ) => {
218
- const schema = buildSchema ( /* GraphQL */ `
219
- input PrimitiveInput {
220
- a: ID
221
- b: String
222
- c: Boolean
223
- d: Int
224
- e: Float
225
- f: F!
226
- }
227
-
228
- input F {
229
- a: String!
230
- }
231
- ` ) ;
232
- const result = await plugin (
233
- schema ,
234
- [ ] ,
235
- {
236
- yup : {
237
- strict : true ,
238
- } ,
239
- } ,
240
- { }
241
- ) ;
242
- const wantContains = [
243
- "export function PrimitiveInputSchema(): yup.SchemaOf<PrimitiveInput>" ,
244
- "a: yup.string().strict(true)," ,
245
- "b: yup.string().strict(true)," ,
246
- "c: yup.boolean().strict(true)," ,
247
- "d: yup.number().strict(true)," ,
248
- "e: yup.number().strict(true)," ,
249
- "f: FSchema().defined()" ,
250
- "a: yup.string().strict(true).defined()" , // for FSchema
251
- ] ;
252
- for ( const wantContain of wantContains ) {
253
- expect ( result . content ) . toContain ( wantContain ) ;
254
- }
255
- } ) ;
256
217
} ) ;
You can’t perform that action at this time.
0 commit comments