UNPKG

somod-schema

Version:

Schema to validate yaml files in somod modules

169 lines (168 loc) 4.5 kB
export var somodFunctions = { if: { type: "object", propertyNames: { enum: [ "SOMOD::AjvCompile", "SOMOD::And", "SOMOD::Or", "SOMOD::Equals", "SOMOD::If", "SOMOD::JsonParse", "SOMOD::JsonStringify", "SOMOD::Key", "SOMOD::Parameter" ] } }, then: { oneOf: [ { $ref: "#/definitions/somodAjvCompile" }, { $ref: "#/definitions/somodAnd" }, { $ref: "#/definitions/somodOr" }, { $ref: "#/definitions/somodEquals" }, { $ref: "#/definitions/somodIf" }, { $ref: "#/definitions/somodJsonParse" }, { $ref: "#/definitions/somodJsonStringify" }, { $ref: "#/definitions/somodKey" }, { $ref: "#/definitions/somodParameter" } ] }, else: true }; export var somodAjvCompile = { type: "object", additionalProperties: false, required: ["SOMOD::AjvCompile"], properties: { "SOMOD::AjvCompile": { anyOf: [ { $ref: "http://json-schema.org/draft-07/schema" }, { $ref: "#/definitions/somodFunctions" } ] } } }; export var somodAnd = { type: "object", additionalProperties: false, required: ["SOMOD::And"], properties: { "SOMOD::And": { type: "array", items: { anyOf: [{ type: "boolean" }, { $ref: "#/definitions/somodFunctions" }] }, minItems: 1 } } }; export var somodOr = { type: "object", additionalProperties: false, required: ["SOMOD::Or"], properties: { "SOMOD::Or": { type: "array", items: { anyOf: [{ type: "boolean" }, { $ref: "#/definitions/somodFunctions" }] }, minItems: 1 } } }; export var somodEquals = { type: "object", additionalProperties: false, required: ["SOMOD::Equals"], properties: { "SOMOD::Equals": { type: "array", items: { anyOf: [true, { $ref: "#/definitions/somodFunctions" }] }, minItems: 2, maxItems: 2 } } }; export var somodIf = { type: "object", additionalProperties: false, required: ["SOMOD::If"], properties: { "SOMOD::If": { type: "array", additionalItems: { anyOf: [true, { $ref: "#/definitions/somodFunctions" }] }, items: [ { anyOf: [{ type: "boolean" }, { $ref: "#/definitions/somodFunctions" }] } ], minItems: 2, maxItems: 3 } } }; export var somodJsonParse = { type: "object", additionalProperties: false, required: ["SOMOD::JsonParse"], properties: { "SOMOD::JsonParse": { anyOf: [{ type: "string" }, { $ref: "#/definitions/somodFunctions" }] } } }; export var somodJsonStringify = { type: "object", additionalProperties: false, required: ["SOMOD::JsonStringify"], properties: { "SOMOD::JsonStringify": { anyOf: [true, { $ref: "#/definitions/somodFunctions" }] } } }; export var somodKey = { type: "object", additionalProperties: false, required: ["SOMOD::Key"], properties: { "SOMOD::Key": { type: "array", additionalItems: false, items: [ { anyOf: [ { type: "object" }, { type: "array" }, { $ref: "#/definitions/somodFunctions" } ] }, { anyOf: [ { type: "string" }, { type: "number" }, { $ref: "#/definitions/somodFunctions" } ] } ], minItems: 2, maxItems: 2 } } }; export var somodParameter = { type: "object", additionalProperties: false, required: ["SOMOD::Parameter"], properties: { "SOMOD::Parameter": { type: "string", description: "Must refer the parameter available for this module" } } };