JsonSchema (in Java) for Perspective component


The need is following :
To create a perspective component with a list of objects as property, where each object generates automatically a uuid.

Exemples : [{“uuid”: “8b57704a-db2f-11ec-9d64-0242ac120002”, “name”:“myObj1”},{“uuid”: “c84800aa-db2f-11ec-9d64-0242ac120002”, “name”:“myObj1”}…]

I am not sure that is possible, at least with a JsonSchema from a json file.

In the example project “ignition-sdk-examples/perspective-component/”, it is indicated that it is possible to create a JsonSchema in pure Java.
I wonder if this allows more freedom.

Does anyone have an example of how this should be done?

This is not what a schema is for, it will not work in the schema.
you can add properties through javascript though.
But why do you need this id, what generates this “list of objects”, why not include the id where the list gets generated?

Ok, thanks for your answer @victordcq.

My goal is to be able to identify the object of the list from the frontend. (js)
Each object is represented in my component. I use an external library in which I instantiate graphic objects.
The goal would be to not have to delete and reinstantiate each object when rendering.
Currently if the user deletes one of the objects from the list then I am not able to know which one to delete graphically.

This looks like something that should be added in with the objects coming from perspective.
You could map it in the front end too i suppose, but that will be a bit more work to keep track of the states

I finally chose to follow your recommendation by adding the uuid from the front end.
Then pushing the modified data into the designer using the store.

this.props.store.props.write("configuration", configuration)

Thank you @victordcq for your help.

1 Like