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

Migration Guide: Discuss life cycle differences between LB3 and LB4 #3935

Closed
2 tasks
aharbis opened this issue Oct 16, 2019 · 13 comments
Closed
2 tasks

Migration Guide: Discuss life cycle differences between LB3 and LB4 #3935

aharbis opened this issue Oct 16, 2019 · 13 comments

Comments

@aharbis
Copy link
Contributor

aharbis commented Oct 16, 2019

Suggestion

This is a spin-off from a discussion on PR #3922.

The purpose of this issue is to discuss the life cycle differences between LB3 and LB4, with a primary goal of identifying pain-points during migration in regards to this topic.

Use Cases

Some initial topics or points of interest:

  • End-to-end request-response sequence
  • Out-of-the-box data parsing and validation provided by LoopBack
  • Various points to mount custom data validation for a given request / transaction
  • Operation hooks(interceptors in lb4)/remote hooks and their equivalents in LB4
  • differences of operations between LB3 and LB4 such as boot, injection.
  • datasource interceptor in lb4
  • How to migrate boot scripts How to migrate boot scripts #3957 might be related

Since it's life cycle, this should be a high level view

Examples

Acceptance criteria

TBD - will be filled by the team.

  • add these topics to the migration guide doc(s)
  • blog about this doc
@dhmlau
Copy link
Member

dhmlau commented Nov 14, 2019

@bajtos , could you please add the acceptance criteria so that the team can estimate? Thanks.

@dhmlau
Copy link
Member

dhmlau commented Feb 26, 2020

Discussion with @hacksparrow:
It seems like the scope of this task is not clear. A few things to figure out:

  • does it make sense to work on this task now while we're still working on other parts of the migration guide?
  • does it make sense to break the task down into a smaller pieces first?

@dhmlau
Copy link
Member

dhmlau commented Feb 27, 2020

@hacksparrow, let me assign it to you for now, because you indicated that you'll be looking into the scope of this task. Thanks.

@hacksparrow
Copy link
Contributor

https://loopback.io/doc/en/lb4/Understanding-the-differences.html already contains the broad differences between LB3 and LB4.

"Operation hooks(interceptors in lb4)/remote hooks and their equivalents in LB4" is covered by
https://loopback.io/doc/en/lb4/migration-models-overview.html.

"How to migrate boot scripts #3957 might be related" is covered by https://loopback.io/doc/en/lb4/migration-boot-scripts.html.

"Datasource interceptor in lb4" is covered by https://loopback.io/doc/en/lb4/Interceptor-generator.html.

For the remainder, I am suggesting to create the following pages under the Migration Guide.

  • Request-response cycle
    • Document the request response cycle in LB3
    • Document the request response cycle in LB4
  • In-built data parsing and validation
    • Document in-built data parsing and validation in LB3
    • Document in-built data parsing and validation in LB4
  • Custom validation
    • Document the points where data (request / transaction) can be accessed and validated in LB3
    • Document the points where data (request / transaction) can be accessed and validated in LB4

Let's create three new tasks, with the sub points as the acceptance criteria.

@dhmlau
Copy link
Member

dhmlau commented Mar 9, 2020

+1 in breaking down into smaller tasks or at least PRs.

I'm good with your updated acceptance criteria. @aharbis, feel free to chime in if there's particular topic you want to cover.

Not sure how we want to organize the docs, we do have an old issue about documenting the request/response cycle: #1833.

@hacksparrow
Copy link
Contributor

#1833 could be more detailed under "Behind the Scene", the one in the Migration Guide less detailed. I will close #1833 too.

@bajtos
Copy link
Member

bajtos commented Mar 9, 2020

I am fine with breaking this down into smaller tasks, that way we can better track progress and perhaps even spread the work.

  • Request-response cycle
  • In-built data parsing and validation
  • Custom validation

That's a good plan 👍

I think it's important to cover application life-cycle and especially the boot process too.

In LB3, the boot process works roughly as follows:

  1. Create datasources
  2. Define all models
  3. Attach models to datasources
  4. Run boot scripts

There are few more artifacts loaded by loopback-boot, e.g. middleware, I am not sure where exactly are they placed in the boot sequence.

In LB4, the boot process works differently. Models are define via TS files (there is no boot step for that), middleware is not supported at LB level yet (it's mounted on the top-level Express app), boot scripts are implemented as lifecycle observers that are invoked outside of the boot process, etc.

@hacksparrow
Copy link
Contributor

Ok then, another task on booting.

  • Booting
    • Document the LB3 bootup process
    • Document the LB4 bootup process

@dhmlau
Copy link
Member

dhmlau commented Mar 9, 2020

FYI - there's a GH issue for documenting application life cycle: #3384.

@aharbis
Copy link
Contributor Author

aharbis commented Mar 10, 2020

I am good with splitting this up into tasks, and I agree that these four will cover the large majority of the gaps I was hoping to see filled:

  • Request-response cycle
  • In-built data parsing and validation
  • Custom validation
  • Booting

I am happy to assist in contributing, but my expertise at this point is mostly on the LB3 side. I've yet to do many deep-dives into the inner workings of LB4.

@hacksparrow
Copy link
Contributor

#3384 would be a more detailed doc too. The content in the Migration Guide would not be as detailed.

@dhmlau
Copy link
Member

dhmlau commented Apr 28, 2020

Closing as done. Thanks @hacksparrow!

@dhmlau dhmlau closed this as completed Apr 28, 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

5 participants