Yes it can handle any json schema of any
Yes it can handle any json schema of any depth
13 Replies
I'm not sure if this is a jsonschema question or a windmill question, but can you somehow add an "Add" button to add more keys to an object? Like in this screenshot, the metadata object is multiple key=values, but I want to be able to add more
We could attempt to support it as additional properties: true
It doesn't look like additionalProperties makes a difference at the momeny. I also tried making it a list of objects instead, but that seems like it only adds a textbox each time you click Add, not another object
Yes we would have to add that feature
gotcha, it would be useful to me at least 😄
last question for now, as a workaround, can I change the json schema for a form dynamically? Like have a button that changes the schema so that it inserts an extra key in that metadata object
yes since the jsonschema can be a connect or script
I will add it to the backlog
Thanks @rubenf , I'll play around with what I have for now but I think I can see how it'll work
Okay I lied, I have another question. I tried to hook up the output of the form to a button, in that button I have an inline script that inserts an extra key into the jsonschema.
And then I connected the form to the output of that button's inline script.
This mostly works, but if I reload the app the form is empty.
I was thinking of having another button that loads a "default" schema, but then I realized I'll run into another issue if I want multiple buttons that modify the schema. I can't have the form connected to all of the outputs.
What's the best way to handle that? E.g. if I have a button like "Add new metadata" and a 2nd button like "Add new service" where they should both modify the jsonschema of the same form
I thin you will need to use frontend scripts and the state
you can populate the state using a bg script loaded at start
Then you can modify it with buttons, and then connect to the state directly
state is modifyable in frontend scripts by doing state.foo = X
You can also configure your buttons to run at start
I would say keep complexity at a minimum, it won't take me long to implement the additionalProperties
That makes sense, I haven't looked at the frontend scripts yet. Is the state only modifiable by frontend scripts, or could I change it with a python/deno script too?
Only with frontend scripts
But you can chain bg and frontend scripts
That's because state only exists in the frontend/browser
Like having a frontend script return the state, then a bg script read/modify it and return it to a different frontend script to actually set it?
Yes anything is possible
Sky is the limit
Awesome. I probably won't need to, just curious. That does open a lot of possibilities.
I'm trying to learn how it works w/ a personal project but hoping it works out well enough to use at work in the future too