-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Items type for google.protobuf.ListValue #3414
Comments
I might be misunderstanding, but the schema for ListValue is based on the defined JSON representation, which states that it is a JSON array. Theoretically, it could be an array of any JSON value, but because we don't know, we choose the most generic one, object. We have to choose something, so what do you suggest? There's no option to specify a specific type (if you want an array of strings, use |
ListValue helps distinguish between nil (the JSON key is not passed) and an empty array (the JSON key is passed with an empty content), while As for the option, we could add it to JSONSchema. |
@johanbrandhorst, @far4599 any updates or comments? |
🐛 Bug Report
If we use google.protobuf.ListValue, the generated swagger spec specifies items type as object:
Swagger-ui considers it an error, if we pass an array, e.g. of strings:
The generated json spec contains:
To Reproduce
Expected behavior
There should be a choice to specify the type for items.
Actual Behavior
The items type is taken from wktSchemas:
https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.16.0/protoc-gen-openapiv2/internal/genopenapi/template.go#L98-L104
Your Environment
OSX Ventura 13.4.1, Go 1.20, [email protected]
The text was updated successfully, but these errors were encountered: