Skip to content

Commit

Permalink
Reintroduce instructions to generate client
Browse files Browse the repository at this point in the history
  • Loading branch information
paololucchino committed Jan 31, 2024
1 parent 0d67199 commit 4a17e8b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
28 changes: 28 additions & 0 deletions generate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generating a new client

Every time


1. Create a new branch `git checkout -b new_branch_name`
2. Install openapi-generator

```npm install @openapitools/openapi-generator-cli -g```

2. Place the latest swagger.json in `./generate/swagger.json`

3. Remove the current files except the `token.py` file

```
mv data_bridges_client/token.py .
rm -rf tests docs data_bridges_client
mkdir data_bridges_client
mv ./token.py data_bridges_client/
```

5. Generate the client by running this command from the root of the repository. We pin the version to 5.4.0 as python templates from more recent versions don't seem to work.
```
openapi-generator-cli version-manager set 5.4.0
openapi-generator-cli generate -g python -i generate/swagger.json -o . --package-name data_bridges_client --git-user-id WFP-VAM --git-repo-id DataBridgesAPI
```
4. Manually revert changes to `setup.py` and `README.md`. These relate to additional functionality we developed to handle the WFP token refresh workflow.
5. Commit, push and open a PR into `dev` for review.
3 changes: 3 additions & 0 deletions generate/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
openapi-generator-cli version-manager set 5.4.0
openapi-generator-cli generate -g python -i generate/swagger.json -o . --package-name data_bridges_client --git-user-id WFP-VAM --git-repo-id DataBridgesAPI
1 change: 1 addition & 0 deletions generate/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm install @openapitools/openapi-generator-cli -g

0 comments on commit 4a17e8b

Please sign in to comment.