Skip to content

Commit

Permalink
Flesh out helper dev tools for validating manifest files
Browse files Browse the repository at this point in the history
  • Loading branch information
duttonw committed Sep 12, 2024
1 parent 27a4b2a commit aff052f
Show file tree
Hide file tree
Showing 12 changed files with 3,930 additions and 343 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"build:local": "node esbuild.js --local",
"watch": "node esbuild.js --dev --watch",
"release": "node esbuild.js",
"dxp:auth": "node ./node_modules/@squiz/dxp-cli-next/bin/dxp.js auth login",
"dxp:auth:logout": "node ./node_modules/@squiz/dxp-cli-next/bin/dxp.js auth logout",
"dxp:deploy:dev": "node run build && node ./node_modules/@squiz/dxp-cli-next/bin/dxp.js cmp deploy ./dist",
"dxp:deploy:prod": "node run release && node ./node_modules/@squiz/dxp-cli-next/bin/dxp.js cmp deploy ./dist",
"test": "echo 'no unit tests built yet'",
"serve:squiz-dev-ui": "node ./node_modules/@squiz/dxp-cli-next/bin/dxp.js cmp dev-ui ./dist",
"serve": "npm run build:local && npm run serve:squiz-dev-ui",
Expand Down
155 changes: 155 additions & 0 deletions spec/Draft-07.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://json-schema.org/draft-07/schema#",
"title": "Core schema meta-schema",
"definitions": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#" }
},
"nonNegativeInteger": {
"type": "integer",
"minimum": 0
},
"nonNegativeIntegerDefault0": {
"allOf": [{ "$ref": "#/definitions/nonNegativeInteger" }, { "default": 0 }]
},
"simpleTypes": {
"enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
},
"stringArray": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true,
"default": []
}
},
"type": ["object", "boolean"],
"properties": {
"$id": {
"type": "string",
"format": "uri-reference"
},
"$schema": {
"type": "string",
"format": "uri"
},
"$ref": {
"type": "string",
"format": "uri-reference"
},
"$comment": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"default": true,
"readOnly": {
"type": "boolean",
"default": false
},
"writeOnly": {
"type": "boolean",
"default": false
},
"examples": {
"type": "array",
"items": true
},
"multipleOf": {
"type": "number",
"exclusiveMinimum": 0
},
"maximum": {
"type": "number"
},
"exclusiveMaximum": {
"type": "number"
},
"minimum": {
"type": "number"
},
"exclusiveMinimum": {
"type": "number"
},
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"pattern": {
"type": "string",
"format": "regex"
},
"additionalItems": { "$ref": "#" },
"items": {
"anyOf": [{ "$ref": "#" }, { "$ref": "#/definitions/schemaArray" }],
"default": true
},
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"uniqueItems": {
"type": "boolean",
"default": false
},
"contains": { "$ref": "#" },
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
"additionalProperties": { "$ref": "#" },
"definitions": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"properties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"propertyNames": { "format": "regex" },
"default": {}
},
"dependencies": {
"type": "object",
"additionalProperties": {
"anyOf": [{ "$ref": "#" }, { "$ref": "#/definitions/stringArray" }]
}
},
"propertyNames": { "$ref": "#" },
"const": true,
"enum": {
"type": "array",
"items": true,
"minItems": 1,
"uniqueItems": true
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
]
},
"format": { "type": "string" },
"contentMediaType": { "type": "string" },
"contentEncoding": { "type": "string" },
"if": { "$ref": "#" },
"then": { "$ref": "#" },
"else": { "$ref": "#" },
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" }
},
"default": true
}
43 changes: 8 additions & 35 deletions spec/DxComponentIcons.json
Original file line number Diff line number Diff line change
Expand Up @@ -2255,52 +2255,25 @@
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"const": "hex"
},
"value": {
"type": "string",
"pattern": "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
}
"type": { "const": "hex" },
"value": { "type": "string", "pattern": "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$" }
},
"required": [
"type",
"value"
]
"required": ["type", "value"]
},
{
"title": "ColorEnum",
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"const": "enum"
},
"type": { "const": "enum" },
"value": {
"enum": [
"gray",
"blue",
"green",
"orange",
"red",
"purple",
"teal",
"yellow",
"pink"
]
"enum": ["gray", "blue", "green", "orange", "red", "purple", "teal", "yellow", "pink"]
}
},
"required": [
"type",
"value"
]
"required": ["type", "value"]
}
]
}
},
"required": [
"id",
"color"
],
"id": "/DxComponentIcons.json"
}
"required": ["id", "color"]
}
5 changes: 2 additions & 3 deletions spec/DxComponentInputSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@
}
}
}
],
"id": "/DxComponentInputSchema.json"
}
]
}
Loading

0 comments on commit aff052f

Please sign in to comment.