Skip to content

API - How to have valid nullable fields in swagger ? #71

@fdescamps

Description

@fdescamps

Hi,

Thanks for express-openapi. I really appreciate to use it :)
But I have a problem, I need to expose fields which the type strings that could be nullable.
This following code works when i run the server based on express-api :

responses: { 200: { schema: { title: 'MyObject', properties: { myfield: { type: ['string', 'null'],

But it's not valid against Swagger (editor.swagger.io) :(

Semantic error at definitions.MyObject.myfield "type" should be a string

Do you have a valid way to use nullable fields with express-openapi ?

Thanks by advance !

And Thanks for this top library.

Regards,

F.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions