Skip to content

Support allOf in response schemas #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dtkav opened this issue Jul 21, 2020 · 4 comments
Closed

Support allOf in response schemas #98

dtkav opened this issue Jul 21, 2020 · 4 comments
Labels
✨ enhancement New feature or improvement

Comments

@dtkav
Copy link
Contributor

dtkav commented Jul 21, 2020

Is your feature request related to a problem? Please describe.
I attempted to generate a client from one of my OpenAPI specs, and allOf and oneOf keywords are not yet supported

Describe the solution you'd like
oneOf should create a union type of the objects.
allOf should create a type with all of the objects subfields.

Additional context
FYI, we've implemented allOf support in our fork here:
benchling/openapi-python-client@2670d11
benchling/openapi-python-client@9f5b95a (bugfix)

I will try to open a PR if I can find some free time 😅 , otherwise feel free to pull in whatever you find useful!

@dbanty
Copy link
Collaborator

dbanty commented Aug 19, 2020

Will add support for oneOf in 0.5.4, allOf is definitely trickier and will happen in a future version.

@dtkav
Copy link
Contributor Author

dtkav commented Sep 23, 2020

FYI, we've implemented allOf support in our fork here:
benchling@2670d11
benchling@9f5b95a (bugfix)

I will try to open a PR if I can find some free time 😅 , otherwise feel free to pull in whatever you find useful!

@dtkav dtkav changed the title Support allOf, oneOf Support allOf, ~oneOf~ Sep 23, 2020
@dtkav dtkav changed the title Support allOf, ~oneOf~ Support allOf in response schemas Sep 23, 2020
bowenwr referenced this issue in benchling/openapi-python-client Jan 22, 2021
Collapses the child elements into one, without class heirarchy, mixins, etc.
bowenwr referenced this issue in benchling/openapi-python-client Jan 22, 2021
Collapses the child elements into one, without class heirarchy, mixins, etc.
@heiqs
Copy link

heiqs commented Mar 12, 2021

With the latest version, the default value for enum fields is not used.
my_field: Union[Unset, None] = UNSET rather than
my_field: Union[My_Enum, None] = My_Enum.DEFAULT

Also I see some strange Enum creation like the following:

M_Y_E_N_U_M_T_Y_P_1 = "model_a" instead of MYENUMTYP1 = "model_a"

dbanty added a commit that referenced this issue Mar 23, 2021
* Add allOf support for model definitions (#98)

Collapses the child elements into one, without class heirarchy, mixins, etc.

* refactor: allOf support to happen in build_model_property

* refactor: Clean up ModelProperty code

* refactor: More test cleanup for ModelProperty

* fix: Handle duplicate and conflicting properties in allOf

* ci: Improve test coverage

* refactor: A bit of cleanup for clarity

* Merge main into benching-allof-support

Co-authored-by: Packy Gallagher <packyg@benchling.com>
@dbanty
Copy link
Collaborator

dbanty commented Mar 23, 2021

This should be solved in 0.9.0 (releasing soon)

@dbanty dbanty closed this as completed Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants