swagger-api / swagger-api/swagger-ui

OA 3.1 foldable array types use the json editor instead of the array item picker

Open
#10,943 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: ALL
  • Browser: ALL
  • Version: ALL
  • Method of installation: ALL
  • Swagger-UI version: Latest/5.32.8
  • Swagger/OpenAPI version: Swagger 2 OpenAPI 3.1
Content & configuration

Example Swagger/OpenAPI definition:

{
  "name": "test",
  "in": "query",
  "description": "Find Something",
  "required": false,
  "allowEmptyValue": true,
  "schema": {
      "type": ["array", "null"],
      "items": {
        "type": "string",
                  "description": "Repo.",
                  "enum": [
                      "FOO",
                      "BAR"
                  ]
              }
         
      
  }
},
Describe the bug you're encountering

You would get the raw json editor when using the spec above. This should instead be the array item picker.

To reproduce...

Steps to reproduce the behavior:

  1. Have an api-doc similar/including to what I shared above.
  2. See that the json editor is shown instead of the array item picker.
Expected behavior

The array item picker should be shown.

Screenshots

What we want:

Image
Additional context or thoughts

I fixed it here: #10942

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OpenAPI 3.1 definition in this issue and compare the behavior with the fix referenced in #10942. Reproduce the example in Swagger UI 5.32.8, then verify that the array item picker is shown instead of the raw JSON editor for the nullable foldable array.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.