swagger-api / swagger-api/swagger-ui
readOnly attribute not rendered as property metadata
Open
Nobody has claimed this yet.
cat: rendering
type: bug
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
| Q | A |
|---|---|
| Bug or feature request? | Bug |
| Which Swagger/OpenAPI version? | 3.0.0 |
| Which Swagger-UI version? | 3.9.2 |
| How did you install Swagger-UI? | NPM |
| Which browser & version? | Google Chrome, 63.0.3239.132 (Official Build) (64-bit) |
| Which operating system? | MacOS X 10.13.2 |
Demonstration API definition
openapi: 3.0.0
info:
version: 1.0.0
title: Test
paths:
/plan:
post:
summary: Creates a Test
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Test'
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/Test'
components:
schemas:
SomeSchema:
required:
- hello
properties:
hello:
type: string
Test:
required:
- field1
- field2
properties:
field1:
type: string
field2:
allOf:
- $ref: '#/components/schemas/SomeSchema'
readOnly: true
Configuration (browser query string, constructor, config.yaml)
n.a.
Expected Behavior
Request Body Model should match Example value:
{
"field1": "string"
}
Current Behavior
Request Body Model shows field2 as well:
It is not visible that this field is readOnly.
Possible Solution
Context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the supplied OpenAPI 3 YAML in Swagger UI and inspect how the request-body model handles the nested readOnly property. Compare the rendered request example with the expected behavior, then verify that the readOnly field is excluded from the request model and its metadata is visible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100