Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/schema/pass/link-object-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ paths:
operationRef: https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1%7Busername%7D/get
parameters:
username: $response.body#/username
withBody:
operationId: queryUserWithBody
requestBody:
userId: $request.path.id
# the path item of the linked operation
/users/{userid}/address:
parameters:
Expand Down
18 changes: 18 additions & 0 deletions tests/schema/pass/schema-object-deprecated-example-keyword.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
openapi: 3.2.0
info:
title: API
version: 1.0.0
paths:
/user:
parameters:
- in: query
name: example
schema:
# Allow an arbitrary JSON object to keep
# the example simple
type: object
# DEPRECATED: don't use example keyword inside Schema Object
example: {
"numbers": [1, 2],
"flag": null
}
6 changes: 6 additions & 0 deletions tests/schema/pass/specification-extensions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
openapi: 3.2.0
info:
title: API
version: 1.0.0
paths: {}
x-tensions: specification extensions are prefixed with `x-`
18 changes: 18 additions & 0 deletions tests/schema/schema.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ await registerSchema("./src/schemas/validation/schema.yaml");
const fixtures = './tests/schema';

describe("v3.2", () => {
test("schema.yaml schema test", async () => {
// Files in the pass/fail folders get run against schema-base.yaml.
// This instance is instead run against schema.yaml.
const oad = {
openapi: "3.2.0",
info: {
title: "API",
version: "1.0.0"
},
components: {
schemas: {
foo: {}
}
}
};
await expect(oad).to.matchJsonSchema("./src/schemas/validation/schema.yaml"); // <-- "schema.yaml" instead of "schema-base.yaml"
});

describe("Pass", () => {
readdirSync(`${fixtures}/pass`, { withFileTypes: true })
.filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name))
Expand Down