jmosbacher / pydantic-panel

Edit pydantic models with widgets from the awesome Panel package
MIT License
24 stars 3 forks source link

Maybe support jsonschema #19

Open jmosbacher opened 2 years ago

jmosbacher commented 2 years ago

JSONSchema can easily be converted to pydantic models which can then be edited. Would require a bit of complexity as we would have to generate the models in memory using e.g. fsspec, import them dynamically and them use them for conversion to and from json.

Probably will implement on if requested explicitly. If you would be interested in such a thing, please add a comment.

simontaurus commented 11 months ago

Just found your project while researching for potential connections between pydantic and panel/params. We use jsonschemas to be more language independent, e. g. to also use javascript bases application like https://github.com/json-editor/json-editor, so jsonschema support would be an interesting option.

jmosbacher commented 11 months ago

Hi, thanks for the interest. Can you give a little more details on your use case? The main problem this package solves is handling arbitrary python objects and two way sync for pydantic model objects. It sounds like maybe you dont want to use pydantic models at all and just generate widgets from a jsonschema, which is almost trivial to implement so this package maybe would be overkill for you.

simontaurus commented 11 months ago

Thanks for your response. We built pydantic classes from jsonschema and our code on top of this. If we built panel classes/widgets directly from jsonschema I guess we would have a separate disconnected data model. So if we have jsonschema => pydantic already in place you would recommend going directly from pydantic to panels using this package as it is? The mentioned sync provided by this package would allow us to write the same data processing code regardless of whether data comes from a static source, API or is manipulated via panels by the user.