Customizations/AllKnownLayers.ts

This commit is contained in:
Pieter Vander Vennet 2021-03-10 20:18:05 +01:00
parent 5b39ba9a32
commit 8c5d4ed78f
3 changed files with 31 additions and 105 deletions

View file

@ -66,9 +66,18 @@ export default class TagRenderingConfig {
addExtraTags: json.freeform.addExtraTags?.map((tg, i) =>
FromJSON.Tag(tg, `${context}.extratag[${i}]`)) ?? []
}
if(this.freeform.key === undefined || this.freeform.key === ""){
throw `Freeform.key is undefined or the empty string - this is not allowed; either fill out something or remove the freeform block alltogether. Error in ${context}`
}
if (ValidatedTextField.AllTypes[this.freeform.type] === undefined) {
throw `Freeform.key ${this.freeform.key} is an invalid type`
}
if(this.freeform.addExtraTags){
const usedKeys = new And(this.freeform.addExtraTags).usedKeys();
if(usedKeys.indexOf(this.freeform.key)){
throw `The freeform key ${this.freeform.key} will be overwritten by one of the extra tags, as they use the same key too. This is in ${context}`;
}
}
}
this.multiAnswer = json.multiAnswer ?? false