xpodev / seamless

Seamless is a Python package for creating and manipulating HTML components. It is working similar to React.js, but in Python.
https://seamless.readthedocs.io
MIT License
7 stars 1 forks source link

Using pydantic for model validation #21

Closed binyamin555 closed 1 month ago

binyamin555 commented 5 months ago

Since the frontend sends the events arguments to the server as JSON, I think it can be a great idea to add pydantic as a condition dependency (meaning that the library will only add these features if pydantic is installed).

If pydantic is present, JSX will automatically validate the arguments of the event function and unpack them while also converting the input arguments to their expected types.

This makes integration much more seamless and allows developers to easily define server side events.

This, of course, will require JSX to read the event's signature and type annotations.

neriyaco commented 5 months ago

This is a great idea!

I will start exploring this soon.

neriyaco commented 4 months ago

I think I added this functionality in v0.6.3