Forum Discussion

markushanslin's avatar
4 years ago

OpenAPI3.0 and ENUM

Dear all
I'm not so experienced in YAML and Swagger UI in general but I'm using it for my API since 2 years.
I'm using Swaggerhub and put my YAML code there, afterwards I export it to python-flask and download it to my PC. The PC runs the Connexion framework which automatically handles HTTP requests based on OpenAPI Specification (formerly known as Swagger Spec) . Many thanks for any feedback in advance.

I want to setup 2 DropDown Boxes where the second box displays items which are depended from the first DropDown box selection.

Example:

If customer selects 'PRO', the second box should switch to values [Switzerland,Germany]
If customer selects 'ITE', the second box should switch to values [France,Italy]

OpenAPI 3.0
test:
type: object
properties:

environment:
type: string
enum:
- PRO
- ITE

 

locationPRO:
type: string
enum:
- Switzerland
- Germany

 

locationITE:
type: string
enum:
- France
- Italy

1 Reply

  • Hi,

    The functionality you are looking for does not currently exist, and it is a Swagger/OAS limitation. I’m attaching a link below for a GitHub OAS ticket about the exact functionality you are looking for. The ticket offers some insight into the difficulties/challenges of getting this feature added to the OAS standard. Towards the bottom of the ticket, they offer some work arounds that you can add to your workflow to resolve these issues.

    https://github.com/OAI/OpenAPI-Specification/issues/256

    Hope this help!

    Alex