Page Contents

Home > @loopback/rest > RestApplication > api

RestApplication.api() method

Set the OpenAPI specification that defines the REST API schema for this application. All routes, parameter definitions and return types will be defined in this way.

Note that this will override any routes defined via decorators at the controller level (this function takes precedent).

Signature:

api(spec: OpenApiSpec): Binding;

Parameters

Parameter Type Description
spec OpenApiSpec The OpenAPI specification, as an object.

Returns:

Binding

Binding for the api spec