-
I have my glsp code setup for Theia Properties using jsonforms. Currently am trying to put validations into it using ajv. But am not exactly sure how to make that connection between Ajv and the Theia properties schema files in the data service class. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @amiths89, Thanks for reaching out! We have a simple example you can look at, where we use the To easily integrate AJV validation (https://jsonforms.io/docs/validation), you can override the base JsonForms property widget and add the validation directly to the JsonForms instance. I added a new commit on top of the mentioned branch to briefly showcase this. export class CustomPropertyViewWidget extends JsonFormsPropertyViewWidget {
...
protected override renderForms(
properties: object | undefined,
typeSchema: JsonSchema | undefined,
uiSchema: UISchemaElement | undefined
): void {
this.hostRoot.render(
<JsonFormsStyleContext.Provider value={this.getStyleContext()}>
<JsonForms
data={properties}
schema={typeSchema}
uischema={uiSchema}
cells={vanillaCells}
renderers={vanillaRenderers}
onChange={this.jsonFormsOnChange}
ajv={...}
/>
</JsonFormsStyleContext.Provider>
);
}
} I hope this helps you get started with additional validation when using JsonForms for your property view. If you have any additional questions, please don't hesitate to reach out! Best regards, |
Beta Was this translation helpful? Give feedback.
Hi @amiths89,
Thanks for reaching out!
We have a simple example you can look at, where we use the
@eclipse-emfcloud/jsonforms-property-view
within a Theia-based GLSP example.You can find it here: GLSP Property View Example. Please note that it’s not updated to the latest GLSP version, but it showcases different scenarios, but it should still run as expected.
To easily integrate AJV validation (https://jsonforms.io/docs/validation), you can override the base JsonForms property widget and add the validation directly to the JsonForms instance. I added a new commit on top of the mentioned branch to briefly showcase this.
To quickly highlight the main change, here’s an example of how you can …