Skip to content
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

Paperclip CLI fails on openapi v3: YAML error: missing field swagger #476

Open
jayvdb opened this issue Nov 1, 2022 · 4 comments
Open

Comments

@jayvdb
Copy link

jayvdb commented Nov 1, 2022

I built paperclip master CLI with

> cargo install --path . --features cli,v3,codegen,chrono,url,uuid

(Did I miss a feature needed?)

When I use it with a v3 spec, I get

> paperclip --out models_paperclip my_spec.yaml --api v3
YAML error: missing field `swagger` 

If I convert the same spec to v2, using https://github.com/LucyBot-Inc/api-spec-converter, it works perfectly

> api-spec-converter my_spec.yaml --from=openapi_3 --to=swagger_2 > my_spec_v2.yaml
> paperclip --out models_paperclip my_spec_v2.yaml --api v2
@tiagolobocastro
Copy link
Collaborator

This is something I'm looking into but V3 is not supported for client side code generation as things stand.

@jayvdb
Copy link
Author

jayvdb commented Nov 1, 2022

If it isnt easy to fix, perhaps the docs / error message can improved to indicate only v2 is supported at present.

@tiagolobocastro
Copy link
Collaborator

I don't know what the CLI is doing but the "--api v3" should have triggered some kind of not supported error, but I wonder if it's because the spec yaml is being provided before the --api, and it's always parsed as v2 which will fail since your spec is v3, so we never get to processing the "--api v3" argument.

@jayvdb
Copy link
Author

jayvdb commented Nov 1, 2022

paperclip --out models_paperclip --api v3 my_spec.yaml and paperclip --api v3 --out models_paperclip my_spec.yaml have the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants