Skip to content

Union type is always generated, even if withObjectType is false #252

Closed
@tobiasdiez

Description

@tobiasdiez

If you have a schema

        type Square {
          size: Int
        }
        type Circle {
          radius: Int
        }
        union Shape = Circle | Square

then (with the default withObjectType = false) the generated code contains

export function ShapeSchema() {
    return z.union([CircleSchema(), SquareSchema()])
}

but the referenced type schemas CircleSchema and SquareSchema don't exist. Thus, the union schema should also not be generated if withObjectType is false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions