Skip to main content
Version: Next

createValidatedOpenApiRouterFromGeneratedEndpointMap()

Home > @backstage/backend-openapi-utils > createValidatedOpenApiRouterFromGeneratedEndpointMap

Create a new OpenAPI router with some default middleware.

Signature:

function createValidatedOpenApiRouterFromGeneratedEndpointMap<T extends EndpointMap>(spec: RequiredDoc, options?: {
validatorOptions?: Partial<Parameters<typeof OpenApiValidator>['0']>;
middleware?: RequestHandler[];
}): TypedRouter<T>;

Parameters

Parameter

Type

Description

spec

RequiredDoc

Your OpenAPI spec imported as a JSON object.

options

{ validatorOptions?: Partial<Parameters<typeof OpenApiValidator>['0']>; middleware?: RequestHandler[]; }

(Optional)

**Returns:**

TypedRouter<T>

A new express router with validation middleware.