-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a prototype for generating jsonschema files (#112)
* Added a prototype for generating jsonschema files Signed-off-by: Fredrik Skogman <kommendorkapten@github.com> * Removed unused changes to Dockerfile Signed-off-by: Fredrik Skogman <kommendorkapten@github.com> * Dockerfile.jsonschema: pin apk versions Signed-off-by: William Woodruff <william@trailofbits.com> * Makefile: add jsonschema to all Signed-off-by: William Woodruff <william@trailofbits.com> * gen/jsonschema: regen Signed-off-by: William Woodruff <william@trailofbits.com> * Dockerfile.jsonschema: optimize git clone slightly Signed-off-by: William Woodruff <william@trailofbits.com> * jsonschema: regen Signed-off-by: William Woodruff <william@trailofbits.com> * Dockerfile.jsonschema: check out a fixed revision Signed-off-by: William Woodruff <william@trailofbits.com> * RELEASE: document JSON schema process Signed-off-by: William Woodruff <william@trailofbits.com> --------- Signed-off-by: Fredrik Skogman <kommendorkapten@github.com> Signed-off-by: William Woodruff <william@trailofbits.com> Co-authored-by: William Woodruff <william@trailofbits.com>
- Loading branch information
1 parent
e728c60
commit 9abc8c2
Showing
38 changed files
with
3,882 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 3.18.2 | ||
FROM alpine@sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70 | ||
RUN apk add --update protoc=3.21.12-r2 protobuf-dev=3.21.12-r2 go=1.20.5-r0 git=2.40.1-r0 | ||
RUN go install github.com/chrusty/protoc-gen-jsonschema/cmd/protoc-gen-jsonschema@1.4.1 | ||
# This is required to get the field_behavior.proto file | ||
# NOTE: --filter=tree:0 performs a treeless clone; we do this to optimize cloning | ||
# this otherwise relatively heavy repository. | ||
RUN git clone --filter=tree:0 https://github.com/googleapis/googleapis.git \ | ||
&& cd googleapis \ | ||
&& git checkout 95f0f2b2aee51e460646320d6e8f2ce75c463f5a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
set -u | ||
set -e | ||
|
||
protoc --plugin=/root/go/bin/protoc-gen-jsonschema \ | ||
--jsonschema_opt=enforce_oneof \ | ||
--jsonschema_opt=file_extension=schema.json \ | ||
--jsonschema_opt=disallow_additional_properties \ | ||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"$ref": "#/definitions/Artifact", | ||
"definitions": { | ||
"Artifact": { | ||
"properties": { | ||
"artifact_uri": { | ||
"type": "string", | ||
"description": "Location of the artifact" | ||
}, | ||
"artifact": { | ||
"type": "string", | ||
"description": "The raw bytes of the artifact", | ||
"format": "binary", | ||
"binaryEncoding": "base64" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"required": [ | ||
"artifact_uri" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"artifact" | ||
] | ||
} | ||
], | ||
"title": "Artifact" | ||
} | ||
} | ||
} |
Oops, something went wrong.