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

feat: improve jsonschema types for protobuf well known types #254

Merged
merged 1 commit into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 156 additions & 19 deletions jsonschema/google/events/cloud/audit/v1/LogEntryData.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand Down Expand Up @@ -107,7 +122,9 @@
},
"value": {
"type": "string",
"description": "Must be a valid serialized protocol buffer of the above specified type."
"description": "Must be a valid serialized protocol buffer of the above specified type.",
"format": "binary",
"binaryEncoding": "base64"
}
},
"additionalProperties": true,
Expand Down Expand Up @@ -136,8 +153,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand All @@ -164,8 +196,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand All @@ -186,8 +233,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand Down Expand Up @@ -353,8 +415,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand Down Expand Up @@ -420,8 +497,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand All @@ -435,8 +527,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand All @@ -450,8 +557,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand All @@ -465,8 +587,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand Down
48 changes: 12 additions & 36 deletions jsonschema/google/events/cloud/cloudbuild/v1/BuildEventData.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,8 @@
"description": "Stores timing information for pulling this build step's\n builder image only."
},
"timeout": {
"properties": {
"seconds": {
"type": "integer",
"description": "Signed seconds of the span of time. Must be from -315,576,000,000\n to +315,576,000,000 inclusive. Note: these bounds are computed from:\n 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years"
},
"nanos": {
"type": "integer",
"description": "Signed fractions of a second at nanosecond resolution of the span\n of time. Durations less than one second are represented with a 0\n `seconds` field and a positive or negative `nanos` field. For durations\n of one second or more, a non-zero value for the `nanos` field must be\n of the same sign as the `seconds` field. Must be from -999,999,999\n to +999,999,999 inclusive."
}
},
"additionalProperties": true,
"type": "object",
"type": "string",
"description": "Time limit for executing this build step. If not defined, the step has no\n time limit and will be allowed to continue to run until either it completes\n or the build itself times out."
},
"status": {
Expand Down Expand Up @@ -237,7 +227,9 @@
"type": "string"
},
"type": "array",
"description": "List of build step outputs, produced by builder images, in the order\n corresponding to build step indices.\n\n [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders)\n can produce this output by writing to `$BUILDER_OUTPUT/output`.\n Only the first 4KB of data is stored."
"description": "List of build step outputs, produced by builder images, in the order\n corresponding to build step indices.\n\n [Cloud Builders](https://cloud.google.com/cloud-build/docs/cloud-builders)\n can produce this output by writing to `$BUILDER_OUTPUT/output`.\n Only the first 4KB of data is stored.",
"format": "binary",
"binaryEncoding": "base64"
},
"artifactTiming": {
"$ref": "#/definitions/TimeSpan",
Expand Down Expand Up @@ -265,18 +257,8 @@
"format": "date-time"
},
"timeout": {
"properties": {
"seconds": {
"type": "integer",
"description": "Signed seconds of the span of time. Must be from -315,576,000,000\n to +315,576,000,000 inclusive. Note: these bounds are computed from:\n 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years"
},
"nanos": {
"type": "integer",
"description": "Signed fractions of a second at nanosecond resolution of the span\n of time. Durations less than one second are represented with a 0\n `seconds` field and a positive or negative `nanos` field. For durations\n of one second or more, a non-zero value for the `nanos` field must be\n of the same sign as the `seconds` field. Must be from -999,999,999\n to +999,999,999 inclusive."
}
},
"additionalProperties": true,
"type": "object",
"type": "string",
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Filed chrusty/protoc-gen-jsonschema#66

"description": "Amount of time that this build should be allowed to run, to second\n granularity. If this amount of time elapses, work on the build will cease\n and the build status will be `TIMEOUT`."
},
"images": {
Expand All @@ -287,18 +269,8 @@
"description": "A list of images to be pushed upon the successful completion of all build\n steps.\n\n The images are pushed using the builder service account's credentials.\n\n The digests of the pushed images will be stored in the `Build` resource's\n results field.\n\n If any of the images fail to be pushed, the build status is marked\n `FAILURE`."
},
"queueTtl": {
"properties": {
"seconds": {
"type": "integer",
"description": "Signed seconds of the span of time. Must be from -315,576,000,000\n to +315,576,000,000 inclusive. Note: these bounds are computed from:\n 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years"
},
"nanos": {
"type": "integer",
"description": "Signed fractions of a second at nanosecond resolution of the span\n of time. Durations less than one second are represented with a 0\n `seconds` field and a positive or negative `nanos` field. For durations\n of one second or more, a non-zero value for the `nanos` field must be\n of the same sign as the `seconds` field. Must be from -999,999,999\n to +999,999,999 inclusive."
}
},
"additionalProperties": true,
"type": "object",
"type": "string",
"description": "TTL in queue for this build. If provided and the build is enqueued longer\n than this value, the build will expire and the build status will be\n `EXPIRED`.\n\n The TTL starts ticking from create_time."
},
"artifacts": {
Expand Down Expand Up @@ -381,7 +353,9 @@
},
"value": {
"type": "string",
"description": "The hash value."
"description": "The hash value.",
"format": "binary",
"binaryEncoding": "base64"
}
},
"additionalProperties": true,
Expand Down Expand Up @@ -575,7 +549,9 @@
},
"secretEnv": {
"additionalProperties": {
"type": "string"
"type": "string",
"format": "binary",
"binaryEncoding": "base64"
},
"type": "object",
"description": "Map of environment variable name to its encrypted value.\n\n Secret environment variables must be unique across all of a build's\n secrets, and must be used by at least one build step. Values can be at most\n 64 KB in size. There can be at most 100 secret values across all of a\n build's secrets."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@
},
"bytesValue": {
"type": "string",
"description": "A bytes value.\n\n Must not exceed 1 MiB - 89 bytes.\n Only the first 1,500 bytes are considered by queries."
"description": "A bytes value.\n\n Must not exceed 1 MiB - 89 bytes.\n Only the first 1,500 bytes are considered by queries.",
"format": "binary",
"binaryEncoding": "base64"
},
"referenceValue": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"properties": {
"data": {
"type": "string",
"description": "The binary data in the message."
"description": "The binary data in the message.",
"format": "binary",
"binaryEncoding": "base64"
},
"attributes": {
"additionalProperties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"properties": {
"customData": {
"type": "string",
"description": "The custom data the user specified when creating the scheduler source."
"description": "The custom data the user specified when creating the scheduler source.",
"format": "binary",
"binaryEncoding": "base64"
}
},
"additionalProperties": true,
Expand Down
19 changes: 17 additions & 2 deletions jsonschema/google/events/firebase/auth/v1/AuthEventData.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,23 @@
"properties": {
"fields": {
"additionalProperties": {
"additionalProperties": true,
"type": "object"
"oneOf": [
{
"type": "array"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "string"
}
]
},
"type": "object",
"description": "Unordered map of dynamically typed values."
Expand Down
Loading