-
Notifications
You must be signed in to change notification settings - Fork 251
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
protoc-gen-openapi: Enum types that use stringified boolean values like "TRUE"
are treated as the real boolean values
#407
Comments
Related code lines: gnostic/cmd/protoc-gen-openapi/generator/wellknown/schemas.go Lines 53 to 63 in ee84fd2
My simple solution is: schema.Enum = append(schema.Enum, &v3.Any{
Yaml: strconv.Quote(string(field.Enum().Values().Get(i).Name())),
}) But is it correct to add Quote here? |
@zaakn a safer way to handle that instead of using quoting might be to set data type annotation like |
use yaml type tag `!!str` to represent boolean-like and `NULL` enum values. fixes: google#407
env
--openapi_opt naming=proto,enum_type=string
proto file
expected output
actual output
I know it's better not to use reserved words, so this is just for usage feedback.
The text was updated successfully, but these errors were encountered: