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

Feature Request - API for dynamic model creation #1580

Closed
meepeek opened this issue Jul 31, 2018 · 9 comments
Closed

Feature Request - API for dynamic model creation #1580

meepeek opened this issue Jul 31, 2018 · 9 comments

Comments

@meepeek
Copy link

meepeek commented Jul 31, 2018

Description / Steps to reproduce / Feature proposal

I have checked in here https://loopback.io/doc/en/lb4/LoopBack-3.x.html and don't think what I am about to mention was existing in the plan so I would like to purpose.

I am using LB 3 and wish the model to be able to create programmatically (run time) by calling an API, instead of manually defining JSON.

Current Behavior

Programmer will have to manually add JSON file, or generate by CLI, for each model. If an additional model is needed, we will have to restart the server.

Expected Behavior

I wish the model can be created either adding JSON file or calling an API and the system will create a model and corresponding JSON file if needed.

Another idea is moving models definition to be defined in lowdb JSON, instead of plain JSON. This way programmer may create their own API to dynamically create models.

See Reporting Issues for more tips on writing good issues

@mgleland
Copy link

yes, please - I depend on the ability to dynamically generate models.

@shimks shimks added the feature label Aug 8, 2018
@papaytl185
Copy link

papaytl185 commented Aug 8, 2018

I depend on this as well, which would also need to create the controller and repository dynamically from a database or other service.

@dhmlau
Copy link
Member

dhmlau commented Aug 23, 2018

I think this is related to #1517.

@meepeek
Copy link
Author

meepeek commented Aug 24, 2018

@dhmlau Thank you the information. However, the dynamic I meant was a bit different.

Actually, strongloop had implemented a GUI which has the feature similar to what I described, I think it's called Strongloop's Arc or Studio which you can mange a model from web UI.

As the current loopback backend that I experienced, I think it will need to restart the server once you have made changes on the model, which made model definition static. What I meant was an API to generate model and save and the load new model without restart server.

@virkt25
Copy link
Contributor

virkt25 commented Aug 24, 2018

The correct related to issue is #433

@mgleland
Copy link

mgleland commented Aug 24, 2018

also need the plain old createModel method that lets you create a model programmatically rather than from json files, etc. Also the ability to change it (including adding and removing hooks) without having to recreate the model.

@stale
Copy link

stale bot commented Sep 17, 2019

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 Sep 17, 2019
@stale
Copy link

stale bot commented Oct 17, 2019

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 Oct 17, 2019
@bajtos
Copy link
Member

bajtos commented Dec 9, 2019

The pull request #4235 shows how to define a model and expose it via a REST API at runtime. Feel free to join the discussion there or in follow-up stories we are going to create soon.

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

7 participants