Skip to content

Commit f7ee9e2

Browse files
authored
Merge pull request #1829 from counterfact/copilot/move-openapi-example-to-fixtures
Move openapi-example.yaml to test/fixtures and flesh out with edge cases
2 parents b6917f6 + c9aab1e commit f7ee9e2

File tree

7 files changed

+2160
-192
lines changed

7 files changed

+2160
-192
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"counterfact": patch
3+
---
4+
5+
Moved `openapi-example.yaml` from the repository root into `test/fixtures/openapi-example.yaml` and expanded it with many OpenAPI edge cases: CRUD operations on `/users` and `/users/{userId}`, polymorphic events via `oneOf`/`allOf`/`discriminator`, nullable fields, enum types, integer formats, file upload via `multipart/form-data`, cookie parameters, deprecated endpoints, multiple response content types, a no-body `204` health-check endpoint, and free-form `additionalProperties` objects.

openapi-example.yaml

Lines changed: 0 additions & 128 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"lint:quickfix": "eslint --fix . eslint --fix demo-ts --rule=\"import/namespace: 0,etc/no-deprecated:0,import/no-cycle:0,no-explicit-type-exports/no-explicit-type-exports:0,import/no-deprecated:0,import/no-self-import:0,import/default:0,import/no-named-as-default:0\" --ignore-pattern dist --ignore-pattern out",
7777
"go:petstore": "yarn build && yarn counterfact https://petstore3.swagger.io/api/v3/openapi.json out",
7878
"go:petstore2": "yarn build && yarn counterfact https://petstore.swagger.io/v2/swagger.json out",
79-
"go:example": "yarn build && node ./bin/counterfact.js ./openapi-example.yaml out",
79+
"go:example": "yarn build && node ./bin/counterfact.js ./test/fixtures/openapi-example.yaml out",
8080
"counterfact": "./bin/counterfact.js",
8181
"postinstall": "patch-package"
8282
},

test/app.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe("handleMswRequest", () => {
6161
await (app as any).createMswHandlers(
6262
{
6363
...mockConfig,
64-
openApiPath: "openapi-example.yaml",
64+
openApiPath: "test/fixtures/openapi-example.yaml",
6565
},
6666
MockModuleLoader,
6767
);
@@ -120,7 +120,7 @@ describe("createMswHandlers", () => {
120120
const handlers = await (app as any).createMswHandlers(
121121
{
122122
...mockConfig,
123-
openApiPath: "openapi-example.yaml",
123+
openApiPath: "test/fixtures/openapi-example.yaml",
124124
},
125125
MockModuleLoader,
126126
);

0 commit comments

Comments
 (0)