openapi-codegen icon indicating copy to clipboard operation
openapi-codegen copied to clipboard

Support for nullable types in OAS 3.1

Open tomfrew opened this issue 1 year ago • 1 comments

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 https://github.com/OAI/OpenAPI-Specification/issues/2244#issuecomment-899084964

tomfrew avatar May 13 '23 08:05 tomfrew