diff --git a/packages/pylon-builder/src/schema/schema-parser.ts b/packages/pylon-builder/src/schema/schema-parser.ts index 83a5cbf..2947285 100644 --- a/packages/pylon-builder/src/schema/schema-parser.ts +++ b/packages/pylon-builder/src/schema/schema-parser.ts @@ -823,18 +823,19 @@ export class SchemaParser { ]) }) } else { - const firstType = type.types[0] + let firstType = type.getNonNullableType() - consola.warn( - `Warning: Union types in input fields are not supported yet. Defaulting to the first type (${this.checker.typeToString( - firstType - )}) at path: ${path.join(' > ')}` - ) + if (firstType.isUnion() && !isPrimitive(firstType)) { + consola.warn( + `Warning: Union types in input fields are not supported yet. Defaulting to the first type (${this.checker.typeToString( + firstType + )}) at path: ${path.join(' > ')}` + ) - recLoop(firstType.getNonNullableType(), info, processing, [ - ...path, - 'NON_NULLABLE' - ]) + firstType = firstType.types[0] + } + + recLoop(firstType, info, processing, [...path, 'NON_NULLABLE']) } } } else if (isFunction(type)) { diff --git a/packages/pylon-builder/src/schema/types-helper.ts b/packages/pylon-builder/src/schema/types-helper.ts index 9e82617..0b731ff 100644 --- a/packages/pylon-builder/src/schema/types-helper.ts +++ b/packages/pylon-builder/src/schema/types-helper.ts @@ -17,6 +17,15 @@ export const isList = (checker: ts.TypeChecker, type: ts.Type) => { typeNode.kind === ts.SyntaxKind.TupleType) ) + if (!is) { + // Check if type references an array + const isArray = type.getSymbol()?.getName() === 'Array' + + if (isArray) { + return true + } + } + return is }