-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
docs: dynamic models, repositories, and controllers #5591
Conversation
docs/site/sidebars/lb4_sidebar.yml
Outdated
@@ -254,6 +254,10 @@ children: | |||
url: Serving-static-files.html | |||
output: 'web, pdf' | |||
|
|||
- title: 'Dynamic models, repositories, and controllers' | |||
url: Dynamic-models-repositories-controllers.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing indent. I think this .yml needs to have the right indentation in order for it to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start 👏
Cross-posting #4296 (comment):
Instead of creating a new doc page, update existing doc pages for DataSources, Models to describe different ways for creating the artifacts.
It would not be fun having to guess and search through the docs find out how to dynamically add models and controllers. However, I agree we should update those pages as well.
Can you please update the pages listed in #4296 (comment) to mention the different ways how a Model/Repository/Controller can be created?
- Using our CLI to create them as static artifacts in source code files.
- Using
lb4 rest-api
to build the repository & controller dynamically at runtime using the user-provided config. - And finally the fully dynamic approach you are describing here.
I am fine either way, as long as the changes are made as part of #4296 in the next few days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👏
Please get approvals from other people that commented on this PR before landing.
Create a repository mixin with your customization as shown in the | ||
" | ||
[Defining A Repository Mixin Class Factory Function](https://loopback.io/doc/en/lb4/migration-models-mixins.html#defining-a-repository-mixin-class-factory-function) | ||
" example, and then specify this repository as the base class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" example, and then specify this repository as the base class. | |
" example, apply the mixin on the base repository class (e.g. `DefaultCrudRepository`) then specify this combined repository as the base class to be used. |
Sure. |
d87b0c6
to
0c3239b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions. Other than that, LGTM.
docs/site/sidebars/lb4_sidebar.yml
Outdated
@@ -254,6 +254,10 @@ children: | |||
url: Serving-static-files.html | |||
output: 'web, pdf' | |||
|
|||
- title: 'Dynamic models, repositories, and controllers' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe Dynamically adding models, repositories, and controllers
? to match the title of the docs page.
@@ -0,0 +1,259 @@ | |||
--- | |||
lang: en | |||
title: 'Dynamically add models, repositories, and controllers during runtime' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title: 'Dynamically add models, repositories, and controllers during runtime' | |
title: 'Dynamically adding models, repositories, and controllers during runtime' |
How to dynamically add models, repositories, and controllers during runtime.
Addresses #4296.
How to dynamically add models, repositories, and controllers during
runtime.
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈