awslabs / aws-api-gateway-developer-portal

A Serverless Developer Portal for easily publishing and cataloging APIs
Apache License 2.0
924 stars 399 forks source link

Open API - null type not supported #544

Open xrn opened 2 years ago

xrn commented 2 years ago

Hi,

I want to report bug with API Gateway 3.0 yaml/json export. When I will use in my model type: null like

    "value":{
                "oneOf":[
                    {
                        "type":"string"
                    },
                    {
                        "type":"null"
                    }
                ]
            }

generated OpenAPI3.0 will be

"value": {
              "oneOf": [
                {
                  "type": "string"
                },
                null
              ]
            }

Which if ofc is incorrect. When I will use different form

  "properties": {
       "name": {
           "description": "Tenant Name",
           "type": ["string","null"]
       }
   }

OpenApi documentation will not generate at all. Could you advice what to do in this case or this is just bug? Due to this issue I am not able to show that we can accept sting as well as null (field is nullable)

Advice: From what I see you are using standard 3.0.1 - from my understanding you should update as soon as possible to at lest 3.0.2 (newest is 3.1.0)

Using occasion and topic - AWS has any plans to move models schema from Draft 04 to something newer?

xrn commented 1 year ago

Now I see that when I am making

  "properties": {
       "name": {
           "description": "Tenant Name",
           "type": ["string","null"]
       }
   }

Documentation is generating but there is still bug

  "properties": {
       "name": {
           "description": "Tenant Name",
           "type" : "object"
       }
   }
dadocsis commented 1 year ago

Same issue here. Its a real headache when you are trying to create documentation for you api.

ajoyce-ipsum commented 1 year ago

Same issue, very incovenient.

gyan7896 commented 11 months ago

with data type as string you can not define nullable values type: string nullable: true just don't work, You have to define something like this "type": ["string","null"]

AdamRussak commented 9 months ago

with data type as string you can not define nullable values type: string nullable: true just don't work, You have to define something like this "type": ["string","null"]

and if i got a property with only nullable without type?

"type": ["string","null"] or "type": ["null"] did work

adatob commented 4 months ago

Hi, Are there any plans to take action on this topic? for now the only way to make the validation/documentation working is to do this acc. to the @xrn proposal: https://github.com/awslabs/aws-api-gateway-developer-portal/issues/544#issuecomment-1490671915 However, the resulting type in documentation is object which is obviously not valid.