-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
In #3688, we introduced a new CLI command to import LB3 models to LB4 projects. The initial version imports only model definition, it does not import data-access and REST API layers.
In #2036, we are building solution for exposing model via (CRUD REST) API via declarative configuration.
Let's improve the importer to scaffold not only model definition, but also configuration of the public API.
How to build the LB4 configuration:
- Model class. This is easy to supply, we have just created the class during import.
- DataSource name. This can be tricky - how to map LB3 datasources to LB4 datasources?
- API pattern (Crud, KeyValue, etc.). In LB3, this depends on the base class used by the model:
PersistedModelis for CRUD,KeyValueModelis for key-value,Modelis for free-form API that we don't support in LB4 yet. We need to handle inheritance though - ifCustomerinherits fromUserwhich inherits fromPersistedModel, then import ofCustomerneeds to useCrudpattern. - Base path. In LB3, this can be configured via model settings or is inferred using
inflection.pluralize(see here). Fortunately, this is all resolved by the time a model is loaded at runtime, we can obtain the base path viamodelCtor.http.path(see here).
Acceptance criteria
TBD - will be filled by the team.