Skip to content

Commit

Permalink
feat: Use the common schemas for more properties of various schemas (#…
Browse files Browse the repository at this point in the history
…248)

* feat: Use the common user schema for the owner property of various schemas
* feat: Be more explicit on the common user type property
* feat: Use common repository schema in payload schemas
  • Loading branch information
wolfy1339 committed Jan 8, 2021
1 parent ad036e4 commit 02ffee6
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 4,178 deletions.
1 change: 1 addition & 0 deletions bin/validate-payload-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const fs = require("fs");
const { ajv, validate } = require("../payload-schemas");
const { MissingRefError } = require("ajv/dist/compile/error_classes");

let hasErrors = false;
const payloads = `./payload-examples/api.github.com`;
Expand Down
158 changes: 2 additions & 156 deletions payload-schemas/schemas/check_run.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,84 +255,7 @@
"type": "string"
},
"owner": {
"type": "object",
"required": [
"login",
"id",
"node_id",
"avatar_url",
"gravatar_id",
"url",
"html_url",
"followers_url",
"following_url",
"gists_url",
"starred_url",
"subscriptions_url",
"organizations_url",
"repos_url",
"events_url",
"received_events_url",
"type",
"site_admin"
],
"properties": {
"login": {
"type": "string"
},
"id": {
"type": "integer"
},
"node_id": {
"type": "string"
},
"avatar_url": {
"type": "string"
},
"gravatar_id": {
"type": "string"
},
"url": {
"type": "string"
},
"html_url": {
"type": "string"
},
"followers_url": {
"type": "string"
},
"following_url": {
"type": "string"
},
"gists_url": {
"type": "string"
},
"starred_url": {
"type": "string"
},
"subscriptions_url": {
"type": "string"
},
"organizations_url": {
"type": "string"
},
"repos_url": {
"type": "string"
},
"events_url": {
"type": "string"
},
"received_events_url": {
"type": "string"
},
"type": {
"type": "string"
},
"site_admin": {
"type": "boolean"
}
},
"additionalProperties": false
"$ref": "common/user.schema.json"
},
"name": {
"type": "string"
Expand Down Expand Up @@ -455,84 +378,7 @@
"type": "string"
},
"owner": {
"type": "object",
"required": [
"login",
"id",
"node_id",
"avatar_url",
"gravatar_id",
"url",
"html_url",
"followers_url",
"following_url",
"gists_url",
"starred_url",
"subscriptions_url",
"organizations_url",
"repos_url",
"events_url",
"received_events_url",
"type",
"site_admin"
],
"properties": {
"login": {
"type": "string"
},
"id": {
"type": "integer"
},
"node_id": {
"type": "string"
},
"avatar_url": {
"type": "string"
},
"gravatar_id": {
"type": "string"
},
"url": {
"type": "string"
},
"html_url": {
"type": "string"
},
"followers_url": {
"type": "string"
},
"following_url": {
"type": "string"
},
"gists_url": {
"type": "string"
},
"starred_url": {
"type": "string"
},
"subscriptions_url": {
"type": "string"
},
"organizations_url": {
"type": "string"
},
"repos_url": {
"type": "string"
},
"events_url": {
"type": "string"
},
"received_events_url": {
"type": "string"
},
"type": {
"type": "string"
},
"site_admin": {
"type": "boolean"
}
},
"additionalProperties": false
"$ref": "common/user.schema.json"
},
"name": {
"type": "string"
Expand Down
81 changes: 1 addition & 80 deletions payload-schemas/schemas/check_suite.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,86 +180,7 @@
"node_id": {
"type": "string"
},
"owner": {
"type": "object",
"required": [
"login",
"id",
"node_id",
"avatar_url",
"gravatar_id",
"url",
"html_url",
"followers_url",
"following_url",
"gists_url",
"starred_url",
"subscriptions_url",
"organizations_url",
"repos_url",
"events_url",
"received_events_url",
"type",
"site_admin"
],
"properties": {
"login": {
"type": "string"
},
"id": {
"type": "integer"
},
"node_id": {
"type": "string"
},
"avatar_url": {
"type": "string"
},
"gravatar_id": {
"type": "string"
},
"url": {
"type": "string"
},
"html_url": {
"type": "string"
},
"followers_url": {
"type": "string"
},
"following_url": {
"type": "string"
},
"gists_url": {
"type": "string"
},
"starred_url": {
"type": "string"
},
"subscriptions_url": {
"type": "string"
},
"organizations_url": {
"type": "string"
},
"repos_url": {
"type": "string"
},
"events_url": {
"type": "string"
},
"received_events_url": {
"type": "string"
},
"type": {
"type": "string"
},
"site_admin": {
"type": "boolean"
}
},
"additionalProperties": false
},
"owner": { "$ref": "common/user.schema.json" },
"name": {
"type": "string"
},
Expand Down
3 changes: 3 additions & 0 deletions payload-schemas/schemas/common/repository.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@
}
},
"additionalProperties": false
},
"public": {
"type": "boolean"
}
},
"additionalProperties": false
Expand Down
3 changes: 2 additions & 1 deletion payload-schemas/schemas/common/user.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"type": "string"
},
"type": {
"type": "string"
"type": "string",
"enum": ["Bot", "User", "Organization"]
},
"site_admin": {
"type": "boolean"
Expand Down
Loading

0 comments on commit 02ffee6

Please sign in to comment.