Effect-TS/effect

cleaner rendering of nullable types in openapi

Closed this issue · 0 comments

What is the problem this feature would solve?

currently, the nullable schemas:

  abc: Schema.NullOr(Schema.Boolean),

are rendered as

          anyOf:
            - type: boolean
            - enum:
                - null

this is not very idiomatic as openapi allows nullable: https://swagger.io/docs/specification/v3_0/data-models/data-types/#null

What is the feature you are proposing to solve the problem?

render NullOr as this:

            - type: boolean
              nullable: true

What alternatives have you considered?

  • not use nullable, use non-required (Schema.optional) field, that renders cleanly
  • use Tranform annotation to correct this