-
Notifications
You must be signed in to change notification settings - Fork 145
canner script
To support a way for users to declare the schema easily. We take JSX as the interface. And canner-script is the pragma of JSX. If you're not familiar with how JSX transform to Javascript, please check out @babel/plugin-transform-react-jsx first since this page only explain the concepts of canner-script.
The default export function builder is the pragma of JSX. It finally returns a JSON.
Basically, a type tag generates a model instance, and the method toJson
is called immediately to return the JSON object of the tag.
<Layout> is the tag which is used to rearrange the Layout of fields in Canner. It doesn't represent any data.
To separate the <Layout> information and data schema, we don't embed the layout information in the data schema. Instead, each <Layout> tag creates a Visitor that is used to change the component tree.