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

bug go:generate:nvalid schema.type:style:explode combination #1309

Open
blueo opened this issue Sep 10, 2024 · 2 comments
Open

bug go:generate:nvalid schema.type:style:explode combination #1309

blueo opened this issue Sep 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@blueo
Copy link

blueo commented Sep 10, 2024

What version of ogen are you using?

$ go list -m github.com/ogen-go/ogen

github.com/ogen-go/ogen v1.4.0

Can this issue be reproduced with the latest version?

yes

What did you do?

Attempting to generate code from an OpenAPI 3.1 json file (generated from FastAPI) using

go:generate go run github.com/ogen-go/ogen/cmd/ogen --target openapi_internal -package internalapi --clean http://localhost:8000/_internal/v1/openapi.json

What did you expect to see?

An error that might help me find what is wrong with my open api spec or configuration

What did you see instead?

A more general error that I can't seem to narrow down what is wrong: openapi.json:1:933 -> invalid schema.type:style:explode combination: ("null":"form":true) followed by a dump of my spec. Eg:
image

at character 933 there is a null type [{"type":"integer"},{"type":"null"}],"title":"Token"}}] which seems to be ok on another spec that I have

any clues to narrow down what's going wrong would be great.

@blueo blueo added the bug Something isn't working label Sep 10, 2024
@tdakkota
Copy link
Member

It seems JSON spec you are using is minimized and does not contain any newlines. Try to format spec before running ogen.

invalid schema.type:style:explode combination: ("null":"form":true) says that spec have a parameter or urlencoded form field of type null. ogen does not support null parameters, since they are not properly defined by Open API spec.

@blueo
Copy link
Author

blueo commented Sep 10, 2024

Thanks, the newlines helped to track it down.
It does indeed seem to be because of the null type on a parameter which as you say is unsupported.

Nullable params doesn't appear to be much of a topic outside of that issue - so i guess people ether don't use them or its assumed there is some handling of null values (the linked rfc appears to indicate this). I guess this would be nice as its probably common for optional params to get a 'null' type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants