Page Contents

Home > @loopback/rest > RestServer > exportOpenApiSpec

RestServer.exportOpenApiSpec() method

Export the OpenAPI spec to the given json or yaml file

Signature:

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

Parameters

Parameter Type Description
outFile string (Optional) 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 (message?: any, …optionalParams: any[]) => void (Optional) Log function, default to console.log

Returns:

Promise<void>