-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: improve jsonschema types for protobuf well known types #254
Conversation
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy with bytes and Value - I think Duration still needs some work though.
"additionalProperties": true, | ||
"type": "object", | ||
"type": "string", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm slightly surprised there's no format part here - does this mean there's no way of a JSON schema consumer telling the difference between a duration and a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently don't have it but we can add the formatting in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Approving as it's definitely better than before.)
Generation from updated schemas: googleapis/google-cloudevents#254 Should allow proper typing for Cloud Build types for example.
🤖 I have created a release \*beep\* \*boop\* --- ## [1.6.0](https://www.github.com/googleapis/google-cloudevents/compare/v1.5.0...v1.6.0) (2021-07-12) ### Features * improve jsonschema types for protobuf well known types ([#254](https://www.github.com/googleapis/google-cloudevents/issues/254)) ([e59a4bf](https://www.github.com/googleapis/google-cloudevents/commit/e59a4bfd8d8777a4415062533b0fc08712e0f292)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Fixes #250
Uses
PROTOC_PLUGIN_VERSION=1.0.0
.google.protobuf.Value
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
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.