ng-openapi-gen icon indicating copy to clipboard operation
ng-openapi-gen copied to clipboard

Add suport for readOnly properties. Add experimental flag.

Open schimini opened this issue 3 years ago • 5 comments

This PR is the follow up to #193 . Openapi allows the use of the readOnly modifier to specify model properties that shouldn't be used to create a new object (via post or put). This PR makes OA3's readOnly properties to have the readonly modifier and POST and PUT requests that use such schemas to wrap the body's request type in a Writable type wrapper.
This follows the behavior of other OA3 generators (like OpenAPITools/openapi-generator).

Since this feature can be considered as having a low number of use cases I've made it available via an --experimental flag.

Also added test cases for both the wrapper and the flag.

schimini avatar Jan 22 '22 21:01 schimini

Thanks for the PR. I'll take a look on it when I have some time.

luisfpg avatar Jan 23 '22 00:01 luisfpg

@schimini , @luisfpg is there any update on this? Would be pretty cool if readonly was handled

marcellkiss avatar Aug 24 '22 11:08 marcellkiss

Sorry, I've only now found some time to review the PR's... It's currently conflicting. Also, as it is a large change set, I'd need to review in more details. Can you, please, update the PR with conflict merging? Thanks!

luisfpg avatar Aug 25 '22 12:08 luisfpg

Hi @luisfpg, First of all sorry for leaving this year without resolution. I don´t remember receiving the notification for it so this is a bit unfortunate. Despite that I found it now and resolved the conflicts.

Thanks for everything! Happy new year!

schimini avatar Jan 04 '23 07:01 schimini

Also just saw your comment @marcellkiss and I'm sorry for taking so long

schimini avatar Jan 05 '23 18:01 schimini