Skip to content

Commit 286fd06

Browse files
committed
CI fixes
1 parent e052eb2 commit 286fd06

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
test:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v6
8+
- uses: actions/checkout@v7
99
- name: Set up JDK
1010
uses: actions/setup-java@v5
1111
with:
@@ -15,7 +15,8 @@ jobs:
1515
run: mvn clean install
1616
- name: Test Generated Petstore Clients
1717
run: |
18-
curl -sL "https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml" | npx swagger-cli bundle -t json > petstore_oas3.json
18+
curl -sL "https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml" > petstore_raw.yaml
19+
npx swagger-cli bundle petstore_raw.yaml -t json > petstore_oas3.json
1920
curl -sL "https://petstore.swagger.io/v2/swagger.json" > petstore.json
2021
python3 scripts/test_petstore.py v2 petstore.json
2122
python3 scripts/test_petstore.py v3 petstore_oas3.json
@@ -32,7 +33,7 @@ jobs:
3233
contents: write
3334
packages: write
3435
steps:
35-
- uses: actions/checkout@v6
36+
- uses: actions/checkout@v7
3637

3738
- name: Set up JDK
3839
uses: actions/setup-java@v5

scripts/test_generated_server.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
version = sys.argv[1]
1313
json_file = sys.argv[2]
1414

15+
if not os.path.exists(json_file):
16+
print(f"{json_file} not found. Attempting to download...")
17+
if version == "v2":
18+
subprocess.run(["curl", "-sL", "https://petstore.swagger.io/v2/swagger.json", "-o", json_file], check=True)
19+
elif version == "v3":
20+
subprocess.run(["curl", "-sL", "https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml", "-o", "petstore_raw.yaml"], check=True)
21+
subprocess.run(["npx", "swagger-cli", "bundle", "petstore_raw.yaml", "-t", "json"], stdout=open(json_file, "w"), check=True)
22+
1523
server_dir = f"../cdd-java-server-{version}"
1624

1725
if os.path.exists(server_dir):

scripts/test_petstore.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
version = sys.argv[1]
1515
json_file = sys.argv[2]
1616

17+
if not os.path.exists(json_file):
18+
print(f"{json_file} not found. Attempting to download...")
19+
if version == "v2":
20+
subprocess.run(["curl", "-sL", "https://petstore.swagger.io/v2/swagger.json", "-o", json_file], check=True)
21+
elif version == "v3":
22+
subprocess.run(["curl", "-sL", "https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml", "-o", "petstore_raw.yaml"], check=True)
23+
subprocess.run(["npx", "swagger-cli", "bundle", "petstore_raw.yaml", "-t", "json"], stdout=open(json_file, "w"), check=True)
24+
1725
client_dir = f"../cdd-java-client-{version}"
1826

1927
if os.path.exists(client_dir):

src/main/java/cli/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* CLI Entrypoint.
55
*/
6-
@cli.Generated
6+
77
public class Main {
88

99
/**

0 commit comments

Comments
 (0)