You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having some issues with generated documentation when it comes to array representation. Here is my struct code:
type ThingsPage struct {
Things []Thing `json:"things" doc:"A list of things."`
}
The generated yaml looks like
ThingsPage:
additionalProperties: true
properties:
things:
description: A list of things.
items:
$ref: "#/components/schemas/Thing"
type:
- array
- "null"
required:
- things
type: object
The "null" under the type removes the ability for the visualized documentation to expand the properties of Thing. I tried a couple things, like adding nullable:"false" and required:"true" struct tags, but nothing seems to remove that "null" from the generated yaml. The desired yaml should look like
ThingsPage:
additionalProperties: true
properties:
things:
description: A list of things.
items:
$ref: "#/components/schemas/Thing"
type: array
required:
- things
type: object
Any help would be appreciated.
The text was updated successfully, but these errors were encountered:
I figured out that calling /openapi-3.0.yaml resolves this issue.
ThingsPage:
additionalProperties: true
properties:
things:
description: A list of things.
items:
$ref: "#/components/schemas/Thing"
nullable: true
type: array
required:
- things
type: object
In openapi version 3.1, we need to use the oneOf keyword, in order to support both null and array type. Keeping this issue open for this. It seems like the generated yaml does not generate the oneOf keyword.
I'm having some issues with generated documentation when it comes to array representation. Here is my struct code:
The generated yaml looks like
The
"null"
under the type removes the ability for the visualized documentation to expand the properties ofThing
. I tried a couple things, like adding nullable:"false" and required:"true" struct tags, but nothing seems to remove that"null"
from the generated yaml. The desired yaml should look likeAny help would be appreciated.
The text was updated successfully, but these errors were encountered: