danutc / apollo-react-form-builder

extends mantra-react-form-builder to handle forms linked to multiple datasources over apollostack
4 stars 2 forks source link

Apollo Form High Level Design #1

Open danutc opened 8 years ago

danutc commented 8 years ago

Please see attached the High Level Design diagram. apollo-form-high-level-design 1

stubailo commented 8 years ago

Hmm, I think the form builder should not be involved in defining the schema on the server - it should just call a mutation defined in the API.

danutc commented 8 years ago

The form designer person knows how to map form fields to datasource data fields.

So the designer needs to put their knowledge in a format that the sever can use (Mapping Schemas). This is why form builder generates FormLoadMappingSchema and FormSubmitMappingSchema.

Aggregator loads FormLoadMappingSchema and uses it to load data to present on the form.

Splitter loads FormSubmitMappingSchema and uses it to split formData then validate against datasource schemas; if successful then Splitter sends the data to appropriate datasources.

@stubailo What other options are there to aggregate and split? How can we define the rules for aggregation / splitting? Please note that we have hundreds of form definitions and they change quite frequently.

stubailo commented 8 years ago

I'm not yet sure what split means in this context. Can you explain more?

danutc commented 8 years ago

On the User form there are fields. Some fields map to a mongodb document and some map to a REST server. Eg Name, Surname and Age are sent to mongo document and Price, Item SKU and Quantity are sent to a REST system for ordering (just making up something to illustrate).

Split means that formData data structure has to be split so some fields are sent to mongo and some to REST.

danutc commented 8 years ago

@stubailo logically we need to aggregate and split formData from / to datasources. Another thing is that form definitions are many and change often. How can we address these requirements in the context of Apollo / GraphQL?

Hmm, I think the form builder should not be involved in defining the schema on the server - it should just call a mutation defined in the API.

Do you suggest that the form builder should call a server API to pass mapping information for each form type?

H1net commented 8 years ago

Do you suggest that the form builder should call a server API to pass mapping information for each form type

Yes, separatable+combinable between the pre-combined schemas (where api logic is sometimes separated by domain/components in larger apps)?

There are certainly properties missing from the GraphQL schemas/type definitions.

Seems you cover this in mantra-react-form-builder above which is what the FormMappingSchemas ultimately map from/to?