Skip to content

Commit

Permalink
feat(json schema): add options schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsJohansen87 committed May 16, 2024
1 parent 8cf04fd commit 5b26467
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
10 changes: 8 additions & 2 deletions packages/lib/src/components/Options.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
if (validJSON.valid === true) {
$lensOptions = options;
} else if (typeof options === "object") {
console.error("Lens-Options: ", validJSON.errors);
console.error(
"Lens-Options are not conform with the JSON schema",
validJSON.errors,
);
}
}
Expand All @@ -51,7 +54,10 @@
if (validJSON.valid === true) {
$catalogue = catalogueData;
} else if (typeof catalogueData === "object") {
console.error("Lens-Options: ", validJSON.errors);
console.error(
"Catalogue is not conform with the JSON schema",
validJSON.errors,
);
}
}
Expand Down
50 changes: 44 additions & 6 deletions packages/lib/src/interfaces/options.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@
"pattern": "^.+$",
"description": "The icon to use for the info button"
},
"addUrl": {
"deleteUrl": {
"type": "string",
"pattern": "^.+$",
"description": "The icon to use for the add button in the catalogue"
"description": "The icon to use for the info button"
},
"toggleUrl": {
"type": "string",
"pattern": "^.+$",
"description": "The icon to use for the toggle button in the catalogue"
"selectAll": {
"type": "object",
"properties": {
"text": {
"type": "string",
"pattern": "^.+$",
"description": "The text to display for the select all button"
}
},
"additionalProperties": false,
"unevaluatedProperties": false,
"required": []
}
},
"additionalProperties": false,
Expand Down Expand Up @@ -61,6 +69,31 @@
"pattern": "^.+$"
}
},
"accumulatedValues": {
"type": "array",
"description": "aggregate values of other data keys to include in the chart",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"pattern": "^.+$",
"description": "The name to be displayed in the chart"
},
"values": {
"type": "array",
"items": {
"type": "string",
"pattern": "^.+$",
"description": "The data key to be aggregated"
}
}
},
"additionalProperties": false,
"unevaluatedProperties": false,
"required": []
}
},
"tooltips": {
"type": "object",
"patternProperties": {
Expand Down Expand Up @@ -133,6 +166,11 @@
"title"
]
}
},
"claimedText": {
"type": "string",
"pattern": "^.+$",
"description": "The text to be displayed when query is being executed"
}
},
"additionalProperties": false,
Expand Down

0 comments on commit 5b26467

Please sign in to comment.