TexteaInc / funix

Building web apps without manually creating widgets
http://funix.io
MIT License
90 stars 10 forks source link

Type incorrect implementation #29

Closed himself65 closed 1 year ago

himself65 commented 2 years ago

For now, the response of types to the frontend is based on string. However, this will cause serious problems.

  1. We need to implement N-to-N parsers for both sides. For now, we only have the javascript and python sides. Supporting basic type has caused many bugs on both sides. WHAT IF we have more than two languages support?

  2. type checks based on string matches will become shit codes. For example:

https://github.com/TexteaInc/PyDataFront/blob/abaf7ee6929bee265391748fd63ee7577e10c028/backend/pydatafront/decorator/__init__.py#L41-L67

The regex is human unreadble code. For now, we have only str, int, and list, but the code already become unreadable.

  1. Making a wheel will cost extra time on defining the proposals

Our type checking should be based on JSON schema, one of the famous and stable formats for describing data structure.

https://json-schema.org/

And you can just write one code to build your own data form, https://react-jsonschema-form.readthedocs.io/en/latest/

himself65 commented 2 years ago

https://pydantic-docs.helpmanual.io/

himself65 commented 2 years ago

Refactor to https://fastapi.tiangolo.com/

forrestbao commented 1 year ago

@Himself65 Please revise the issue below. What changes do you suggest us to make ?

forrestbao commented 1 year ago

I think we should study how Google App Script does this.

TURX commented 1 year ago

I think this is almost solved with rjsf in dev branch