Skip to content

Conversation

clifton
Copy link

@clifton clifton commented Nov 21, 2024

fixes #287

the following object

    const openApiDoc: OpenAPIObject = {
        openapi: "3.0.0",
        info: {
            version: "1.0.0",
            title: "Union array",
        },
        paths: {},
        components: {
            schemas: {
                Foo: {
                    type: "object",
                    properties: {
                        foo: { type: "integer", enum: [1, 2] },
                    },
                },
                Bar: {
                    type: "object",
                    properties: {
                        bar: { type: "string", enum: ["a", "b"] },
                    },
                },
                Union: {
                    type: "object",
                    properties: {
                        unionArray: {
                            items: {
                                anyOf: [{ $ref: "#/components/schemas/Foo" }, { $ref: "#/components/schemas/Bar" }],
                            },
                            type: "array",
                        },
                    },
                },
            },
        },
    };
expected:
unionArray: Array<Foo | Bar>;
received 
unionArray: Array<(Foo | Bar) | Array<Foo | Bar>>;

Copy link

vercel bot commented Nov 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
openapi-zod-client-rim4 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 21, 2024 6:40pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generating a array union when using anyOf
1 participant