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

JSON schema google.protobuf.Duration Should Be Treated as string #250

Closed
grant opened this issue Jul 6, 2021 · 0 comments · Fixed by #254
Closed

JSON schema google.protobuf.Duration Should Be Treated as string #250

grant opened this issue Jul 6, 2021 · 0 comments · Fixed by #254
Assignees
Labels
api: eventarc Issues related to the googleapis/google-cloudevents API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@grant
Copy link
Contributor

grant commented Jul 6, 2021

It looks like the JSON serialization of a google.protobuf.Duration is a string like "660s". Currently we misrepresent the JSON schema as an object. This affects types like Cloud Build objects.

I've filed an upstream issue here: chrusty/protoc-gen-jsonschema#63

@grant grant added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jul 6, 2021
@product-auto-label product-auto-label bot added the api: eventarc Issues related to the googleapis/google-cloudevents API. label Jul 6, 2021
@grant grant self-assigned this Jul 12, 2021
gcf-merge-on-green bot pushed a commit that referenced this issue Jul 12, 2021
Fixes #250

Uses `PROTOC_PLUGIN_VERSION=1.0.0`.

- Better JSON representation for `google.protobuf.Value`
- Better JSON representation for `google.protobuf.Duration`

This should result in better parsing for these well known types, and types that aren't always JSON objects (hence the oneOf).

See: https://developers.google.com/protocol-buffers/docs/reference/google.protobuf
- e.g. https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Value

Gen'd updates to language clients would follow this PR. Unfortunately the `oneOf` syntax isn't the greatest with quicktype. Although it is the most accurate for the JSON (not everything is an object), and easier to deal with downstream. Look at the protobuf docs for your own assessment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: eventarc Issues related to the googleapis/google-cloudevents API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant