Redocly / Redocly/redoc

readOnly fields are displayed in the code examples for PATCH requests

Open
#2,722 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This issue is present when there are some readOnly fields in a PATCH request.

The readOnly fields should not be included in the PATCH request.

The documentation is correct, but the examples on the right show the readOnly fields.

Expected: those fields should not be included in the examples.

Here's a code example to reproduce this issue:
https://github.com/pushpad/pushpad-openapi/blob/master/specification/resources/subscriptions/subscriptions_update.yml

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 linked subscriptions_update.yml reproduction and trace how Redoc generates PATCH code examples from schemas containing readOnly fields. Check the relevant example-generation tests or entry points in this TypeScript repository. Done means readOnly properties are omitted from PATCH examples while the documentation remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.