Skip to content

Commit 2286224

Browse files
committed
fixed gen for yup array of InputObject
1 parent bd07353 commit 2286224

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/yup/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export class YupGenerator {
3939
public generate(): string {
4040
return [
4141
...Object.values(this.enums).map(
42-
(enumdef) => `export const ${enumdef.name.value}Schema = yup.mixed().oneOf(Object.values(${enumdef.name.value}))`
42+
(enumdef) =>
43+
`export const ${enumdef.name.value}Schema = yup.mixed().oneOf(Object.values(${enumdef.name.value}))`
4344
),
4445
...this.inputObjects.map((inputObject) =>
4546
this.generateInputObjectYupSchema(inputObject)
@@ -87,9 +88,8 @@ export class YupGenerator {
8788
type: TypeNode
8889
): string => {
8990
if (isListType(type)) {
90-
return `yup.array().of(${this.generateInputObjectFieldTypeYupSchema(
91-
type.type
92-
)})`;
91+
const schema = this.generateInputObjectFieldTypeYupSchema(type.type);
92+
return `yup.array().of(${maybeLazy(type.type, schema)})`;
9393
}
9494
if (isNonNullType(type)) {
9595
const schema = this.generateInputObjectFieldTypeYupSchema(type.type);

0 commit comments

Comments
 (0)