Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nullable is part of "allOf" instead of being separate schema key when using shared component #248

Open
Grawl opened this issue Jul 23, 2024 · 1 comment

Comments

@Grawl
Copy link

Grawl commented Jul 23, 2024

const phoneNumber = z.string().openapi('Phone')

const mySchema = z.object({
    somePhone: phoneNumber.nullable(),
    anotherPhone: phoneNumber,
})

Expected result:

"somePhone": {
    "allOf": [
        {
            "$ref": "#/components/schemas/Phone"
        },
    ],
    "nullable": true
},
"anotherPhone": {
    "$ref": "#/components/schemas/Phone"
},

Actual result:

"somePhone": {
    "allOf": [
        {
            "$ref": "#/components/schemas/Phone"
        },
        {
            "nullable": true
        }
    ]
},
"anotherPhone": {
    "$ref": "#/components/schemas/Phone"
},

I am using Hono

@davidask
Copy link

davidask commented Nov 5, 2024

@AGalabov do you have any info here? Ready to help out here if given a pointer 👍🏻

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

No branches or pull requests

2 participants