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

How to migrate model mixins #3951

Closed
5 tasks
bajtos opened this issue Oct 17, 2019 · 2 comments
Closed
5 tasks

How to migrate model mixins #3951

bajtos opened this issue Oct 17, 2019 · 2 comments

Comments

@bajtos
Copy link
Member

bajtos commented Oct 17, 2019

This is a follow-up for #3718 and #3922.

Write content for docs/site/migration/models/mixins.md, explain how to migrate mixins from LB3 style (see Mixins docs) to LB4 style (ES2015 mixin classes).

Important: In LB3, a model class provided both Schema definition, Persistence behavior and Public API. As a result, a single LB3 mixin can contribute to all three layers. In LB4, each of these layers map to a different concept (Model class, Repository class, Controller class).

Acceptance criteria

Migration guide describing how to:

  • Convert a LB3 "mixin function" to LB4 mixin class factory
  • Migrate mixins contributing to model schema (e.g. new property definitions)
  • Migrate mixins modifying persistence behavior (e.g. adding new methods, installing operation hooks, etc.)
  • Migrate mixins modifying API (e.g. adding new public methods, modifying remoting metadata of built-in LB3 methods).
  • Migrate mixin configuration in LB3 model definition to LB4 Model and/or Repository.

UPDATED 2020-02-27 by @bajtos: Based on discussion with @emonddr, we decided to removed the following entry, because "mixin model" approach is not documented in LB3:

  • Convert a LB3 "mixin model" to LB4 mixin class factory
@bajtos
Copy link
Member Author

bajtos commented Oct 17, 2019

I think this story may need a spike to explore different LB3 mixin kinds and what's the best way migration path for them.

You can use the following npm search to find existing LB3 mixins as examples to help us better understand different usage patterns we need to cover in our migration guide:

https://www.npmjs.com/search?q=loopback%20mixin

@emonddr
Copy link
Contributor

emonddr commented Feb 27, 2020

As suggested by @bajtos , we should have a LoopBack 4 topic in our documentation on how to use mixins. #4759

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

3 participants