Creates a fully-functional application with an API defined using the Swagger 2.0 specification. For more information on Swagger, see Swagger RESTful API Documentation Specification (version 2.0).
$ [slc | apic] loopback:swagger [options] [<_name_>]
Print the generator’s options and usage.
Do not remember prompt answers. Default is false.
Do not automatically install dependencies. Default is false.
You can optionally provide the URL of the Swagger specification file to use. If you do, then the tool will use that as the default in the interactive prompts.
The tool will prompt you for:
- Location of the Swagger JSON specification file. Enter a URL or relative file path.
- Models to generate, based on the REST API defined in the Swagger file. Move the cursor with the arrow keys, and press the space bar to de-select the model next to the cursor. Then press Return to generate all the selected models.
- Data source to use.
For example, if you enter the Swagger simple pet store example URL:
The tool will display:
[?] Select models to be generated: ❯⬢ swagger_api ⬢ pet ⬢ petInput ⬢ errorModel
Move the cursor with the arrow keys, and press the space bar to de-select the model next to the cursor. Then press Return to generate all the selected models.
The tool will prompt you for the display information on what it’s doing; for example:
[?] Select the data-source to attach models to: db (memory) Creating model definition for swagger_api... Creating model definition for pet... Creating model definition for petInput... Creating model definition for errorModel... ...