Skip to content

Commit 1dad737

Browse files
committed
full keyword and line coverage
uncovered properties
1 parent 87f87f6 commit 1dad737

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

tests/schema/pass/link-object-examples.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ paths:
4545
operationRef: https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1%7Busername%7D/get
4646
parameters:
4747
username: $response.body#/username
48+
withBody:
49+
operationId: queryUserWithBody
50+
requestBody:
51+
userId: $request.path.id
4852
# the path item of the linked operation
4953
/users/{userid}/address:
5054
parameters:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
openapi: 3.2.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
paths:
6+
/user:
7+
parameters:
8+
- in: query
9+
name: example
10+
schema:
11+
# Allow an arbitrary JSON object to keep
12+
# the example simple
13+
type: object
14+
# DEPRECATED: don't use example keyword inside Schema Object
15+
example: {
16+
"numbers": [1, 2],
17+
"flag": null
18+
}

tests/schema/schema.test.mjs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,25 @@ await registerOasSchema();
1313
await registerSchema("./src/schemas/validation/schema.yaml");
1414
const fixtures = './tests/schema';
1515

16-
describe("v3.1", () => {
16+
describe("v3.2", () => {
17+
test("schema.yaml schema test", async () => {
18+
// Files in the pass/fail folders get run against schema-base.yaml.
19+
// This instance is instead run against schema.yaml.
20+
const oad = {
21+
openapi: "3.2.0",
22+
info: {
23+
title: "API",
24+
version: "1.0.0"
25+
},
26+
components: {
27+
schemas: {
28+
foo: {}
29+
}
30+
}
31+
};
32+
await expect(oad).to.matchJsonSchema("./src/schemas/validation/schema.yaml"); // <-- "schema.yaml" instead of "schema-base.yaml"
33+
});
34+
1735
describe("Pass", () => {
1836
readdirSync(`${fixtures}/pass`, { withFileTypes: true })
1937
.filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name))

0 commit comments

Comments
 (0)