Home > @polyspec/crudui-generator-core > decodeFormTemplate
decodeFormTemplate() function
Decode the JSON value of a compiled form template, such as a template that a server wrote into a page with JSON.stringify(compileForm(spec)) and a client read back with JSON.parse, into a FormTemplate.
Signature:
export declare function decodeFormTemplate(value: unknown): FormTemplate;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
value |
unknown |
The parsed JSON value; the decoder checks it against contracts/schema/form-template.schema.json. |
Returns:
The value as a form template, unchanged.
Exceptions
FormTemplateError with the JSON Pointer of the first invalid member when the value is no compiled form template.