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
[SEMVER-MAJOR] Discard sugar method for model creation #2401
Conversation
c774c51
to
0c6b1b0
Compare
@bajtos : Please review, thank you. |
@slnode test please |
|
||
`app.model(modelName, settings)`, a sugar for creating non-existing model, is | ||
now removed in favor of promoting use of: | ||
- `app.registry.createModel(modelName, properties, options) to create new model |
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 backslash character after )
@gunjpan reviewed, PTAL. |
if (typeof Model === 'string') { | ||
var msg = 'app.model(modelName, settings) is no longer supported. ' + | ||
'Use app.registry.createModel(modelName, definition) and ' + | ||
'app.model(modelCtor, config) instead.'; |
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.
ModelCtor
please, we usually use Pascal Case for constructors (class names).
@gunjpan two more comments, otherwise the patch LGTM.
No further review is necessary, please squash the commits before landing. |
7839b88
to
08b273c
Compare
@slnode test please |
08b273c
to
cffb4f1
Compare
@slnode test please |
1 similar comment
@slnode test please |
80cd52f
to
bc0b6f7
Compare
app.set('remoting', { errorHandler: { debug: true, log: false }}); | ||
app.use(loopback.rest()); | ||
app.enableAuth(); | ||
app.dataSource('test', { connector: 'memory' }); |
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.
I think we misunderstood each other. Keep the app
creation in the before
hook, because that part is typically shared by all test. Keep the line var MyTestModel = ...
in the test, because the model is specific to the test case.
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.
@bajtos : In the previous review cycle, IIRC, (can't quote commit as rebased), I had kept the before()
part, but was advised to remove it as there is only one case in that describe()
block.
Do you still recommend changing it?
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.
I see. Let's not bike shed and keep the code as it is now.
@gunjpan LGTM |
@gunjpan please rebase on top of the current master and check CI results before landing. |
@slnode test please |
bc0b6f7
to
214269e
Compare
214269e
to
2f3b78a
Compare
Current implementation of `app.model(modelName, settings)` works as a sugar for model creation. In 3.0, this is not supported anymore. This implementation reports an error when sugar is used for model creation. Includes: - Updated app.model() method - Fixed test cases reflecting the change
2f3b78a
to
832e2c3
Compare
@gunjpan I have rebased your patch on top of the latest master. All CI builds are passing with the exception of I am going to land this patch. |
Current implementation of `app.model(modelName, settings)` works as a sugar for model creation. In LB 3.0, this is not supported anymore. This backporting: - keeps the sugar method for model creation for backward compatibility - updates test cases to use `app.registry.createModel()` for model creation Backport of #2401
Current implementation of `app.model(modelName, settings)` works as a sugar for model creation. In LB 3.0, this is not supported anymore. This backporting: - keeps the sugar method for model creation for backward compatibility - updates test cases to use `app.registry.createModel()` for model creation Backport of #2401
Current implementation of `app.model(modelName, settings)` works as a sugar for model creation. In LB 3.0, this is not supported anymore. This backporting: - keeps the sugar method for model creation for backward compatibility - updates test cases to use `app.registry.createModel()` for model creation Backport of #2401
Current implementation of
app.model(modelName, settings)
works as a sugar for model creation. In 3.0, this is
not supported anymore. This implementation reports an
error when sugar is used for model creation.
Includes:
Connect to https://github.com/strongloop-internal/scrum-loopback/issues/772