UNPKG

webtask-json-validator

Version:

Validator for an Auth0 Extension package.json.

322 lines (321 loc) 8.56 kB
{ "title": "Auth0 Extension Package Schema - Draft 7", "definitions": { "non-empty-string": { "type": "string", "minLength": 1, "errorMessage": { "minLength": "Should not be empty." } }, "non-empty-url": { "type": "string", "minLength": 1, "format": "uri", "errorMessage": { "minLength": "Should not be empty.", "format": "Should be proper URL." } }, "cron-type-requires-schedule": { "if": { "properties": { "type": {"enum": ["cron"]} } }, "then": { "required": ["schedule"], "errorMessage": "If type is 'cron', the property 'schedule' should exist" }, "else": { "not": { "required": ["schedule"] }, "errorMessage": "If type is 'application', the property 'schedule' shouldn't exist" } }, "secret-type-select": { "if": { "properties": { "type": {"enum": ["text", "password", "file", null]} } }, "then": { "not": { "anyOf": [ { "required": ["options"] }, { "required": ["allowMultiple"] } ] }, "errorMessage": "If type is not 'select', the property 'options' shouldn't exist" }, "else": { "required": ["options"], "errorMessage": "If type is 'select', the property 'options' should exist" } }, "array-of-strings": { "type": "array", "items": { "$ref": "#/definitions/non-empty-string" } } }, "properties": { "version": { "type": "string", "minLength": 1, "pattern": "^\\d+.\\d+.\\d+$", "errorMessage": { "minLength": "Should not be empty.", "pattern": "Incorrect version format." }, "description": "Version of the extension." }, "name": { "type": "string", "minLength": 1, "pattern": "^\\S*$", "errorMessage": { "minLength": "Should not be empty.", "pattern": "Should not contain whitespaces." }, "description": "Name of the extension" }, "author": { "$ref": "#/definitions/non-empty-string" }, "description": { "$ref": "#/definitions/non-empty-string" }, "repository": { "type": [ "object", "string" ], "properties": { "type": { "$ref": "#/definitions/non-empty-string" }, "url": { "type": "string", "format": "uri", "errorMessage": { "format": "Should be proper URL." } } } }, "engines": { "type": "object", "properties": { "node": { "type": "string" } } }, "main": { "$ref": "#/definitions/non-empty-string" }, "license": { "$ref": "#/definitions/non-empty-string" }, "keywords": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/non-empty-string" } }, "scripts": { "type": "object", "properties": { "build": { "type": "string", "description": "Extension's build script" } }, "required": [ "build" ] }, "auth0-extension": { "type": "object", "properties": { "title": { "$ref": "#/definitions/non-empty-string" }, "category": { "$ref": "#/definitions/non-empty-string" }, "type": { "enum": [ "cron", "application" ] }, "useHashName": { "type": "boolean" }, "nodeTarget": { "$ref": "#/definitions/non-empty-string" }, "bundleModules": { "type": "boolean" }, "settings": { "type": "object", "additionalProperties": true }, "codeUrl": { "$ref": "#/definitions/non-empty-url" }, "docsUrl": { "$ref": "#/definitions/non-empty-url" }, "logoUrl": { "$ref": "#/definitions/non-empty-url" }, "initialUrlPath": { "$ref": "#/definitions/non-empty-string" }, "uninstallConfirmMessage": { "$ref": "#/definitions/non-empty-string" }, "updateConfirmMessage": { "$ref": "#/definitions/non-empty-string" }, "schedule": { "type": "string", "pattern": "^(\\*|([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])|\\*\\/([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])) (\\*|([0-9]|1[0-9]|2[0-3])|\\*\\/([0-9]|1[0-9]|2[0-3])) (\\*|([1-9]|1[0-9]|2[0-9]|3[0-1])|\\*\\/([1-9]|1[0-9]|2[0-9]|3[0-1])) (\\*|([1-9]|1[0-2])|\\*\\/([1-9]|1[0-2])) (\\*|([0-6])|\\*\\/([0-6]))$", "errorMessage": { "pattern": "Should be in cron format" } }, "auth0": { "type": "object", "minProperties": 1, "properties": { "scopes": { "$ref": "#/definitions/non-empty-string" }, "createClient": { "type": "boolean" }, "callbackPath": { "$ref": "#/definitions/non-empty-string" }, "onInstallPath": { "$ref": "#/definitions/non-empty-string" }, "onUpdatePath": { "$ref": "#/definitions/non-empty-string" }, "onUninstallPath": { "$ref": "#/definitions/non-empty-string" } }, "additionalProperties": false }, "secrets": { "type": "object", "minProperties": 1, "additionalProperties": { "type": "object", "minProperties": 1, "properties": { "description": { "$ref": "#/definitions/non-empty-string" }, "readOnly": { "type": "boolean" }, "former": { "$ref": "#/definitions/non-empty-string" }, "type": { "enum": [ "text", "password", "select", "file" ], "default": "text" }, "example": { "$ref": "#/definitions/non-empty-string" }, "required": { "type": "boolean" }, "default": { "$ref": "#/definitions/non-empty-string" }, "options": { "type": "array", "minItems": 1, "items": { "type": "object", "properties": { "value": { "$ref": "#/definitions/non-empty-string" }, "text": { "$ref": "#/definitions/non-empty-string" } }, "required": [ "value", "text" ], "additionalProperties": false } }, "allowMultiple": { "type": "boolean" }, "visibleIf": { "type": "object", "minProperties": 1, "maxProperties": 1, "additionalProperties": { "$ref": "#/definitions/non-empty-string" } }, "allowedFileTypes": { "$ref": "#/definitions/non-empty-string" }, "base64Encoded": { "type": "boolean" } }, "allOf":[ {"$ref": "#/definitions/secret-type-select"} ], "additionalProperties": false } }, "externals": { "$ref": "#/definitions/array-of-strings" }, "excluded": { "$ref": "#/definitions/array-of-strings" } }, "allOf":[ {"$ref": "#/definitions/cron-type-requires-schedule"} ], "required": [ "title", "type" ], "additionalProperties": false } }, "required": [ "version", "name", "description", "author", "keywords" ] }