RicoSuter/NSwag

[nswag, v12.0.0] SwaggerToTypeScriptClientGenerator ignores the "readOnly" flag for properties

Open

#1763 opened on Nov 22, 2018

View on GitHub
 (14 comments) (0 reactions) (0 assignees)C# (6,291 stars) (1,189 forks)batch import
help wantedproject: NJsonSchema.CodeGeneration.TypeScripttype: question

Description

The TypeScript code generated by nswag does not add the readonly TypeScript modifier for properties that has readOnly set to true in the Swagger specification file.

According to the Class.liquid template the modifier is added if property.IsReadOnly is true. I tried to debug using a custom template and property.IsReadOnly is set to false even for read-only properties.

I have observed this behavior for quite some time now and initially thought this could be by design. However, it seems to me that this is actually a bug.

Contributor guide