openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

Suport writeOnly

Open dbanty opened this issue 3 years ago • 0 comments

Discussed in https://github.com/openapi-generators/openapi-python-client/discussions/672

Originally posted by georgkrause September 22, 2022 Hello everyone,

thanks for the great project, great work! Keep it going!

I am totally new to the whole openapi universe and its a great adventure. The API I am working with is not really perfect and has a lot of issues I need to work on, but one thing I noticed is a bit weird:

My API has types with fields that are specified with writeOnly, which seems to me like an indicator this field is only available when sending data to the API. But when I generate the python client using this lib and run a GET request against the endpoint, the deserialization fails because the field is expected but missing.

This seems to be a common issue, since my generator (DRF-Spectacular) even has documentation for this: https://drf-spectacular.readthedocs.io/en/latest/client_generation.html?highlight=writeonly#component-issues

And indeed, turning on the component split solves the problem. Nevertheless, I am not sure if this something openapi-python-client should respect, according to the specs? For now its just a question, as I said I am a newbe and happy to learn my lessons here. If you consider this to be something to work on, I won't mind creating an issue for this.

Thank you a lot and hive a nice day :sun_behind_large_cloud:

dbanty avatar Sep 23 '22 00:09 dbanty