With spring in the air, we’ve been hard at work gearing up for a new major release of LoopBack 4, which we’ve dubbed the “Developer Preview 2”. The team has been focusing on the items needed for this release in the March Milestone. You can also see the April Milestone to see the work we have planned for the month of April.

Read on to learn about the March Milestone’s accomplishments and more.

OpenAPI 3.0 Support

In keeping up with the latest technologies and standards, LoopBack 4 has added support for OpenAPI 3.0.0 via the new @loopback/openapi-v3 package. This package includes decorators to describe LoopBack artifacts such as Controllers using the latest specification. Along with this, LoopBack 4 has deprecated support for Swagger 2.0 and the @loopback/openapi-v2 package.

Documentation

A good framework comes with good documentation. During the month of March, the team put a major focus on documentation. We reorganized and updated the docs to be in sync with the latest features in LoopBack 4.

A spike also took place to determine the feasibility of moving LoopBack 4 documentation from loopback.io repository to the LoopBack 4 monorepo. Following the spike, we moved the documentation to the monorepo, with the help of some scripts that allow the docs to show on loopback.io site. This effort allows us to keep the documentation up to date with the code. The docs are also now available as a npm package @loopback/docs which opens up the possibility for versioned docs on loopback.io.

Now contributors to Loopback 4 can update the documentation along with the code in the same PR in the loopback-next repository. This simplifies the development process for all contributors as documentation and code live under the same repository.

Tutorial

For those looking to get started with LoopBack 4, we have completely revamped the LoopBack 4 Tutorial showing you how to create a Todo Application (with legacy juggler) support. This package was formerly known was example-getting-started. The new tutorial has been broken down into multiple pages with each one focusing on a key concept for LoopBack 4 development. You can check out the new tutorial here

APIDocs

There were a number of issues in typedoc and strong-docs which left APIDocs to be incomplete for some of the packages. These issues were addressed and as a result APIDocs are now more accurate than before as it includes missing sections and types.

Injection Type Inference

Previously, it was not possible for the type of an item retrieved from Context to be inferred by TypeScript, providing some safety and autocompletion support in editors such as Visual Studio Code. We added support for providing a type using generics when using Context functions like get, getSync, etc. so you can have type safety when using dependency injection. These changes came in as a result of PR #1150. Example of before and after can be seen below.

import {Context} from '@loopback/context';

class FooClass {
  hello() {
    console.log('hello');
  }
}

const ctx = new Context();
const key = 'my.binding.key';
ctx.bind(key).toClass(FooClass);

let foo = await ctx.get(key);

// Before PR #1150, foo is considered to be of type any
// No error / warning is shown that property 'world' doesn't exist on FooClass.
foo.world();

// AFter PR #1150, We specify the type as a generic in `<>`
let foo = await ctx.get<FooClass>(key);

// The following compiler error is shown in VSCode.
// [ts] Property 'world' does not exist on type 'FooClass'.
foo.world();

There is more work being done to further improve the developer experience by not having to provide a type at all (as it’s stored in the Binding Key). You can track progress for this in PR #1169.

Experiments

There are some exciting features in development that you can check out and provide feedback on below!

There are some other experimental pull requests as well that can be seen with the [RFC] or [WIP] tag here.

Juggler Relations

With LoopBack 4, we are talking a fresh new look at Model Relations. In March we started a spike to investigate approaches and answer some questions to allow the team to make a better decision for future work that needs to be done. Unfortunately, due to the complexity and size of the task, this task will not finish on time but you can track progress in this PR and Issue.

Miscellaneous Improvements

  • New projects generated using the LoopBack 4 CLI now feature the new Powered by LoopBack 4 Logo. Powered by LB4 Badge

  • LICENSE.md is no longer generated for a new Application scaffolded using the CLI.
  • We’ve simplified the issues template for LoopBack 4 and now accept questions in issues (but please use this as a last resort).

Farewell to Kevin

Kevin Delisle (@kjdelisle on GitHub) has left the LoopBack team mid-March to move on to new pursuits and we wish him the very best in all of his future endeavors.

Call for Action

LoopBack’s future success counts on you. We appreciate your continuous support and engagement to make LoopBack even better and meaningful for your API creation experience. Please join us and help the project by: