Skip to content

Support for nullable types in OAS 3.1 #175

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

Open
tomfrew opened this issue May 13, 2023 · 2 comments
Open

Support for nullable types in OAS 3.1 #175

tomfrew opened this issue May 13, 2023 · 2 comments

Comments

@tomfrew
Copy link

tomfrew commented May 13, 2023

The JSON Schema spec supports multiple values for types which allows a property to be nullable.
e.g.

type: object
properties:
  foo:
    type: [string, "null"]

When generating types with this openapi-codegen it results in a void type.

export type Thing = {
  foo?: void;
}

I realise this is differnt from OAS 3.0 where there was a separate nullable property. Does this lib support OAS 3.1?


Reference to the nullable support in OAS 3.1
OAI/OpenAPI-Specification#2244 (comment)

@sylvainlg
Copy link

Hi

Did you find a workaround for this ?

Thx

@fabien0102
Copy link
Owner

fabien0102 commented Feb 17, 2025

Indeed, we are not supporting OAS 3.1 (I was not expecting such a breaking change between 3.0 and 3.1…)

I need to document myself a bit more about what changes to see if we can support everything

For future ref -> https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0

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

3 participants