Skip to content

Generate @dataclass from OpenAPI YAML specification [not a feature request] #743

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
praveentata opened this issue Mar 28, 2023 · 2 comments
Labels
✨ enhancement New feature or improvement

Comments

@praveentata
Copy link

praveentata commented Mar 28, 2023

How to generate a @dataclass from OpenAPI YAML specification?
I have an OpenAPI YAML specification file.
I ran the following command:
openapi-python-client generate --path <file_path>
The generated files don't have a @DataClass as mentioned in the documentation here: https://pypi.org/project/openapi-python-client/0.6.0a4/
I see that in a change log, the support was removed: https://github.com/openapi-generators/openapi-python-client/blob/7af73233212ccfbf5f98db68e1039c593f564a2d/CHANGELOG.md#breaking-changes-7

Is this correct? If yes, then is it true that the library will no longer be able to generate @dataclass using the YAML specifications?

Describe the solution you'd like
Generate @dataclass using YAML specifications

Describe alternatives you've considered
Write our own @dataclass

Sorry for posting a question in a "Feature Request". I couldn't find a way to post a question here.

@praveentata praveentata added the ✨ enhancement New feature or improvement label Mar 28, 2023
@dbanty
Copy link
Collaborator

dbanty commented Mar 28, 2023

That is correct, this tool only generates attrs classes, not @dataclass, I don't remember all of the reasons we switched, but basically attrs gives us more options. It may be that since we no longer support Python 3.6 we could switch back at some point? But I don't see much reason to at the moment.

Sorry for posting a question in a "Feature Request". I couldn't find a way to post a question here.

Questions should go in Discussions, not Issues—I'll update the "New Issue" screen to direct folks there for the future, thanks for pointing that out!

@dbanty dbanty closed this as completed Mar 28, 2023
@praveentata
Copy link
Author

Thanks @dbanty for the clarification

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

No branches or pull requests

2 participants