Open joerghaubrichs opened 7 years ago
@joerghaubrichs instead of defining someSubObject
inline, have you tried defining it as a reference instead? e.g. https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml#L666
@wing328 Yes, unfortunately. Actually my original problem was using a reference, so I tried to use an object instead to narrow it down and simplify it, but same issue there.
😞
I'll see if I can hunt down the bug this weekend...
It's due to JSON parsing to Swagger model. It doesn't parse 'readOnly' property for references, inline objects, maps and arrays. Here is a PR https://github.com/swagger-api/swagger-core/pull/2502 @wing328 Please review and if possible release in 1.5.x branch.
@wing328 Is there any date scheduled when new version of 1.5 branch of swagger-core will be released with https://github.com/swagger-api/swagger-core/pull/2502 ?
@NikolaySl https://github.com/swagger-api/swagger-core/pull/2502 has been merged into swagger-core. We'll need to wait for the next release (1.5.18)
@wing328 This is still showing on 2.3.1 of swagger-gen. Looks like 1.5.20 of swagger-core is being used.
still showing in online swagger hub editor
I'm facing this issue now -- I'll give the workarounds a try, but also wanted to see if there are any thoughts on root cause on this since it's been open for some time.
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