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?: (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>