swagger-api / swagger-api/swagger-codegen
readOnly on nested objects
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Apparently the readOnly property is ignored for definitions of type object. In my example, SomeDefinition has a property someSubObject, which is an object and should be readOnly. So I would expect someSubObject to be in the list of readOnlyVars for SomeDefinition, but instead I find it in the readWriteVars list.
The other readOnly property, someString, is correctly listed in readOnlyVars and not in readWriteVars.
Is there something wrong with the definition, or is this a bug?
Swagger-codegen version
2.2.3
Swagger declaration file content or url
definitions:
SomeDefinition:
type: object
properties:
someString:
readOnly: true
type: string
someSubObject:
readOnly: true
type: object
properties:
someProperty:
type: string
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
Start with the supplied Swagger declaration and trace how readOnly is handled for SomeDefinition properties, comparing someString with the nested someSubObject. Confirm the fix by checking that the nested object appears in readOnlyVars rather than readWriteVars while the existing scalar behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100