11#! /usr/bin/env sh
22set -e
33
4+ unset DATABASE_URL
5+
46echo " Running Auto-Code-Format Fix..."
57npm run format || true
68git add -u
@@ -95,7 +97,7 @@ if [ "$USE_PRISM" -eq 0 ]; then
9597 echo " JVM server is ready."
9698 cat << 'EOF ' > test-sdks.ts
9799import { StoreClient as SwaggerStoreClient } from './.test_out_swagger/dist/services/store.client.js';
98- import { StoreClient as OpenApiStoreClient } from './.test_out_openapi/dist/services/store .client.js';
100+ import { PetsClient as OpenApiPetsClient } from './.test_out_openapi/dist/services/pets .client.js';
99101
100102async function run() {
101103 console.log("Testing Swagger 2.0 SDK against JVM Server...");
@@ -104,8 +106,8 @@ async function run() {
104106 console.log("Swagger 2.0 OK");
105107
106108 console.log("Testing OpenAPI 3.0 SDK against JVM Server...");
107- const openapiClient = new OpenApiStoreClient ('http://127.0.0.1:8080/api ');
108- await openapiClient.getInventory({ headers: { api_key: 'special-key' } } );
109+ const openapiClient = new OpenApiPetsClient ('http://127.0.0.1:8080/v1 ');
110+ await openapiClient.listPets( );
109111 console.log("OpenAPI 3.0 OK");
110112}
111113run().catch(e => { console.error(e); process.exit(1); });
@@ -135,7 +137,7 @@ if [ "$USE_PRISM" -eq 1 ]; then
135137
136138 cat << 'EOF ' > test-sdks.ts
137139import { StoreClient as SwaggerStoreClient } from './.test_out_swagger/dist/services/store.client.js';
138- import { StoreClient as OpenApiStoreClient } from './.test_out_openapi/dist/services/store .client.js';
140+ import { PetsClient as OpenApiPetsClient } from './.test_out_openapi/dist/services/pets .client.js';
139141
140142async function run() {
141143 console.log("Testing Swagger 2.0 SDK against fallback mock...");
@@ -144,8 +146,8 @@ async function run() {
144146 console.log("Swagger 2.0 OK");
145147
146148 console.log("Testing OpenAPI 3.0 SDK against fallback mock...");
147- const openapiClient = new OpenApiStoreClient ('http://127.0.0.1:4011');
148- await openapiClient.getInventory({ headers: { api_key: 'special-key' } } );
149+ const openapiClient = new OpenApiPetsClient ('http://127.0.0.1:4011');
150+ await openapiClient.listPets( );
149151 console.log("OpenAPI 3.0 OK");
150152}
151153run().catch(e => { console.error(e); process.exit(1); });
@@ -164,7 +166,7 @@ SERVER_OAS3_PID=$!
164166
165167echo " Waiting for generated servers to start..."
166168for i in {1..30}; do
167- if curl -s http://127.0.0.1:4020/user > /dev/null && curl -s http://127.0.0.1:4021/user > /dev/null; then
169+ if curl -s http://127.0.0.1:4020/user > /dev/null && curl -s http://127.0.0.1:4021/pet > /dev/null; then
168170 echo " Servers are up!"
169171 break
170172 fi
173175
174176cat << 'EOF ' > test-generated-servers.ts
175177import { UserClient as SwaggerUserClient } from './.test_out_swagger/dist/services/user.client.js';
176- import { UserClient as OpenApiUserClient } from './.test_out_openapi/dist/services/user.client.js';
177178
178179async function run() {
179180 console.log("Testing Swagger 2.0 SDK against Generated Swagger Server...");
@@ -197,8 +198,8 @@ async function run() {
197198
198199 console.log("Testing OpenAPI 3.0 SDK against Generated OpenAPI Server...");
199200 // Fallback to fetch just to prove the DB and routing are alive if the SDK mismatches
200- const res = await fetch('http://127.0.0.1:4021/user ');
201- if (!res.ok) throw new Error("Generated OpenAPI server failed to respond to GET /user ");
201+ const res = await fetch('http://127.0.0.1:4021/pet ');
202+ if (!res.ok) throw new Error("Generated OpenAPI server failed to respond to GET /pet ");
202203 const data = await res.json();
203204 if (!Array.isArray(data) || data.length === 0) throw new Error("Generated OpenAPI server did not seed data");
204205 console.log("OpenAPI 3.0 Generated Server OK (Seeded " + data.length + " users)");
0 commit comments