-
Notifications
You must be signed in to change notification settings - Fork 87
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
Client: valid json response decode error: "{" expected: unexpected byte 34 '"' #1315
Comments
{
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {
"type": "object" // <-- all properties should be objects except @type
}
} and input is: {
"@type": "type.googleapis.com/google.rpc.LocalizedMessage",
"locale": "en-US", // <- string
"message": "Fix your widget"
} It seems for me that decoder works as intended. Error message might be more clear, I guess. |
Hm... The yaml was created by the gRPC Gateway, which only supports OpenAPI v2: protobufAny:
type: object
properties:
'@type':
type: string
additionalProperties: {} I upgraded it to v3 using swagger-codegen, which turned it into this: protobufAny:
type: object
properties:
'@type':
type: string
additionalProperties:
type: object So I'm not an expert in OpenAPI. I am guessing that instead of |
In OpenAPI 3, |
What version of ogen are you using?
v1.4.1
Can this issue be reproduced with the latest version?
Yes
What did you do?
Generated a golang client, used it, received an error, and ogen wasn't able to decode the error.
Here is the openapi spec that generated ogen's client:
https://github.com/veqryn/awesome-go-api/blob/c737ba1703d2ca30be0d898b17717eca8c70565f/protobufv3/openapiv3/gen/openapi.yaml#L248-L259
Here is the client that uses the generated code:
https://github.com/veqryn/awesome-go-api/blob/c737ba1703d2ca30be0d898b17717eca8c70565f/protobufv3/openapiv3/ogen/main.go#L48-L49
When I curl the server, the response looks like this:
Ogen seems to be unable to decode that response body into the rpcStatus object details.
What did you expect to see?
No decode error.
What did you see instead?
The text was updated successfully, but these errors were encountered: