Generates a fully-functional application that provides the APIs conforming to the Swagger 2.0 specification.
$ cd <loopback-app-dir> $ slc loopback:swagger
The tool will prompt you for the location of the Swagger spec file:
[?] Enter the swagger spec url or file path:
Enter a URL or a relative file path. Based on the REST API defined in this file, the tool will then prompt you for the models to generate. For example, if you enter the Swagger simple petstore example URL:
https://raw.githubusercontent.com/wordnik/swagger-spec/master/examples/v2.0/json/petstore-simple.json
The tool will display this (for example):
[?] 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 data source to use then 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... ...