Move NSI-code in separate file

This commit is contained in:
Pieter Vander Vennet 2024-05-13 17:21:40 +02:00
parent 037887fea0
commit 07edee550c
4 changed files with 428 additions and 71 deletions

View file

@ -26,6 +26,7 @@ import { Translatable } from "../Json/Translatable"
import { ConversionContext } from "./ConversionContext"
import { AvailableRasterLayers } from "../../RasterLayers"
import PointRenderingConfigJson from "../Json/PointRenderingConfigJson"
import NameSuggestionIndex from "../../../Logic/Web/NameSuggestionIndex"
class ValidateLanguageCompleteness extends DesugaringStep<LayoutConfig> {
private readonly _languages: string[]
@ -1032,6 +1033,14 @@ class MiscTagRenderingChecks extends DesugaringStep<TagRenderingConfigJson> {
)
}
}
if(json.freeform.type === "nsi"){
const [key, value] = json.freeform.helperArgs[0].split("=")
const path = `${json.freeform.key}s/${key}/${value}`
const suggestions = NameSuggestionIndex.getSuggestionsFor(path)
if(suggestions === undefined){
context.enters("freeform","type").err("No entry found in the 'Name Suggestion Index' for "+path)
}
}
}
if (json.render && json["question"] && json.freeform === undefined) {
context.err(