fabien0102 / openapi-codegen

A tool for generating code base on an OpenAPI schema.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for nullable types in OAS 3.1

tomfrew opened this issue · 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
OAI/OpenAPI-Specification#2244 (comment)