-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
Issue type:
- 🐛 Bug
Description:
I am getting an error saying:
ErrorResourcesContext: Parameter value "@css:templates/main.html.ejs" is not of required range type "http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON"
From this config:
{
"@type": "EjsTemplateEngine",
"EjsTemplateEngine:_template": "@css:templates/main.html.ejs"
}
Because the template arg of EjsTemplateEngine is supposed to be able to accept a string or a json object.
export class EjsTemplateEngine<T extends Dict<any> = Dict<any>> implements TemplateEngine<T> {
/**
* @param template - The default template @range {json}
*/
public constructor(template?: Template) {
}
}Using a json field in this way errors because the string cannot be parsed by JSON.parse() here:
Components.js/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.ts
Lines 144 to 148 in 4c14d40
| case IRIS_RDF.JSON: | |
| try { | |
| parsed = JSON.parse(value.value); | |
| (<any>value.term).valueRaw = parsed; | |
| } catch (error: unknown) { |
JSON fields should accept strings because strings are valid JSON.
Environment:
components.js v4.5.0
nodejs v16.14.0