3

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.

enter image description here

Is there a bug or am I missing something?

1

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.