Schema of a Collection.
It represents the children object of the sn-redux store. It's a parent element of the Content items so it is defined as array of items with the schema content.
Schema of a Content.
It represents an item in the entities Object of the sn-redux store. The items are identified by the attribute 'Id'.
Generated using TypeDoc
This module is for defining Content and Collection schemas to normalize nested JSON response data in redux state store.
Normalizr takes JSON and a schema and replaces nested entities with their IDs, gathering all entities in dictionaries.
Read more about normalizr here
Since everything is a Content in sensenet ECM we're working with Content and collection of Content in most of the cases. So the sn-redux Schemas module defines the two neccessarry main schema, content and arrayofContent to work with. This two schemas help you to normalize your JSON responses so that you can create a pure and flexible client-side datasource.
Example of normalizing the JSON response of a SenseNet OData Action for fetching Content as arrayOfContent schema which will create an entities object.
export const receiveContent = (response: Content[], params: string) => ({ type: 'FETCH_CONTENT_SUCCESS', response: normalize(response, Schemas.arrayOfContent), params })Example of normalizing the JSON response of a SenseNet OData Action for creating Content as content schema.
export const createContentSuccess = (response: Content) => ({ type: 'CREATE_CONTENT_SUCCESS', response: normalize(response, Schemas.content) });