Skip to content

Commit

Permalink
chore: switch Swagger client generation to Podman (#158)
Browse files Browse the repository at this point in the history
Signed-off-by: Panos Vagenas <[email protected]>
  • Loading branch information
vagenas authored Jan 19, 2024
1 parent aafdbf6 commit 79fe58a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 deletions.
22 changes: 2 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,8 @@ poetry add NAME
## Updating the Generated Swagger Client
**Note:** This requires Docker.
To update the Swagger Client with the new API specifications, run:
```bash
tools/swagger-client-generator <URL to the DS>
```
Example:
```bash
tools/swagger-client-generator.sh https://DEEPSEARCH_HOST
```
If you don't want to download the Swagger Specification, and just want to use the local files in `tools/swagger-client-generator`, run:

```bash
tools/swagger-client-generator.sh .
```

To update the Swagger Client with the new API specifications, check out the
[generator tool README](https://github.com/DS4SD/deepsearch-toolkit/blob/main/tools/swagger-client-generator/README.md).
## Coding style guidelines
Expand Down
11 changes: 11 additions & 0 deletions tools/swagger-client-generator/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Swagger client generation

## Usage

**Note:** This requires Podman.

To update the Swagger Client with the new API specifications, run:

```bash
# go to repo root dir
cd $(git rev-parse --show-toplevel)
Expand All @@ -9,3 +14,9 @@ cd $(git rev-parse --show-toplevel)
# TODO: set base path as needed, as in "https://your-host/api/cps"
./tools/swagger-client-generator/generate-client.sh <BASE_PATH>
```

If you don't want to download the Swagger Specification, and just want to use the local files in `tools/swagger-client-generator`, run:

```bash
./tools/swagger-client-generator/generate-client.sh .
```
20 changes: 10 additions & 10 deletions tools/swagger-client-generator/generate-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ mkdir -p .generated/

echo "Generating client for CPS"

docker run --rm \
podman run --rm \
-v "$(pwd):/local" \
--user="$(id -u):$(id -g)" \
--userns=keep-id:uid="$(id -u)",gid="$(id -g)" \
${generator_image} generate \
-i "/local/tools/swagger-client-generator/swagger-cps.json" \
-g python \
Expand All @@ -44,9 +44,9 @@ docker run --rm \

echo "Generating client for the User API"

docker run --rm \
podman run --rm \
-v "$(pwd):/local" \
--user="$(id -u):$(id -g)" \
--userns=keep-id:uid="$(id -u)",gid="$(id -g)" \
${generator_image} generate \
-i "/local/tools/swagger-client-generator/swagger-user.json" \
-g python \
Expand All @@ -56,9 +56,9 @@ docker run --rm \
# echo "Generating client for the CPS KG API"
# echo "Currently disabled: TODO FIX API Specs"

# # docker run --rm \
# # podman run --rm \
# # -v "$(pwd):/local" \
# # --user="$(id -u):$(id -g)" \
# # --userns=keep-id:uid="$(id -u)",gid="$(id -g)" \
# # ${generator_image} generate \
# # -i "/local/tools/swagger-client-generator/swagger-cps-kg.json" \
# # -g python \
Expand All @@ -71,9 +71,9 @@ docker run --rm \
# echo "Generating client for the KG Query API"
# echo "Disabled since it generated wrong specs. It won't be updated."

# # docker run --rm \
# # podman run --rm \
# # -v "$(pwd):/local" \
# # --user="$(id -u):$(id -g)" \
# # --userns=keep-id:uid="$(id -u)",gid="$(id -g)" \
# # ${generator_image} generate \
# # -i "/local/tools/swagger-client-generator/swagger-kg-query.json" \
# # -g python \
Expand All @@ -85,9 +85,9 @@ docker run --rm \
# echo "Generating client for the KG Create API"
# echo "Disabled since it won't be updated."

# # docker run --rm \
# # podman run --rm \
# # -v "$(pwd):/local" \
# # --user="$(id -u):$(id -g)" \
# # --userns=keep-id:uid="$(id -u)",gid="$(id -g)" \
# # ${generator_image} generate \
# # -i "/local/tools/swagger-client-generator/swagger-kg-create.json" \
# # -g python \
Expand Down

0 comments on commit 79fe58a

Please sign in to comment.