JSON Data Services
Combines multiple services to help working with json-data manipulation, synchronisation and validation.
- The
DataService
manages application state and retrieval. Additional supports undo. - The
ValidationService
validates any data by a given JSON-schema. - The
SchemaService
returns the JSON-schema at the given JSON-pointer location
All services offer an interface based on JSON-pointer.
Services
DataService
Data can only be changed via the data-service methods. Each state is tracked within the services, enabling und/redo functionality.
// get data at json-pointerconst dataService = jsonData;dataService;
Data manipulation methods
// Set data at given pathdataService;// Set data at given pathdataService;// Set last set/delete actiondataService;// redo last undo actiondataService;
DataService events
// called before any data changes of the actiondataService// called after data changes, before observe events dataService // Events bubble up to root pointer (#), # is last eventdataService
Dataservice event object
// callbacks {}
// event object action: "SET_DATA" // @see store/actions.ActionTypes pointer: "#/pointer/location" parentPointer: "#/pointer"
ValidationService
Sends error notifications on changed data.
// create a new data validation serviceconst validationService = jsonSchema
// called before a next validationvalidationService // Validation Events bubble up to root pointer (#)validationService // called after notifying observers validationService // validate datavalidationService