I'm trying to define a query object in OpenAPI 3:
parameters:
- name: query
in: query
schema:
type: object
properties:
id:
type: number
required:
- id
But the example value and schema is not shown in Swagger UI.
Is there a bug or am I missing something?
Your definition is correct.
but example value and schema was not shown in swaager ui.
The example is actually shown, in the JSON key/value format:
{
"id": 0
}
"Try it out" will serialize this parameter according to the defined serialization method, in this case as the ?id=<value>
query string.
The issue with the schema not being displayed for query parameters of type: object
is a known limitation, it's tracked here:
https://github.com/swagger-api/swagger-ui/issues/4581