Skip to content

Commit

Permalink
feat: enhances jsonschema (#112)
Browse files Browse the repository at this point in the history
* feat: enhances jsonschema

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

* docs: revert tools readme registry

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

* fix: jsonschema types to clouddeventTypes

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
  • Loading branch information
grant authored Nov 19, 2020
1 parent ee54b88 commit 890c148
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 29 deletions.
7 changes: 6 additions & 1 deletion jsonschema/google/events/cloud/audit/v1/LogEntryData.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/cloud/audit/v1/LogEntryData.json",
"name": "LogEntryData",
"cloudevent": "google.events.cloud.audit.v1",
"package": "google.events.cloud.audit.v1",
"datatype": "google.events.cloud.audit.v1.LogEntryData",
"cloudeventTypes": [
"google.cloud.audit.log.v1.written"
],
"product": "Cloud Audit Logs",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"logName": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/cloud/cloudbuild/v1/BuildEventData.json",
"name": "BuildEventData",
"cloudevent": "google.events.cloud.cloudbuild.v1",
"package": "google.events.cloud.cloudbuild.v1",
"datatype": "google.events.cloud.cloudbuild.v1.BuildEventData",
"cloudeventTypes": [
"google.cloud.cloudbuild.build.v1.statusChanged"
],
"product": "Cloud Build",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"id": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/cloud/firestore/v1/DocumentEventData.json",
"name": "DocumentEventData",
"cloudevent": "google.events.cloud.firestore.v1",
"package": "google.events.cloud.firestore.v1",
"datatype": "google.events.cloud.firestore.v1.DocumentEventData",
"cloudeventTypes": [
"google.cloud.firestore.document.v1.created",
"google.cloud.firestore.document.v1.updated",
"google.cloud.firestore.document.v1.deleted",
"google.cloud.firestore.document.v1.written"
],
"product": "Cloud Firestore",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"value": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/cloud/pubsub/v1/MessagePublishedData.json",
"name": "MessagePublishedData",
"cloudevent": "google.events.cloud.pubsub.v1",
"package": "google.events.cloud.pubsub.v1",
"datatype": "google.events.cloud.pubsub.v1.MessagePublishedData",
"cloudeventTypes": [
"google.cloud.pubsub.topic.v1.messagePublished"
],
"product": "Cloud Pub/Sub",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"message": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/cloud/scheduler/v1/SchedulerJobData.json",
"name": "SchedulerJobData",
"cloudevent": "google.events.cloud.scheduler.v1",
"package": "google.events.cloud.scheduler.v1",
"datatype": "google.events.cloud.scheduler.v1.SchedulerJobData",
"cloudeventTypes": [
"google.cloud.scheduler.job.v1.executed"
],
"product": "Cloud Scheduler",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"customData": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/cloud/storage/v1/StorageObjectData.json",
"name": "StorageObjectData",
"cloudevent": "google.events.cloud.storage.v1",
"package": "google.events.cloud.storage.v1",
"datatype": "google.events.cloud.storage.v1.StorageObjectData",
"cloudeventTypes": [
"google.cloud.storage.object.v1.finalized",
"google.cloud.storage.object.v1.archived",
"google.cloud.storage.object.v1.deleted",
"google.cloud.storage.object.v1.metadataUpdated"
],
"product": "Cloud Storage",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"contentEncoding": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/firebase/analytics/v1/AnalyticsLogData.json",
"name": "AnalyticsLogData",
"cloudevent": "google.events.firebase.analytics.v1",
"package": "google.events.firebase.analytics.v1",
"datatype": "google.events.firebase.analytics.v1.AnalyticsLogData",
"cloudeventTypes": [
"google.firebase.analytics.log.v1.written"
],
"product": "Google Analytics for Firebase",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"userDim": {
Expand Down
8 changes: 7 additions & 1 deletion jsonschema/google/events/firebase/auth/v1/AuthEventData.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/firebase/auth/v1/AuthEventData.json",
"name": "AuthEventData",
"cloudevent": "google.events.firebase.auth.v1",
"package": "google.events.firebase.auth.v1",
"datatype": "google.events.firebase.auth.v1.AuthEventData",
"cloudeventTypes": [
"google.firebase.auth.user.v1.created",
"google.firebase.auth.user.v1.deleted"
],
"product": "Firebase Authentication",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"uid": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/firebase/database/v1/ReferenceEventData.json",
"name": "ReferenceEventData",
"cloudevent": "google.events.firebase.database.v1",
"package": "google.events.firebase.database.v1",
"datatype": "google.events.firebase.database.v1.ReferenceEventData",
"cloudeventTypes": [
"google.firebase.database.ref.v1.created",
"google.firebase.database.ref.v1.updated",
"google.firebase.database.ref.v1.deleted",
"google.firebase.database.ref.v1.written"
],
"product": "Firebase Realtime Database",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"data": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"$id": "https://googleapis.github.io/google-cloudevents/jsonschema/google/events/firebase/remoteconfig/v1/RemoteConfigEventData.json",
"name": "RemoteConfigEventData",
"cloudevent": "google.events.firebase.remoteconfig.v1",
"package": "google.events.firebase.remoteconfig.v1",
"datatype": "google.events.firebase.remoteconfig.v1.RemoteConfigEventData",
"cloudeventTypes": [
"google.firebase.remoteconfig.remoteConfig.v1.updated"
],
"product": "Firebase Remote Config",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"versionNumber": {
Expand Down
21 changes: 7 additions & 14 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
# Tools
# Google CloudEvent Repo Tools

The tools in this directory are not required in order to *use* the
rest of the content of this repository. They are present to help
create or maintain the content.

While they are *currently* written in C#, requiring .NET Core 3.1 to
build and run, this is purely incidental. Pull requests to rewrite
the tools in languages more commonly used at Google (e.g. Java, Go
or Python) are welcome.
## [registry](./registry/readme.md)

## registry
This tool edits the top-level [README](../README.md) event list.

This tool edits the top-level [README](../README.md) to maintain the
event registry. It requires that the protobuf descriptor set (a
protobuf representation of all the .proto files) is already
compiled via protoc. (The [root compile.sh script](../compile.sh)
does this.)
## [quicktype-wrapper](./quicktype-wrapper/README.md)

## quicktype-wrapper
This tool wraps the `quicktype` tool to generate any language using JSON schemas.

This tool wraps the quicktype tool to generate code using JSON Schema.
## [proto2jsonschema](./proto2jsonschema/README.md)

See [`quicktype-wrapper/`](./quicktype-wrapper/README.md).
This tool converts protobufs to JSON schemas.
94 changes: 94 additions & 0 deletions tools/proto2jsonschema/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tools/proto2jsonschema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
},
"dependencies": {
"camelcase-keys": "^6.2.2",
"flat": "^5.0.2",
"protobufjs": "^6.10.2",
"recursive-readdir": "^2.2.2"
}
}
Loading

0 comments on commit 890c148

Please sign in to comment.