Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 18 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
### Swagger Code Generation
# Swagger Code Generation

This repository relies on the following Dockerfile in order to run
Swagger Codegen inside a Docker container:
https://hub.docker.com/r/jimschubert/swagger-codegen-cli/.
https://hub.docker.com/r/parsertongue/swagger-codegen-cli.

We're currently using version 2.3.1 of Swagger Codegen.
We're currently using version 3.0.32 of Swagger Codegen.

### Generating the API Client
## Generating the API Client

Copy the Swagger specification YAML files to the local `./input` directory.

Expand All @@ -17,23 +17,24 @@ https://docs.jumpcloud.com/2.0.
Update the version number for each package in `config_v1.json` or
`config_v2.json`.

To generate the API v1 or v2 client, run the commands below (assuming your
API v1 and v2 specification files are `./input/index1.yaml` and
`./input/index2.yaml`):
To generate the API v1 or v2 client, run the commands below:

```
docker-compose run --rm swagger-codegen generate -i /swagger-api/yaml/index1.yaml -l python -c /config/config_v1.json -o /swagger-api/out/jcapiv1
docker-compose run --rm swagger-codegen generate -i /swagger-api/yaml/index2.yaml -l python -c /config/config_v2.json -o /swagger-api/out/jcapiv2
```
```bash
# Update API v1 and v2 specification files in `./input/index1.yaml` and `./input/index2.yaml`):
mkdir input
curl https://docs.jumpcloud.com/api/1.0/index.yaml --output input/index1.yaml
curl https://docs.jumpcloud.com/api/2.0/index.yaml --output input/index2.yaml

This will generate the API v1 and v2 client files under the local
`./output/jcapiv1` and `./output/jcapiv2` directories.
# Generate SDKs
mkdir output
LANG="python"
docker-compose run --rm swagger-codegen generate -i /swagger-api/yaml/index1.yaml -l ${LANG} -c /config/config_v1.json -o /swagger-api/out/jcapiv1
docker-compose run --rm swagger-codegen generate -i /swagger-api/yaml/index2.yaml -l ${LANG} -c /config/config_v2.json -o /swagger-api/out/jcapiv2

Once you are satisfied with the generated API client, you can replace the
existing files under the `jcapiv1` or `jcapiv2` directory with your generated
files:
# This will generate the API v1 and v2 client files under the local `./output/jcapiv1` and `./output/jcapiv2` directories.

# Once you are satisfied with the generated API client, you can replace the existing files under the `jcapiv1` or `jcapiv2` directory with your generated files:

```
rm -rf jcapiv1
mv output/jcapiv1 .

Expand Down
Loading