rubenf
rubenf•16mo ago

Yes it can handle any json schema of any

Yes it can handle any json schema of any depth
13 Replies
sigcore
sigcore•16mo ago
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
No description
rubenf
rubenf•16mo ago
We could attempt to support it as additional properties: true
sigcore
sigcore•16mo ago
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
rubenf
rubenf•16mo ago
Yes we would have to add that feature
sigcore
sigcore•16mo ago
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
rubenf
rubenf•16mo ago
yes since the jsonschema can be a connect or script I will add it to the backlog
sigcore
sigcore•16mo ago
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
rubenf
rubenf•16mo ago
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
sigcore
sigcore•16mo ago
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?
rubenf
rubenf•16mo ago
Only with frontend scripts But you can chain bg and frontend scripts That's because state only exists in the frontend/browser
sigcore
sigcore•16mo ago
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?
rubenf
rubenf•16mo ago
Yes anything is possible Sky is the limit
sigcore
sigcore•16mo ago
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