Closed ggparente95 closed 5 months ago
Hello @ggparente95!
I'm not sure if I understand the question correctly, but I'll try to answer.
The definition model is created by using a builder, so the way how you call this builder is not restricted to constant types. For example, you can build the model from some external source.
const Q = [
{ type: "x", hasTitle: true, hasAge: false },
{ type: "y", hasTitle: false, hasAge: true },
];
const definitionModel = createDefinitionModel<MyDefinition>(model => {
const steps = [];
for (const q of Q) {
steps.push(createStepModel(q.type 'task', step => {
if (q.hasTitle) step.property('title').value(/* ... */);
if (q.hasAge) step.property('age').value(/* ... */);
}));
}
model.steps(steps);
});
Of course that model cannot be updated after creation, but you can create a new model and reload the desinger.
Hi! I'm triying to create steps on realtime, which means that my backend sends the information about which steps will be used and the corresponding definition of them. In my case, I have a variable with all the steps and the definition about them, and now I have a React Component that loops for all of them and generate the Step content. But I would like to use the swd-editor to avoid developing validations & features that the editor has.
Is there any chance to generate the StepTypes and definition model dynamically based on schema data sent from the backend?
Thanks in advance!