forked from MapComplete/MapComplete
Studio: add more metainformation to layerConfig.json
This commit is contained in:
parent
069767b9c7
commit
223acee29c
17 changed files with 7110 additions and 927 deletions
|
@ -204,7 +204,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!",
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!\n\nquestion: What is the word to describe this object?\ninline: Add {value} here",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Record<string,string>"
|
||||
|
@ -215,7 +215,7 @@
|
|||
]
|
||||
},
|
||||
"tags": {
|
||||
"description": "The tags to add. It determines the icon too",
|
||||
"description": "The tags to add. It determines the icon too.\nUse <code>key=value</code>\n\nquestion: What tag should be added to the new object?\ntype: simpletag",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
|
|
@ -204,7 +204,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!",
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!\n\nquestion: What is the word to describe this object?\ninline: Add {value} here",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Record<string,string>"
|
||||
|
@ -215,7 +215,7 @@ export default {
|
|||
]
|
||||
},
|
||||
"tags": {
|
||||
"description": "The tags to add. It determines the icon too",
|
||||
"description": "The tags to add. It determines the icon too.\nUse <code>key=value</code>\n\nquestion: What tag should be added to the new object?\ntype: simpletag",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
|
|
@ -1915,7 +1915,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!",
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!\n\nquestion: What is the word to describe this object?\ninline: Add {value} here",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Record<string,string>"
|
||||
|
@ -1926,7 +1926,7 @@
|
|||
]
|
||||
},
|
||||
"tags": {
|
||||
"description": "The tags to add. It determines the icon too",
|
||||
"description": "The tags to add. It determines the icon too.\nUse <code>key=value</code>\n\nquestion: What tag should be added to the new object?\ntype: simpletag",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
@ -2361,7 +2361,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!",
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!\n\nquestion: What is the word to describe this object?\ninline: Add {value} here",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Record<string,string>"
|
||||
|
@ -2372,7 +2372,7 @@
|
|||
]
|
||||
},
|
||||
"tags": {
|
||||
"description": "The tags to add. It determines the icon too",
|
||||
"description": "The tags to add. It determines the icon too.\nUse <code>key=value</code>\n\nquestion: What tag should be added to the new object?\ntype: simpletag",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
|
|
@ -1894,7 +1894,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!",
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!\n\nquestion: What is the word to describe this object?\ninline: Add {value} here",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Record<string,string>"
|
||||
|
@ -1905,7 +1905,7 @@ export default {
|
|||
]
|
||||
},
|
||||
"tags": {
|
||||
"description": "The tags to add. It determines the icon too",
|
||||
"description": "The tags to add. It determines the icon too.\nUse <code>key=value</code>\n\nquestion: What tag should be added to the new object?\ntype: simpletag",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
@ -2339,7 +2339,7 @@ export default {
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!",
|
||||
"description": "The title - shown on the 'add-new'-button.\n\nThis should include the article of the noun, e.g. 'a hydrant', 'a bicycle pump'.\nThis text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.\n\nDo _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!\n\nquestion: What is the word to describe this object?\ninline: Add {value} here",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Record<string,string>"
|
||||
|
@ -2350,7 +2350,7 @@ export default {
|
|||
]
|
||||
},
|
||||
"tags": {
|
||||
"description": "The tags to add. It determines the icon too",
|
||||
"description": "The tags to add. It determines the icon too.\nUse <code>key=value</code>\n\nquestion: What tag should be added to the new object?\ntype: simpletag",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
|
|
|
@ -248,10 +248,17 @@ export interface LayerConfigJson {
|
|||
* This text will be inserted into `Add {category} here`, becoming `Add a hydrant here`.
|
||||
*
|
||||
* Do _not_ indicate 'new': 'add a new shop here' is incorrect, as the shop might have existed forever, it could just be unmapped!
|
||||
*
|
||||
* question: What is the word to describe this object?
|
||||
* inline: Add {value} here
|
||||
*/
|
||||
title: string | Record<string, string>
|
||||
/**
|
||||
* The tags to add. It determines the icon too
|
||||
* The tags to add. It determines the icon too.
|
||||
* Use <code>key=value</code>
|
||||
*
|
||||
* question: What tag should be added to the new object?
|
||||
* type: simpletag
|
||||
*/
|
||||
tags: string[]
|
||||
/**
|
||||
|
|
|
@ -9,12 +9,11 @@
|
|||
import {Utils} from "../../Utils";
|
||||
|
||||
|
||||
let state = new EditLayerState()
|
||||
let layer = state.layer
|
||||
|
||||
const layerSchema: ConfigMeta[] = layerSchemaRaw
|
||||
let state = new EditLayerState(layerSchema)
|
||||
const regions = Utils.Dedup(layerSchema.map(meta => meta.hints.group))
|
||||
.filter(region => region !== undefined)
|
||||
.filter(region => region === "basic")
|
||||
|
||||
const perRegion: Record<string, ConfigMeta[]> = {}
|
||||
for (const region of regions) {
|
||||
|
@ -23,7 +22,7 @@
|
|||
console.log({perRegion})
|
||||
</script>
|
||||
|
||||
<h3>Edit layer {$layer?.id}</h3>
|
||||
<h3>Edit layer</h3>
|
||||
|
||||
<TabbedGroup tab={new UIEventSource(0)}>
|
||||
<div slot="title0">General properties</div>
|
||||
|
|
|
@ -1,8 +1,19 @@
|
|||
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
||||
import { ConfigMeta } from "./configMeta"
|
||||
|
||||
export default class EditLayerState {
|
||||
public readonly osmConnection: OsmConnection
|
||||
constructor() {
|
||||
public readonly schema: ConfigMeta[]
|
||||
|
||||
constructor(schema: ConfigMeta[]) {
|
||||
this.schema = schema
|
||||
this.osmConnection = new OsmConnection({})
|
||||
}
|
||||
|
||||
public getSchemaStartingWith(path: string[]) {
|
||||
return this.schema.filter(
|
||||
(sch) =>
|
||||
!path.some((part, i) => !(sch.path.length > path.length && sch.path[i] === part))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
* A 'region' is a collection of properties that can be edited which are somewhat related.
|
||||
* They will typically be a subset of some properties
|
||||
*/
|
||||
import SchemaBasedField from "./SchemaBasedField.svelte";
|
||||
import type {ConfigMeta} from "./configMeta";
|
||||
import EditLayerState from "./EditLayerState";
|
||||
import SchemaBasedInput from "./SchemaBasedInput.svelte";
|
||||
|
||||
export let state : EditLayerState
|
||||
export let state: EditLayerState
|
||||
export let configs: ConfigMeta[]
|
||||
export let title: string
|
||||
|
||||
|
@ -16,6 +16,6 @@ export let title: string
|
|||
<div class="pl-2 border border-black flex flex-col gap-y-1">
|
||||
|
||||
{#each configs as config}
|
||||
<SchemaBasedField {state} schema={config} title={config.path.at(-1)}></SchemaBasedField>
|
||||
<SchemaBasedInput {state} path={config.path} schema={config}/>
|
||||
{/each}
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,49 @@
|
|||
<script lang="ts">
|
||||
export let title
|
||||
export let description
|
||||
|
||||
import EditLayerState from "./EditLayerState";
|
||||
import type {ConfigMeta} from "./configMeta";
|
||||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import SchemaBasedInput from "./SchemaBasedInput.svelte";
|
||||
|
||||
export let state: EditLayerState
|
||||
export let schema: ConfigMeta
|
||||
export let path: (string | number)[] = []
|
||||
|
||||
const subparts = state.getSchemaStartingWith(schema.path)
|
||||
console.log("Got array:", {schema, subparts})
|
||||
|
||||
let createdItems = 0
|
||||
/**
|
||||
* Keeps track of the items.
|
||||
* We keep a single string (stringified 'createdItems') to make sure the order is corrects
|
||||
*/
|
||||
export let values: UIEventSource<string[]> = new UIEventSource<string[]>([])
|
||||
|
||||
function createItem() {
|
||||
values.data.push("" + createdItems)
|
||||
createdItems++
|
||||
values.ping()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="pl-2">
|
||||
<h3>{schema.path.at(-1)}</h3>
|
||||
|
||||
<span class="subtle">
|
||||
{schema.description}
|
||||
</span>
|
||||
|
||||
{#if $values.length === 0}
|
||||
No values are defined
|
||||
{:else}
|
||||
{#each $values as value (value)}
|
||||
<div class="border border-black">
|
||||
{#each subparts as subpart}
|
||||
<SchemaBasedInput {state} path = {[...path, value, ...subpart.path]} schema={subpart}/>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
<button on:click={createItem}>Add an entry</button>
|
||||
</div>
|
||||
|
|
|
@ -12,20 +12,20 @@
|
|||
|
||||
|
||||
export let state: EditLayerState
|
||||
export let path: (string | number)[] = []
|
||||
export let schema: ConfigMeta
|
||||
export let title: string | undefined
|
||||
|
||||
let value = new UIEventSource<string>(undefined)
|
||||
let feedback = new UIEventSource<Translation>(undefined)
|
||||
|
||||
const configJson: QuestionableTagRenderingConfigJson = {
|
||||
id: schema.path.join("."),
|
||||
render: schema.path.at(-1) + ": <b>{value}</b>",
|
||||
id: schema.path.join("_"),
|
||||
render: schema.hints.inline ?? schema.path.at(-1) + ": <b>{value}</b>",
|
||||
question: schema.hints.question,
|
||||
questionHint: schema.description,
|
||||
freeform: {
|
||||
key: "value",
|
||||
type: schema.hints.typehint ?? "string"
|
||||
type: schema.hints.typehint ?? "string",
|
||||
inline: schema.hints.inline !== undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
|
18
UI/Studio/SchemaBasedInput.svelte
Normal file
18
UI/Studio/SchemaBasedInput.svelte
Normal file
|
@ -0,0 +1,18 @@
|
|||
<script lang="ts">
|
||||
import type {ConfigMeta} from "./configMeta";
|
||||
import SchemaBasedField from "./SchemaBasedField.svelte";
|
||||
import EditLayerState from "./EditLayerState";
|
||||
import SchemaBasedArray from "./SchemaBasedArray.svelte";
|
||||
|
||||
export let schema: ConfigMeta
|
||||
export let state: EditLayerState
|
||||
export let path : (string | number)[] = []
|
||||
|
||||
</script>
|
||||
|
||||
<span class="subtle">{path.join(".")}</span>
|
||||
{#if schema.type === "array"}
|
||||
<SchemaBasedArray {path} {state} {schema}/>
|
||||
{:else}
|
||||
<SchemaBasedField {path} {state} {schema}/>
|
||||
{/if}
|
|
@ -8,6 +8,7 @@ export interface ConfigMeta {
|
|||
typehint?: string
|
||||
question?: string
|
||||
ifunset?: string
|
||||
inline?: string
|
||||
}
|
||||
required: boolean
|
||||
description: string
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,7 @@
|
|||
[
|
||||
{
|
||||
"path": [],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "A QuestionableTagRenderingConfigJson is a single piece of code which converts one ore more tags into a HTML-snippet.\nIf the desired tags are missing and a question is defined, a question will be shown instead."
|
||||
|
@ -9,6 +10,7 @@
|
|||
"path": [
|
||||
"question"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -24,6 +26,7 @@
|
|||
"path": [
|
||||
"questionHint"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -39,6 +42,7 @@
|
|||
"path": [
|
||||
"freeform"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Allow freeform text input from the user"
|
||||
|
@ -48,6 +52,7 @@
|
|||
"freeform",
|
||||
"type"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "string",
|
||||
"description": "The type of the text-field, e.g. 'string', 'nat', 'float', 'date',...\nSee Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values"
|
||||
|
@ -57,6 +62,7 @@
|
|||
"freeform",
|
||||
"placeholder"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"description": "A (translated) text that is shown (as gray text) within the textfield"
|
||||
},
|
||||
|
@ -65,6 +71,7 @@
|
|||
"freeform",
|
||||
"helperArgs"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "array",
|
||||
"description": "Extra parameters to initialize the input helper arguments.\nFor semantics, see the 'SpecialInputElements.md'"
|
||||
|
@ -74,6 +81,7 @@
|
|||
"freeform",
|
||||
"addExtraTags"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "array",
|
||||
"description": "If a value is added with the textfield, these extra tag is addded.\nUseful to add a 'fixme=freeform textfield used - to be checked'"
|
||||
|
@ -83,6 +91,7 @@
|
|||
"freeform",
|
||||
"inline"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "boolean",
|
||||
"description": "When set, influences the way a question is asked.\nInstead of showing a full-width text field, the text field will be shown within the rendering of the question.\n\nThis combines badly with special input elements, as it'll distort the layout.\nNote that this will be set automatically if no special elements are present."
|
||||
|
@ -92,6 +101,7 @@
|
|||
"freeform",
|
||||
"default"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "string",
|
||||
"description": "default value to enter if no previous tagging is present.\nNormally undefined (aka do not enter anything)"
|
||||
|
@ -100,6 +110,7 @@
|
|||
"path": [
|
||||
"multiAnswer"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "boolean",
|
||||
"description": "If true, use checkboxes instead of radio buttons when asking the question"
|
||||
|
@ -108,6 +119,7 @@
|
|||
"path": [
|
||||
"mappings"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "array",
|
||||
"description": "Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes"
|
||||
|
@ -117,6 +129,7 @@
|
|||
"mappings",
|
||||
"if"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -148,6 +161,7 @@
|
|||
"mappings",
|
||||
"if"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -157,6 +171,7 @@
|
|||
"mappings",
|
||||
"if"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -166,6 +181,7 @@
|
|||
"mappings",
|
||||
"then"
|
||||
],
|
||||
"required": true,
|
||||
"hints": {
|
||||
"typehint": "rendered"
|
||||
},
|
||||
|
@ -184,6 +200,7 @@
|
|||
"mappings",
|
||||
"icon"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {
|
||||
"typehint": "icon"
|
||||
},
|
||||
|
@ -216,6 +233,7 @@
|
|||
"icon",
|
||||
"path"
|
||||
],
|
||||
"required": true,
|
||||
"hints": {
|
||||
"typehint": "icon"
|
||||
},
|
||||
|
@ -228,6 +246,7 @@
|
|||
"icon",
|
||||
"class"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "string",
|
||||
"description": "Size of the image"
|
||||
|
@ -237,6 +256,7 @@
|
|||
"mappings",
|
||||
"hideInAnswer"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -261,6 +281,7 @@
|
|||
"mappings",
|
||||
"hideInAnswer"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -271,6 +292,7 @@
|
|||
"hideInAnswer",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -303,6 +325,7 @@
|
|||
"hideInAnswer",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -312,6 +335,7 @@
|
|||
"mappings",
|
||||
"hideInAnswer"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -322,6 +346,7 @@
|
|||
"hideInAnswer",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -354,6 +379,7 @@
|
|||
"hideInAnswer",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -364,6 +390,7 @@
|
|||
"hideInAnswer",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -373,6 +400,7 @@
|
|||
"mappings",
|
||||
"ifnot"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -394,6 +422,7 @@
|
|||
"mappings",
|
||||
"ifnot"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -404,6 +433,7 @@
|
|||
"ifnot",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -436,6 +466,7 @@
|
|||
"ifnot",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -445,6 +476,7 @@
|
|||
"mappings",
|
||||
"ifnot"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -455,6 +487,7 @@
|
|||
"ifnot",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -487,6 +520,7 @@
|
|||
"ifnot",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -497,6 +531,7 @@
|
|||
"ifnot",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -506,6 +541,7 @@
|
|||
"mappings",
|
||||
"addExtraTags"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "array",
|
||||
"description": "If chosen as answer, these tags will be applied as well onto the object.\nNot compatible with multiAnswer.\n\nThis can be used e.g. to erase other keys which indicate the 'not' value:\n```json\n{\n \"if\": \"crossing:marking=rainbow\",\n \"then\": \"This is a rainbow crossing\",\n \"addExtraTags\": \"not:crossing:marking=\"\n}\n```"
|
||||
|
@ -515,6 +551,7 @@
|
|||
"mappings",
|
||||
"priorityIf"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -536,6 +573,7 @@
|
|||
"mappings",
|
||||
"priorityIf"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -546,6 +584,7 @@
|
|||
"priorityIf",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -578,6 +617,7 @@
|
|||
"priorityIf",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -587,6 +627,7 @@
|
|||
"mappings",
|
||||
"priorityIf"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -597,6 +638,7 @@
|
|||
"priorityIf",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -629,6 +671,7 @@
|
|||
"priorityIf",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -639,6 +682,7 @@
|
|||
"priorityIf",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -648,6 +692,7 @@
|
|||
"mappings",
|
||||
"#"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "string",
|
||||
"description": "Used for comments or to disable a validation\n\nignore-image-in-then: normally, a `then`-clause is not allowed to have an `img`-html-element as icons are preferred. In some cases (most notably title-icons), this is allowed"
|
||||
|
@ -656,6 +701,7 @@
|
|||
"path": [
|
||||
"id"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "string",
|
||||
"description": "The id of the tagrendering, should be an unique string.\nUsed to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.\n\nUse 'questions' to trigger the question box of this group (if a group is defined)"
|
||||
|
@ -664,6 +710,7 @@
|
|||
"path": [
|
||||
"labels"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "array",
|
||||
"description": "A list of labels. These are strings that are used for various purposes, e.g. to filter them away"
|
||||
|
@ -672,6 +719,7 @@
|
|||
"path": [
|
||||
"classes"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -690,6 +738,7 @@
|
|||
"path": [
|
||||
"description"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -705,6 +754,7 @@
|
|||
"path": [
|
||||
"render"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {
|
||||
"typehint": "rendered"
|
||||
},
|
||||
|
@ -748,6 +798,7 @@
|
|||
"path": [
|
||||
"condition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -768,6 +819,7 @@
|
|||
"path": [
|
||||
"condition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -777,6 +829,7 @@
|
|||
"condition",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -808,6 +861,7 @@
|
|||
"condition",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -816,6 +870,7 @@
|
|||
"path": [
|
||||
"condition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -825,6 +880,7 @@
|
|||
"condition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -856,6 +912,7 @@
|
|||
"condition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -865,6 +922,7 @@
|
|||
"condition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -873,6 +931,7 @@
|
|||
"path": [
|
||||
"metacondition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -893,6 +952,7 @@
|
|||
"path": [
|
||||
"metacondition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -902,6 +962,7 @@
|
|||
"metacondition",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -933,6 +994,7 @@
|
|||
"metacondition",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -941,6 +1003,7 @@
|
|||
"path": [
|
||||
"metacondition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -950,6 +1013,7 @@
|
|||
"metacondition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -981,6 +1045,7 @@
|
|||
"metacondition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -990,6 +1055,7 @@
|
|||
"metacondition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[
|
||||
{
|
||||
"path": [],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "A TagRenderingConfigJson is a single piece of code which converts one ore more tags into a HTML-snippet.\nFor an _editable_ tagRendering, use 'QuestionableTagRenderingConfigJson' instead, which extends this one"
|
||||
|
@ -9,6 +10,7 @@
|
|||
"path": [
|
||||
"id"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "string",
|
||||
"description": "The id of the tagrendering, should be an unique string.\nUsed to keep the translations in sync. Only used in the tagRenderings-array of a layerConfig, not requered otherwise.\n\nUse 'questions' to trigger the question box of this group (if a group is defined)"
|
||||
|
@ -17,6 +19,7 @@
|
|||
"path": [
|
||||
"labels"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "array",
|
||||
"description": "A list of labels. These are strings that are used for various purposes, e.g. to filter them away"
|
||||
|
@ -25,6 +28,7 @@
|
|||
"path": [
|
||||
"classes"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -43,6 +47,7 @@
|
|||
"path": [
|
||||
"description"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -58,6 +63,7 @@
|
|||
"path": [
|
||||
"render"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {
|
||||
"typehint": "rendered"
|
||||
},
|
||||
|
@ -101,6 +107,7 @@
|
|||
"path": [
|
||||
"condition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -121,6 +128,7 @@
|
|||
"path": [
|
||||
"condition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -130,6 +138,7 @@
|
|||
"condition",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -161,6 +170,7 @@
|
|||
"condition",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -169,6 +179,7 @@
|
|||
"path": [
|
||||
"condition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -178,6 +189,7 @@
|
|||
"condition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -209,6 +221,7 @@
|
|||
"condition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -218,6 +231,7 @@
|
|||
"condition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -226,6 +240,7 @@
|
|||
"path": [
|
||||
"metacondition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -246,6 +261,7 @@
|
|||
"path": [
|
||||
"metacondition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -255,6 +271,7 @@
|
|||
"metacondition",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -286,6 +303,7 @@
|
|||
"metacondition",
|
||||
"and"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -294,6 +312,7 @@
|
|||
"path": [
|
||||
"metacondition"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -303,6 +322,7 @@
|
|||
"metacondition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -334,6 +354,7 @@
|
|||
"metacondition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -343,6 +364,7 @@
|
|||
"metacondition",
|
||||
"or"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -351,6 +373,7 @@
|
|||
"path": [
|
||||
"freeform"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Allow freeform text input from the user"
|
||||
|
@ -360,6 +383,7 @@
|
|||
"freeform",
|
||||
"key"
|
||||
],
|
||||
"required": true,
|
||||
"hints": {},
|
||||
"type": "string",
|
||||
"description": "If this key is present, then 'render' is used to display the value.\nIf this is undefined, the rendering is _always_ shown"
|
||||
|
@ -368,6 +392,7 @@
|
|||
"path": [
|
||||
"mappings"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "array",
|
||||
"description": "Allows fixed-tag inputs, shown either as radiobuttons or as checkboxes"
|
||||
|
@ -377,6 +402,7 @@
|
|||
"mappings",
|
||||
"if"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": [
|
||||
{
|
||||
|
@ -408,6 +434,7 @@
|
|||
"mappings",
|
||||
"if"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, a single of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -417,6 +444,7 @@
|
|||
"mappings",
|
||||
"if"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "object",
|
||||
"description": "Chain many tags, to match, all of these should be true\nSee https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Tags_format.md for documentation"
|
||||
|
@ -426,6 +454,7 @@
|
|||
"mappings",
|
||||
"then"
|
||||
],
|
||||
"required": true,
|
||||
"hints": {
|
||||
"typehint": "rendered"
|
||||
},
|
||||
|
@ -444,6 +473,7 @@
|
|||
"mappings",
|
||||
"icon"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {
|
||||
"typehint": "icon"
|
||||
},
|
||||
|
@ -476,6 +506,7 @@
|
|||
"icon",
|
||||
"path"
|
||||
],
|
||||
"required": true,
|
||||
"hints": {
|
||||
"typehint": "icon"
|
||||
},
|
||||
|
@ -488,6 +519,7 @@
|
|||
"icon",
|
||||
"class"
|
||||
],
|
||||
"required": false,
|
||||
"hints": {},
|
||||
"type": "string",
|
||||
"description": "A hint to mapcomplete on how to render this icon within the mapping.\nThis is translated to 'mapping-icon-<classtype>', so defining your own in combination with a custom CSS is possible (but discouraged)"
|
||||
|
|
|
@ -7,9 +7,10 @@ function WalkScheme<T>(
|
|||
scheme: JsonSchema,
|
||||
fullScheme: JsonSchema & { definitions?: any } = undefined,
|
||||
path: string[] = [],
|
||||
isHandlingReference = []
|
||||
): { path: string[]; t: T }[] {
|
||||
const results: { path: string[]; t: T }[] = []
|
||||
isHandlingReference = [],
|
||||
required?: string[]
|
||||
): { path: string[]; required: boolean; t: T }[] {
|
||||
const results: { path: string[]; required: boolean; t: T }[] = []
|
||||
if (scheme === undefined) {
|
||||
return []
|
||||
}
|
||||
|
@ -36,6 +37,7 @@ function WalkScheme<T>(
|
|||
if (t !== undefined) {
|
||||
results.push({
|
||||
path,
|
||||
required: required?.indexOf(path.at(-1)) >= 0,
|
||||
t,
|
||||
})
|
||||
}
|
||||
|
@ -69,7 +71,14 @@ function WalkScheme<T>(
|
|||
for (const key in scheme.properties) {
|
||||
const prop = scheme.properties[key]
|
||||
results.push(
|
||||
...WalkScheme(onEach, prop, fullScheme, [...path, key], isHandlingReference)
|
||||
...WalkScheme(
|
||||
onEach,
|
||||
prop,
|
||||
fullScheme,
|
||||
[...path, key],
|
||||
isHandlingReference,
|
||||
scheme.required
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -113,14 +122,18 @@ function extractMeta(typename: string, path: string) {
|
|||
readFileSync("./Docs/Schemas/" + typename + ".schema.json", { encoding: "utf8" })
|
||||
)
|
||||
|
||||
const metakeys = ["type", "group", "question", "ifunset"]
|
||||
const metainfo = {
|
||||
type: "One of the inputValidator types",
|
||||
group: "A kind of label. Items with the same group name will be placed in the same region",
|
||||
question: "The question to ask in the tagRenderingConfig",
|
||||
ifunset:
|
||||
"Only applicable if _not_ a required item. This will appear in the 'not set'-option as extra description",
|
||||
inline: "A text, containing `{value}`. This will be used as freeform rendering and will be included into the rendering",
|
||||
}
|
||||
const metakeys = Array.from(Object.keys(metainfo))
|
||||
|
||||
const hints = addMetafields(metakeys, themeSchema)
|
||||
const paths = hints.map(({ path, t }) => ({ path, ...t }))
|
||||
|
||||
themeSchema.required?.forEach((req) => {
|
||||
paths.filter((p) => p.path.at(-1) === req).forEach((meta) => (meta["required"] = true))
|
||||
})
|
||||
const paths = hints.map(({ path, required, t }) => ({ path, required, ...t }))
|
||||
|
||||
writeFileSync("./assets/" + path + ".json", JSON.stringify(paths, null, " "))
|
||||
console.log("Written meta to ./assets/" + path)
|
||||
|
|
Loading…
Reference in a new issue