Redocly / Redocly/redoc

prefixItems isn’t respected

Open
#1,790 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

p3 Type: Enhancement
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

Describe the bug

Defining prefixItems within an array with items set to false displays a message saying: Schema not provided.

Expected behavior

Defining prefixItems as an array with items set to false should outline that this is an array containing only the items in prefixItems. Using anyOf/oneOf as the items array gets us a little closer, but doesn’t enforce the order of the items.

This makes it look like the swagger document itself is incorrect. If support of this is out of scope, could we at least change the text to something like “prefixItems is not yet supported”?

Minimal reproducible OpenAPI snippet(if possible)

type: array
minItems: 2
maxItems: 2
prefixItems:
  - number
  - string
items: false

Screenshots

items: false

This gives text that blames the author of the swagger document:
Screenshot 2021-11-15 at 5 47 14 PM

items:
  anyOf:
    - type: number
    - type: string

Using anyOf or oneOf makes it look like the array can be 2 of either numbers or strings:
Screenshot 2021-11-15 at 5 40 18 PM

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 by reproducing the issue with the minimal OpenAPI YAML snippet and inspect how Redoc renders array schemas with prefixItems and items: false. Determine whether the intended outcome is ordered prefixItems support or only a clearer unsupported-feature message; done means the misleading “Schema not provided” text is replaced or the array is rendered with the documented ordered semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.