4

Does anyone have an ideal how to model that in OpenAPI specification? :-/

https://api.example.de/search?facet=key1&facet=key2&key1=value1&key2=value2

key1, key2 etc. are given values from an enumeration. It there a way to describe them more detailed?

/search:
    get:
      parameters:
        - in: query
          name: facet
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - key1 # Description?
                - key2
        - in: query
          name: {facet_name}
          required: false
          ???

Is that the only solution:

/search:
    get:
      parameters:
        - in: query
          name: facet
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - key1 # Description ?
                - key2
        - in: query
          name: key1
          required: false
          schema:
            type: string
          description: Key1 is that...
1
  • did you manage to find any way of doing that? Commented Sep 1, 2020 at 12:58

1 Answer 1

1

All values in an enum must adhere to the specified type. If you need to specify descriptions for enum items, you can do this in the description of the parameter or property,

Description supports Markdown CommonMark for rich text representation, Like below example:

description: >
  **Your Title**:
    * `key1` - description for key1
    * `key2` - description for key2

It will look:

enter image description here

Hope this help.

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

2 Comments

Thanks! It's better than nothing... ;-) Do you have any ideas about the variable-query-parameter thing?
@michael, i am not getting, can you share example about variable-query-parameter

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.