Skip to content

Commit 30f6fac

Browse files
jay-shigrantdependabot[bot]jskeet
authored
Update copybara branch (#187)
* chore: run the generator, feb 26, 2021 (#173) Runs the generator manually. The latest change has improvements to metadata about base64 type strings. Fixes: #174 * chore(deps): bump urijs from 1.19.5 to 1.19.6 in /tools/quicktype-wrapper (#175) Bumps [urijs](https://github.com/medialize/URI.js) from 1.19.5 to 1.19.6. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/medialize/URI.js/releases">urijs's releases</a>.</em></p> <blockquote> <h2>1.19.6 (February 13th 2021)</h2> <ul> <li><strong>SECURITY</strong> fixing <a href="http://medialize.github.io/URI.js/docs.html#static-parse"><code>URI.parse()</code></a> to rewrite <code>\</code> in scheme delimiter to <code>/</code> as Node and Browsers do - disclosed privately by <a href="https://twitter.com/ynizry">Yaniv Nizry</a> from the CxSCA AppSec team at Checkmarx</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/medialize/URI.js/blob/gh-pages/CHANGELOG.md">urijs's changelog</a>.</em></p> <blockquote> <h3>1.19.6 (February 13th 2021)</h3> <ul> <li><strong>SECURITY</strong> fixing <a href="http://medialize.github.io/URI.js/docs.html#static-parse"><code>URI.parse()</code></a> to rewrite <code>\</code> in scheme delimiter to <code>/</code> as Node and Browsers do - disclosed privately by <a href="https://twitter.com/ynizry">Yaniv Nizry</a> from the CxSCA AppSec team at Checkmarx</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/medialize/URI.js/commit/46c8ac0c7e6997daad8ff6859784b39f8892fa97"><code>46c8ac0</code></a> chore(build): bumping to version 1.19.6</li> <li><a href="https://github.com/medialize/URI.js/commit/a1ad8bcbc39a4d136d7e252e76e957f3ece70839"><code>a1ad8bc</code></a> fix(parse): treat backslash as forwardslash in scheme delimiter</li> <li>See full diff in <a href="https://github.com/medialize/URI.js/compare/v1.19.5...v1.19.6">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=urijs&package-manager=npm_and_yarn&previous-version=1.19.5&new-version=1.19.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/googleapis/google-cloudevents/network/alerts). </details> * JSON Schema postgen native json fieldnames (#178) * fix: uses protoc plugin field for json schema field capitalization Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: fix replacement string Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: use full id name in jsonschema definitions Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * Add action script to handle copybara flow (#181) * Add a action script that auto-generates a pull request when there is a push to branch "copybara". The branch "copybara" only receives push from Copybara flow. * Cloud Audit Log Catalog (#158) * docs: add CAL catalog Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * docs: updates docs with cal catalog Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * docs: detailed test for CAL trigger docs Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: cal catalog script use json quotes not js quotes Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * refactor: improve readability of audit log gen script Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * chore: add licenses to files (#183) Signed-off-by: Grant Timmerman <timmerman+devrel@google.com> * fix: Fix generation on Windows Fixes #154 * ci: jsonschema validation (#186) Validates that the JSON schemas are valid schemas according to the JSON schema schema. I've ran a few CI runs to ensure that this check is correct. We already have CI that checks for a 0 diff between proto and jsonschema, so naturally that check also breaks when if modifying the json schema manually. ## Example CI runs Purposeful invalid JSON schema break: ![Screen Shot 2021-03-18 at 13 12 25](https://user-images.githubusercontent.com/744973/111676018-ba718c00-87eb-11eb-8b32-3ece124184f1.png) Purposeful valid JSON schema fix: ![Screen Shot 2021-03-18 at 13 12 43](https://user-images.githubusercontent.com/744973/111676024-bcd3e600-87eb-11eb-82e5-00ba04dfbf9f.png) ## Notes Local testing is pretty easy, just install Node and copy the npx script. ### Example CI output ```md Run JSON_SCHEMAS=$(find ./jsonschema/google/events -name "*.json") npx: installed 41 in 4.585s ./jsonschema/google/events/cloud/firestore/v1/DocumentEventData.json valid npx: installed 41 in 2.189s ./jsonschema/google/events/cloud/storage/v1/StorageObjectData.json valid npx: installed 41 in 2.085s ./jsonschema/google/events/cloud/cloudbuild/v1/BuildEventData.json valid npx: installed 41 in 2.149s ./jsonschema/google/events/cloud/audit/v1/LogEntryData.json valid npx: installed 41 in 2.085s ./jsonschema/google/events/cloud/scheduler/v1/SchedulerJobData.json valid npx: installed 41 in 2.181s ./jsonschema/google/events/cloud/pubsub/v1/MessagePublishedData.json valid npx: installed 41 in 2.166s ./jsonschema/google/events/firebase/database/v1/ReferenceEventData.json valid npx: installed 41 in 2.094s ./jsonschema/google/events/firebase/analytics/v1/AnalyticsLogData.json valid npx: installed 41 in 2.091s ./jsonschema/google/events/firebase/remoteconfig/v1/RemoteConfigEventData.json valid npx: installed 41 in 2.161s ./jsonschema/google/events/firebase/auth/v1/AuthEventData.json valid ``` Co-authored-by: Grant Timmerman <744973+grant@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jon Skeet <jonskeet@google.com>
1 parent e998b7a commit 30f6fac

23 files changed

+4718
-151
lines changed

.github/workflows/copybara.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
# This script create a pull request when there is push to `copybara` branch
17+
18+
name: Create Copybara PR
19+
on:
20+
push:
21+
branches:
22+
- copybara
23+
jobs:
24+
create_pr:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Checkout copybara branch and create pull request
29+
env:
30+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
31+
run: |
32+
git config --global user.email "yoshi-code-bot@google.com"
33+
git config --global user.name "Yoshi Code Bot"
34+
git checkout copybara
35+
gh pr create \
36+
--title "[Copybara] Update with new internal changes from Piper"
37+
--body "This is a auto-generated pull request. The PR updates the default branch with new changes from the `copybara` branch. Refer to PR commit history for more details."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Validate JSON Schemas
16+
on: [push, pull_request]
17+
jobs:
18+
build:
19+
runs-on: ubuntu-18.04
20+
steps:
21+
- name: Check out repo
22+
uses: actions/checkout@v2
23+
- name: Setup Node
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: '12'
27+
- name: Run Validate JSON Schema Script
28+
run: |
29+
./scripts/validate_jsonschema.sh

AUDIT_CATALOG.md

+4,340
Large diffs are not rendered by default.

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,23 @@ This repository contains definitions for the following CloudEvents:
3737
|Firebase Remote Config|[Proto](proto/google/events/firebase/remoteconfig/v1/data.proto) / [JSON](https://googleapis.github.io/google-cloudevents/jsonschema/google/events/firebase/remoteconfig/v1/RemoteConfigEventData.json)|<br>Data Type:<br>`google.events.firebase.remoteconfig.v1.RemoteConfigEventData`<br>CloudEvent Type(s):<br>`google.firebase.remoteconfig.remoteConfig.v1.updated`|
3838
<!-- GENERATED END -->
3939

40-
A [registry of the JSON schema catalog](https://googleapis.github.io/google-cloudevents/jsonschema/catalog.json) is also available.
40+
## Google CloudEvent Catalogs
41+
42+
This repository contains catalogs for Google CloudEvent event discovery:
43+
44+
### Google CloudEvent JSON Schema catalog
45+
46+
Link: [`catalog.json`](./jsonschema/catalog.json)
47+
48+
A machine-readable list of Google CloudEvent JSON schemas. In the format of a [JSON Schema catalog](https://json.schemastore.org/schema-catalog).
49+
50+
### Cloud Audit Log catalog
51+
52+
Link: [`AUDIT_CATALOG.md`](./AUDIT_CATALOG.md)
53+
54+
A human-readable list of Audit Log `methodName` and `serviceName` event filters.
55+
56+
Used for filtering events of type `google.cloud.audit.log.v1.written`.
4157

4258
## Google CloudEvent Type Libraries
4359

jsonschema/google/events/cloud/audit/v1/LogEntryData.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@
107107
},
108108
"value": {
109109
"type": "string",
110-
"description": "Must be a valid serialized protocol buffer of the above specified type."
110+
"description": "Must be a valid serialized protocol buffer of the above specified type.",
111+
"format": "binary",
112+
"binaryEncoding": "base64"
111113
}
112114
},
113115
"additionalProperties": true,

jsonschema/google/events/cloud/cloudbuild/v1/BuildEventData.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@
234234
"type": "string"
235235
},
236236
"type": "array",
237-
"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."
237+
"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.",
238+
"format": "binary",
239+
"binaryEncoding": "base64"
238240
},
239241
"artifactTiming": {
240242
"$ref": "#/definitions/TimeSpan",
@@ -378,7 +380,9 @@
378380
},
379381
"value": {
380382
"type": "string",
381-
"description": "The hash value."
383+
"description": "The hash value.",
384+
"format": "binary",
385+
"binaryEncoding": "base64"
382386
}
383387
},
384388
"additionalProperties": true,
@@ -572,7 +576,9 @@
572576
},
573577
"secretEnv": {
574578
"additionalProperties": {
575-
"type": "string"
579+
"type": "string",
580+
"format": "binary",
581+
"binaryEncoding": "base64"
576582
},
577583
"type": "object",
578584
"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."

jsonschema/google/events/cloud/firestore/v1/DocumentEventData.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@
115115
},
116116
"bytesValue": {
117117
"type": "string",
118-
"description": "A bytes value.\n\n Must not exceed 1 MiB - 89 bytes.\n Only the first 1,500 bytes are considered by queries."
118+
"description": "A bytes value.\n\n Must not exceed 1 MiB - 89 bytes.\n Only the first 1,500 bytes are considered by queries.",
119+
"format": "binary",
120+
"binaryEncoding": "base64"
119121
},
120122
"referenceValue": {
121123
"type": "string",

jsonschema/google/events/cloud/pubsub/v1/MessagePublishedData.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
"properties": {
1818
"data": {
1919
"type": "string",
20-
"description": "The binary data in the message."
20+
"description": "The binary data in the message.",
21+
"format": "binary",
22+
"binaryEncoding": "base64"
2123
},
2224
"attributes": {
2325
"additionalProperties": {

jsonschema/google/events/cloud/scheduler/v1/SchedulerJobData.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"properties": {
1313
"customData": {
1414
"type": "string",
15-
"description": "The custom data the user specified when creating the scheduler source."
15+
"description": "The custom data the user specified when creating the scheduler source.",
16+
"format": "binary",
17+
"binaryEncoding": "base64"
1618
}
1719
},
1820
"additionalProperties": true,

jsonschema/google/events/cloud/storage/v1/StorageObjectData.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"description": "The creation time of the object.\n Attempting to set this field will result in an error.",
5454
"format": "date-time"
5555
},
56-
"crc32C": {
56+
"crc32c": {
5757
"type": "string",
5858
"description": "CRC32c checksum. For more information about using the CRC32c\n checksum, see\n [https://cloud.google.com/storage/docs/hashes-etags#_JSONAPI][Hashes and\n ETags: Best Practices]."
5959
},

jsonschema/google/events/firebase/auth/v1/AuthEventData.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"type": "string",
2828
"description": "The user's display name."
2929
},
30-
"photoUrl": {
30+
"photoURL": {
3131
"type": "string",
3232
"description": "The user's photo URL."
3333
},
@@ -67,7 +67,7 @@
6767
"type": "string",
6868
"description": "The display name for the linked provider."
6969
},
70-
"photoUrl": {
70+
"photoURL": {
7171
"type": "string",
7272
"description": "The photo URL for the linked provider."
7373
},

scripts/validate_jsonschema.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Copyright 2021 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Validates the JSON Schemas are valid.
17+
# Must be run from the repo's root folder.
18+
19+
# Install JSON schema schema
20+
mkdir -p tmp
21+
curl -o tmp/jsonschema-schema.json http://json-schema.org/draft-04/schema
22+
23+
# Validate every schema
24+
JSON_SCHEMAS=$(find ./jsonschema/google/events -name "*.json")
25+
while IFS= read -r line ; do
26+
npx ajv-cli@v3.0.0 validate -s tmp/jsonschema-schema.json -d $line;
27+
done <<< "$JSON_SCHEMAS"

tools/proto2jsonschema/gen.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ for proto in $DATA_PROTOS; do
9090
# - Input: proto/ – our CloudEvent protos
9191
# - Input: googlapis/ – common googleapis protos
9292
$PROTOC \
93-
--jsonschema_out=disallow_bigints_as_strings:$OUT_PROTO_DIR \
93+
--jsonschema_out=json_fieldnames,disallow_bigints_as_strings:$OUT_PROTO_DIR \
9494
--proto_path=proto/ \
9595
--proto_path=third_party/googleapis \
9696
"$proto"

tools/proto2jsonschema/package-lock.json

-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/proto2jsonschema/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"postgen": "node postgen.js"
55
},
66
"dependencies": {
7-
"camelcase-keys": "^6.2.2",
87
"flat": "^5.0.2",
98
"protobufjs": "^6.10.2",
109
"recursive-readdir": "^2.2.2"

0 commit comments

Comments
 (0)