From ee623e54457d80410b5270ec68c8c257f6b0eb89 Mon Sep 17 00:00:00 2001 From: laurentsimon <64505099+laurentsimon@users.noreply.github.com> Date: Mon, 21 Mar 2022 13:08:50 -0700 Subject: [PATCH] Add schema for the raw JSON (#1758) --- cron/format/json.raw.schema | 255 ++++++++++++++++++++++++++++++++++++ pkg/json.raw.schema | 255 ++++++++++++++++++++++++++++++++++++ 2 files changed, 510 insertions(+) create mode 100644 cron/format/json.raw.schema create mode 100644 pkg/json.raw.schema diff --git a/cron/format/json.raw.schema b/cron/format/json.raw.schema new file mode 100644 index 00000000000..ff379d7b519 --- /dev/null +++ b/cron/format/json.raw.schema @@ -0,0 +1,255 @@ +{ + "$schema": "http://json-schema.org/schema#", + "type": "object", + "properties": { + "binaries": { + "type": "array", + "items": { + "type": "object", + "properties": { + "offset": { + "type": "integer" + }, + "path": { + "type": "string" + } + }, + "required": [ + "path" + ] + } + }, + "branch-protections": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "protection": { + "type": "object", + "properties": { + "allows-deletions": { + "type": "boolean" + }, + "allows-force-pushes": { + "type": "boolean" + }, + "dismisses-stale-reviews": { + "type": "boolean" + }, + "enforces-admin": { + "type": "boolean" + }, + "required-linear-history": { + "type": "boolean" + }, + "required-reviewer-count": { + "type": "integer" + }, + "requires-code-owner-review": { + "type": "boolean" + }, + "requires-status-checks": { + "type": "boolean" + }, + "requires-updated-branches-to-merge": { + "type": "boolean" + }, + "status-checks-contexts": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "required-reviewer-count", + "allows-deletions", + "allows-force-pushes", + "requires-code-owner-review", + "required-linear-history", + "dismisses-stale-reviews", + "enforces-admin", + "requires-status-checks", + "requires-updated-branches-to-merge", + "status-checks-contexts" + ] + } + }, + "required": [ + "protection", + "name" + ] + } + }, + "database-vulnerabilities": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string" + } + }, + "required": [ + "ID" + ] + } + }, + "default-branch-commits": { + "type": "array", + "items": { + "type": "object", + "properties": { + "commit-message": { + "type": "string" + }, + "committer": { + "type": "object", + "properties": { + "login": { + "type": "string" + } + }, + "required": [ + "login" + ] + }, + "merge-request": { + "type": "object", + "properties": { + "author": { + "type": "object", + "properties": { + "login": { + "type": "string" + } + }, + "required": [ + "login" + ] + }, + "labels": { + "type": "array", + "items": { + "type": "string" + } + }, + "number": { + "type": "integer" + }, + "reviews": { + "type": "array", + "items": { + "type": "object", + "properties": { + "reviewer": { + "type": "object", + "properties": { + "login": { + "type": "string" + } + }, + "required": [ + "login" + ] + }, + "state": { + "type": "string" + } + }, + "required": [ + "reviewer", + "state" + ] + } + } + }, + "required": [ + "number", + "labels", + "reviews", + "author" + ] + }, + "sha": { + "type": "string" + } + }, + "required": [ + "committer", + "merge-request", + "commit-message", + "sha" + ] + } + }, + "dependency-update-tools": { + "type": "array", + "items": { + "type": "object", + "properties": { + "desc": { + "type": "string" + }, + "files": { + "type": "array", + "items": { + "type": "object", + "properties": { + "offset": { + "type": "integer" + }, + "path": { + "type": "string" + } + }, + "required": [ + "path" + ] + } + }, + "name": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "required": [ + "name", + "url", + "desc", + "files" + ] + } + }, + "security-policies": { + "type": "array", + "items": { + "type": "object", + "properties": { + "offset": { + "type": "integer" + }, + "path": { + "type": "string" + } + }, + "required": [ + "path" + ] + } + } + }, + "required": [ + "database-vulnerabilities", + "binaries", + "security-policies", + "dependency-update-tools", + "branch-protections", + "default-branch-commits" + ] +} \ No newline at end of file diff --git a/pkg/json.raw.schema b/pkg/json.raw.schema new file mode 100644 index 00000000000..ff379d7b519 --- /dev/null +++ b/pkg/json.raw.schema @@ -0,0 +1,255 @@ +{ + "$schema": "http://json-schema.org/schema#", + "type": "object", + "properties": { + "binaries": { + "type": "array", + "items": { + "type": "object", + "properties": { + "offset": { + "type": "integer" + }, + "path": { + "type": "string" + } + }, + "required": [ + "path" + ] + } + }, + "branch-protections": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "protection": { + "type": "object", + "properties": { + "allows-deletions": { + "type": "boolean" + }, + "allows-force-pushes": { + "type": "boolean" + }, + "dismisses-stale-reviews": { + "type": "boolean" + }, + "enforces-admin": { + "type": "boolean" + }, + "required-linear-history": { + "type": "boolean" + }, + "required-reviewer-count": { + "type": "integer" + }, + "requires-code-owner-review": { + "type": "boolean" + }, + "requires-status-checks": { + "type": "boolean" + }, + "requires-updated-branches-to-merge": { + "type": "boolean" + }, + "status-checks-contexts": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "required-reviewer-count", + "allows-deletions", + "allows-force-pushes", + "requires-code-owner-review", + "required-linear-history", + "dismisses-stale-reviews", + "enforces-admin", + "requires-status-checks", + "requires-updated-branches-to-merge", + "status-checks-contexts" + ] + } + }, + "required": [ + "protection", + "name" + ] + } + }, + "database-vulnerabilities": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ID": { + "type": "string" + } + }, + "required": [ + "ID" + ] + } + }, + "default-branch-commits": { + "type": "array", + "items": { + "type": "object", + "properties": { + "commit-message": { + "type": "string" + }, + "committer": { + "type": "object", + "properties": { + "login": { + "type": "string" + } + }, + "required": [ + "login" + ] + }, + "merge-request": { + "type": "object", + "properties": { + "author": { + "type": "object", + "properties": { + "login": { + "type": "string" + } + }, + "required": [ + "login" + ] + }, + "labels": { + "type": "array", + "items": { + "type": "string" + } + }, + "number": { + "type": "integer" + }, + "reviews": { + "type": "array", + "items": { + "type": "object", + "properties": { + "reviewer": { + "type": "object", + "properties": { + "login": { + "type": "string" + } + }, + "required": [ + "login" + ] + }, + "state": { + "type": "string" + } + }, + "required": [ + "reviewer", + "state" + ] + } + } + }, + "required": [ + "number", + "labels", + "reviews", + "author" + ] + }, + "sha": { + "type": "string" + } + }, + "required": [ + "committer", + "merge-request", + "commit-message", + "sha" + ] + } + }, + "dependency-update-tools": { + "type": "array", + "items": { + "type": "object", + "properties": { + "desc": { + "type": "string" + }, + "files": { + "type": "array", + "items": { + "type": "object", + "properties": { + "offset": { + "type": "integer" + }, + "path": { + "type": "string" + } + }, + "required": [ + "path" + ] + } + }, + "name": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "required": [ + "name", + "url", + "desc", + "files" + ] + } + }, + "security-policies": { + "type": "array", + "items": { + "type": "object", + "properties": { + "offset": { + "type": "integer" + }, + "path": { + "type": "string" + } + }, + "required": [ + "path" + ] + } + } + }, + "required": [ + "database-vulnerabilities", + "binaries", + "security-policies", + "dependency-update-tools", + "branch-protections", + "default-branch-commits" + ] +} \ No newline at end of file