Parse model definition when creating a model API
kettanaito opened this issue · comments
The model definition should be parsed on the root level of createModelApi
, as it derives additional information from the model definition (properties, relations, primary key). There is no need to parse it each time when creating an entity (current behavior).
This change would also allow for various extensions (i.e. client sync and persistency) to access the model's relational properties on the root level when applying the extension. Extensions then may use relational properties information to provision a custom logic around them (i.e. properly serializing relational values into sessionStorage
for client-side persistency).
This may require restructuring the data flow, as parseModelDeclaration
won't accept the initial values anymore. It may return a function that applies those values to the parsed properties/relations, so it could be invoked later in .create()
.