|
| 1 | +Using the VM |
| 2 | +============ |
| 3 | + |
| 4 | +Once you have installed the VM following the instructions in |
| 5 | +[PREREQUISITES.md](PREREQUISITES.md) (option 1) you are ready to begin using |
| 6 | +the tutorial tools! |
| 7 | + |
| 8 | +### Running the VM |
| 9 | + |
| 10 | +You can check the status of the VM by running `vagrant status` from within |
| 11 | +the repo directory. If it is not already running, start it with |
| 12 | +`vagrant up --provider virtualbox`. |
| 13 | + |
| 14 | +### Logging In |
| 15 | + |
| 16 | +You can log in to the VM using `vagrant ssh` on the command line or by |
| 17 | +connecting to `localhost:2222` via ssh. |
| 18 | + |
| 19 | +VM Tools |
| 20 | +-------- |
| 21 | + |
| 22 | +### Swagger Editor |
| 23 | + |
| 24 | +Two versions of the web-based [swagger-editor](https://github.com/swagger-api/swagger-editor) |
| 25 | +have been installed on the VM and should be accessible from the host machine. |
| 26 | + |
| 27 | +http://localhost:8000/ - Swagger Editor 2.x (includes links to code generation service) |
| 28 | + |
| 29 | +http://localhost:8001/ - Swagger Editor 3.x (improved editor but no coge generation) |
| 30 | + |
| 31 | +### Python API Implementation |
| 32 | + |
| 33 | +An example implementation using [Connexion](https://connexion.readthedocs.io/en/latest/) |
| 34 | +is included in the tutorial repo. To run it you first need to activate the |
| 35 | +Python virtual environment (using the `workon` command provided via |
| 36 | +virtualenvwrapper.): |
| 37 | + |
| 38 | +``` |
| 39 | +workon tutorial |
| 40 | +``` |
| 41 | + |
| 42 | +Then to run the connexion app: |
| 43 | + |
| 44 | +``` |
| 45 | +python -m betterapis |
| 46 | +``` |
| 47 | + |
| 48 | +With the application running, the API and Swagger UI are available from the |
| 49 | +host machine. |
| 50 | + |
| 51 | +The API should be available here: |
| 52 | + |
| 53 | +http://localhost:8080/talks |
| 54 | + |
| 55 | +The Swagger UI for the API is available here: |
| 56 | + |
| 57 | +http://localhost:8080/ui/ |
| 58 | + |
| 59 | +### Swagger Validator |
| 60 | + |
| 61 | +A validation tool has been installed. This will help you find errors in working |
| 62 | +specification files. For example, you can run it on one of the tutorial solution |
| 63 | +files: |
| 64 | + |
| 65 | +``` |
| 66 | +swagger validate tutorial-repo/lessons/lesson-1.02/solution.yaml |
| 67 | +Results: 0 errors, 0 warnings |
| 68 | +``` |
| 69 | + |
| 70 | +### Dredd |
| 71 | + |
| 72 | +The [Dredd](http://dredd.readthedocs.io/en/latest/) testing tool is installed. |
| 73 | +You may verify it works and see usage information by running: |
| 74 | + |
| 75 | +``` |
| 76 | +dredd --help |
| 77 | +``` |
| 78 | + |
| 79 | +### Swagger-codegen |
| 80 | + |
| 81 | +In addition to being available via links in the Swagger Editor 2.x, |
| 82 | +swagger-codegen is available on the command line in the VM. For usage |
| 83 | +information run: |
| 84 | + |
| 85 | +``` |
| 86 | +java -jar swagger-codegen.jar help |
| 87 | +``` |
| 88 | + |
0 commit comments