swagger-codegen-generators icon indicating copy to clipboard operation
swagger-codegen-generators copied to clipboard

[Templates] undefined template variable readOnly used instead of isReadOnly

Open fedepad opened this issue 3 years ago • 1 comments

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 few 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 the templates.

fedepad avatar Feb 23 '22 10:02 fedepad

Opened https://github.com/swagger-api/swagger-codegen-generators/pull/1016

fedepad avatar Feb 23 '22 10:02 fedepad