Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import REST API of LoopBack 3 models #3822

Closed
bajtos opened this issue Sep 27, 2019 · 2 comments
Closed

Import REST API of LoopBack 3 models #3822

bajtos opened this issue Sep 27, 2019 · 2 comments

Comments

@bajtos
Copy link
Member

bajtos commented Sep 27, 2019

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: PersistedModel is for CRUD, KeyValueModel is for key-value, Model is for free-form API that we don't support in LB4 yet. We need to handle inheritance though - if Customer inherits from User which inherits from PersistedModel, then import of Customer needs to use Crud pattern.
  • 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 via modelCtor.http.path (see here).

Acceptance criteria

TBD - will be filled by the team.

@stale
Copy link

stale bot commented Oct 4, 2020

This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository. This issue will be closed within 30 days of being stale.

@stale stale bot added the stale label Oct 4, 2020
@stale
Copy link

stale bot commented Dec 25, 2020

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

@stale stale bot closed this as completed Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant