Super rough work in progress -

Currently trying to see how the JSON schema would look like by writing it hand before attempting to then write a script to help write the same JSON to a file by looping over types
This commit is contained in:
Warren Buckley
2023-03-06 12:50:00 +00:00
parent 062cb5f5a0
commit d0c5945f8f
3 changed files with 96 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Umbraco Package",
"description": "JSON schema for creating an Umbraco pacakge with different manifest types",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the package"
},
"version": {
"type": "string",
"description": "The version of the package"
},
"extensions": {
"type": "array",
"description": "The extensions that are part of the package",
"minItems": 1,
"items": {
"type": "object",
"oneOf": [
{ "$ref": "#/definitions/rootManifest" }
]
}
}
},
"required": [
"name",
"version",
"extensions"
],
"additionalProperties": false,
"definitions": {
"manifesTypes":{
"enum": [
"collectionView",
"dashboardCollection",
"dashboard"
]
},
"rootManifest": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the extension"
},
"alias": {
"type": "string",
"description": "The alias of the extension"
},
"weight": {
"type": "integer",
"description": "The weight of the extension"
},
"type": {
"$ref": "#/definitions/manifesTypes"
},
"js": {
"type": "string",
"description": "The path to the javascript file"
},
"elementName": {
"type": "string",
"description": "The name of the HTML web component element"
},
"meta": {
"type": "object",
"description": "NOTE: This object & properties change depending on the ENUM type of extension"
}
},
"required": [ "name", "alias", "type", "js" ]
}
}
}

View File

@@ -0,0 +1,4 @@
// TODO: Based on the manual schema as a guide
// Automate generation of the schema from looping over
// The types and properties found at /libs/extensions-registry/*.models.ts

View File

@@ -0,0 +1,17 @@
{
"$schema": "manual-schema.json",
"name": "My Package",
"version": "1.0.0",
"extensions": [
{
"name": "My Extension",
"alias": "myextension",
"js": "myextension.js",
"type": "dashboard",
"weight": 10,
"meta": {
}
}
]
}