swagger-api / swagger-api/swagger-codegen
[Templates] Undefined readOnly variable instead of the right isReadOnly
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
This issue regards at least client documentation automatic generation (plus for some languages also not just doc) with swagger-codegen because of a bug in many languages templates.
Precisely, it regards the use of the undefined template variable readOnly to check if the variable/parameter is read-only while the right variable to use in the templates is isReadOnly as defined by: https://github.com/swagger-api/swagger-codegen/commit/a6df340cdc80f71cc4bdb88aa7174013a5d41c5c
Swagger-codegen version
I am using version 3.0.30 but I don't see this fixed in the current master.
Swagger declaration file content or url
Command line used for generation
swagger-codegen generate -i <your yaml file with models that have readonly attributes> -l python -o client
Note: it does not apply only to python clients.
Steps to reproduce
Just generate for example a python client.
You will see that for the generated models documentation, models' attributes that are readonly are not annotated as readonly because of the problem mentioned above.
Related issues/PRs
I haven't found any but please feel free to point that out if I missed something.
Suggest a fix/enhancement
Replace readonly with isReadOnly whenever it occurs in mustache templates.
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
Search the Mustache templates for uses of the undefined readOnly variable, starting with the templates involved in Python model documentation generation. Verify the generated documentation for a model with readonly attributes, then check other language templates to confirm the incorrect variable uses have been addressed.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 39/100