Page Contents

Home > @loopback/rest > RestApplication > exportOpenApiSpec

RestApplication.exportOpenApiSpec() method

Export the OpenAPI spec to the given json or yaml file

Signature:

exportOpenApiSpec(outFile?: string, log?: {
        (...data: any[]): void;
        (message?: any, ...optionalParams: any[]): void;
    }): Promise<void>;

Parameters

Parameter Type Description
outFile string File name for the spec. The extension of the file determines the format of the file. - yaml or yml: YAML - json or other: JSON If the outFile is not provided or its value is '' or '-', the spec is written to the console using the log function.
log { (…data: any[]): void; (message?: any, …optionalParams: any[]): void; } Log function, default to console.log

Returns:

Promise<void>