Skip to content

Instantly share code, notes, and snippets.

@mann-david
Created February 11, 2021 13:42
Show Gist options
  • Save mann-david/818a84405b4a122dd086f26368352a46 to your computer and use it in GitHub Desktop.
Save mann-david/818a84405b4a122dd086f26368352a46 to your computer and use it in GitHub Desktop.
Consolidated schema file for json-schema-ref-parser
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "request-payload.schema.json",
"version": "2.0.1-alpha",
"additionalProperties": false,
"title": "Request",
"meta:status": "active",
"description": "A collection of elements describing a request for work submitted to the backend for processing",
"type": "object",
"propertyNames": {
"enum": [
"requestId",
"requestorId",
"workload",
"payload"
]
},
"required": [
"requestId",
"requestorId",
"workload",
"payload"
],
"properties": {
"payload": {
"type": "object"
},
"requestId": {
"description": "The unique identifier (GUID) for a request",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "guid.schema.json",
"additionalProperties": false,
"title": "Guid",
"type": "string",
"pattern": "^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$"
},
"requestorId": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "user.schema.json",
"additionalProperties": false,
"title": " User",
"description": "I/C/D number of a user",
"type": "string",
"pattern": "^[i|I|c|C|d|D][0-9]{3,7}$"
},
"workload": {
"description": "name of workload the request is for",
"type": "string",
"enum": [
"spo",
"teams",
"groups"
]
}
},
"allOf": [
{
"if": {
"properties": {
"workload": {
"const": "spo"
}
}
},
"then": {
"properties": {
"payload": {
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"$id": "spo-payload.schema.json",
"additionalProperties": false,
"title": "SPO Payload",
"description": "Information defining details for all SPO actions",
"properties": {
"details": {
"type": "object"
},
"updates": {
"type": "array"
},
"siteId": {},
"requestType": {
"description": "Identifies which type of SPO request is being submitted",
"type": "string",
"enum": [
"createSPO",
"updateSPO",
"deleteSPO"
]
}
},
"allOf": [
{
"if": {
"properties": {
"requestType": {
"const": "createSPO"
}
}
},
"then": {
"properties": {
"details": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-createSite.schema.json",
"additionalProperties": false,
"title": "SPO Create Site",
"description": "Details required for an operation to create a new SPO site",
"required": [
"owners",
"costCenter",
"siteTemplate",
"displayName",
"entityDescription"
],
"properties": {
"owners": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-owners.schema.json",
"additionalProperties": false,
"title": "SPO Owners",
"description": "Ids of the designators owners of a site",
"type": "array",
"uniqueItems": true,
"minItems": 2,
"maxItems": 10,
"items": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "user.schema.json",
"additionalProperties": false,
"title": " User",
"description": "I/C/D number of a user",
"type": "string",
"pattern": "^[i|I|c|C|d|D][0-9]{3,7}$"
}
},
"costCenter": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "costCenter.schema.json",
"additionalProperties": false,
"title": "Cost Center",
"description": "Id of the cost center for a site",
"type": "string"
},
"siteTemplate": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-siteTemplate.schema.json",
"additionalProperties": false,
"title": "SPO Site Template",
"description": "Details required for site template on an SPO site",
"type": "string",
"enum": [
"Modern Team",
"Classic Team",
"Document Library"
]
},
"displayName": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "displayName.schema.json",
"additionalProperties": false,
"title": "Display Name",
"description": "Title or Display Name of the resource",
"type": "string",
"$comment": "*title* is a keyword in JSON Schema and using it as a property caused validation issues, so switched to displayName"
},
"entityDescription": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "entityDescription.schema.json",
"additionalProperties": false,
"title": "Entity Description",
"type": "string",
"description": "Description of a managed Entity (SPO site, Team, etc)",
"$comment": "*description* is a keyword in JSON Schema and using it as a property caused validation issues"
},
"allowExternalSharing": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-externalSharing.schema.json",
"additionalProperties": false,
"title": "SPO External Sharing",
"description": "Whether or not external sharing is enabled on an SPO site",
"type": "boolean"
},
"allowAccessRequests": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-accessRequests.schema.json",
"additionalProperties": false,
"title": "SPO Access Requests",
"description": "Whether or not access requests can be submitted for a site",
"type": "boolean"
},
"allowMembersCanInvite": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-membersCanInvite.schema.json",
"additionalProperties": false,
"title": "SPO Members Can Invite",
"description": "Whether or not current members of a site can invite other people to the site",
"type": "boolean"
}
}
}
},
"required": [
"requestType",
"details"
]
}
},
{
"if": {
"properties": {
"requestType": {
"const": "updateSPO"
}
}
},
"then": {
"properties": {
"siteId": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "guid.schema.json",
"additionalProperties": false,
"title": "Guid",
"description": "A unique identifier string",
"type": "string",
"pattern": "^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$"
},
"updates": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-updateSite.schema.json",
"additionalProperties": false,
"title": "SPO Updates",
"description": "1+ operations to perform on an existing site",
"type": "array",
"minItems": 1,
"maxItems": 7,
"items": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-updateOperation.schema.json",
"title": "SPO Update Operation",
"description": "Details on a single operation to be performed on an existing site",
"type": "object",
"propertyNames": {
"enum": [
"operationType",
"costCenter",
"displayName",
"entityDescription",
"allowAccessRequests",
"allowExternalSharing",
"allowMembersCanInvite",
"owners",
"quotaInTb"
]
},
"properties": {
"allowAccessRequests": {},
"operationType": {
"type": "string",
"enum": [
"costCenter",
"displayName",
"entityDescription",
"allowAccessRequests",
"allowExternalSharing",
"allowMembersCanInvite",
"owners",
"quotaInTb"
]
}
},
"allOf": [
{
"if": {
"properties": {
"operationType": {
"const": "costCenter"
}
}
},
"then": {
"properties": {
"costCenter": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "costCenter.schema.json",
"additionalProperties": false,
"title": "Cost Center",
"description": "Id of the cost center for a site",
"type": "string"
}
},
"required": [
"operationType",
"costCenter"
]
}
},
{
"if": {
"properties": {
"operationType": {
"const": "displayName"
}
}
},
"then": {
"properties": {
"displayName": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "displayName.schema.json",
"additionalProperties": false,
"title": "Display Name",
"description": "Title or Display Name of the resource",
"type": "string",
"$comment": "*title* is a keyword in JSON Schema and using it as a property caused validation issues, so switched to displayName"
}
},
"required": [
"operationType",
"displayName"
]
}
},
{
"if": {
"properties": {
"operationType": {
"const": "entityDescription"
}
}
},
"then": {
"properties": {
"entityDescription": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "entityDescription.schema.json",
"additionalProperties": false,
"title": "Entity Description",
"type": "string",
"description": "Description of a managed Entity (SPO site, Team, etc)",
"$comment": "*description* is a keyword in JSON Schema and using it as a property caused validation issues"
}
},
"required": [
"operationType",
"entityDescription"
]
}
},
{
"if": {
"properties": {
"operationType": {
"const": "allowAccessRequests"
}
}
},
"then": {
"properties": {
"allowAccessRequests": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-accessRequests.schema.json",
"additionalProperties": false,
"title": "SPO Access Requests",
"description": "Whether or not access requests can be submitted for a site",
"type": "boolean"
}
},
"required": [
"operationType",
"allowAccessRequests"
]
}
},
{
"if": {
"properties": {
"operationType": {
"const": "allowExternalSharing"
}
}
},
"then": {
"properties": {
"allowExternalSharing": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-externalSharing.schema.json",
"additionalProperties": false,
"title": "SPO External Sharing",
"description": "Whether or not external sharing is enabled on an SPO site",
"type": "boolean"
}
},
"required": [
"operationType",
"allowExternalSharing"
]
}
},
{
"if": {
"properties": {
"operationType": {
"const": "allowMembersCanInvite"
}
}
},
"then": {
"properties": {
"allowMembersCanInvite": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-membersCanInvite.schema.json",
"additionalProperties": false,
"title": "SPO Members Can Invite",
"description": "Whether or not current members of a site can invite other people to the site",
"type": "boolean"
}
},
"required": [
"operationType",
"allowMembersCanInvite"
]
}
},
{
"if": {
"properties": {
"operationType": {
"const": "owners"
}
}
},
"then": {
"properties": {
"owners": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-owners.schema.json",
"additionalProperties": false,
"title": "SPO Owners",
"description": "Ids of the designators owners of a site",
"type": "array",
"uniqueItems": true,
"minItems": 2,
"maxItems": 10,
"items": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "user.schema.json",
"additionalProperties": false,
"title": " User",
"description": "I/C/D number of a user",
"type": "string",
"pattern": "^[i|I|c|C|d|D][0-9]{3,7}$"
}
}
},
"required": [
"operationType",
"owners"
]
}
},
{
"if": {
"properties": {
"operationType": {
"const": "quotaInTb"
}
}
},
"then": {
"properties": {
"quotaInTb": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-quotaInTb.schema.json",
"additionalProperties": false,
"title": "SPO Quota In TB",
"description": "Details regarding the Site Quota setting on an SPO site",
"type": "integer",
"minimum": 1,
"maximum": 25
}
},
"required": [
"operationType",
"quotaInTb"
]
}
}
]
}
}
},
"required": [
"requestType",
"updates",
"siteId"
]
}
},
{
"if": {
"properties": {
"requestType": {
"const": "deleteSPO"
}
}
},
"then": {
"properties": {
"details": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "spo-deleteSite.schema.json",
"title": "SPO Delete Site",
"description": "Details required for an operation to delete an SPO site",
"propertyNames": {
"enum": [
"siteId"
]
},
"required": [
"siteId"
],
"properties": {
"siteId": {
"description": "The unique identifier (GUID) for a site",
"type": "string",
"pattern": "^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$"
}
}
}
},
"required": [
"requestType",
"details"
]
}
}
]
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment