Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve order of drop-down items when using discriminator (since #1462 is closed) #2494

Open
johnholw opened this issue Feb 23, 2024 · 2 comments

Comments

@johnholw
Copy link

Describe the bug
Please refer to #1462 for the description.

Expected behavior
The dropdown is shown in the reverse order in some cases.

Minimal reproducible OpenAPI snippet(if possible)

I created a test schema that can be used to reproduce the problem.

Attached please find the redoc-issue-1462.yaml.txt file that contains one API endpoint which is a simplified version of the "new pet" for the pet store example.

Can you download the file, remove the .txt extension, and test it? Github doesn't allow uploading YAML file.

A few differences between this sample schema and the openapi.yaml for the pet store:

  • First, requestBodies is not used for the request body schema, e.g., "#/components/requestBodies/Pet". I set it to "#/components/schemas/requestBody" instead
  • The requestBody schema contains oneOf and discriminator with mapping,
  • The petType field is defined in the Cat, Dog, and Honeybee schemas with the enum values set.

Screenshots

Below are the screenshots showing the problem. I used the "OpenAPI ​(Swagger)​ Editor" IntelliJ plugin to show the problem on the Chrome browser.

  1. Problem: The dropdown shows "bee", "dog", and "cat" from the sample schema, though "cat" is the default.
    The expected list is "cat", "dog", and "bee".
image

Compared to the [redoc-issue-1462.yaml.txt](https://github.com/Redocly/redoc/files/14381183/redoc-issue-1462.yaml.txt) (pet store) which shows the dropdown properly.
image

  1. No problem with the example dropdown on the right pane. (Good)
image

Additional context
Add any other context about the problem here.

redoc-issue-1462.yaml.txt

@AlexVarchuk
Copy link
Collaborator

Hi @johnhol, thanks for notifying us. I'll look into that.

@johnholw
Copy link
Author

@AlexVarchuk Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants