Skip to content

Commit 1ce46a0

Browse files
committed
3.1 Schema: Remove submodule
1 parent b5bf761 commit 1ce46a0

18 files changed

+193
-14
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "tests/v3.1/openapi3-examples"]
2-
path = tests/openapi3-examples
3-
url = [email protected]:Mermade/openapi3-examples.git

scripts/validate.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ const args = process.argv.reduce((acc, arg) => {
2424

2525
(async function () {
2626
try {
27+
const schemaType = args.schema || "schema";
28+
const schemaVersion = args.version || "2021-03-02";
29+
const outputFormat = args.format || JsonSchema.BASIC;
30+
2731
// Config
2832
JsonSchema.setMetaOutputFormat(outputFormat);
2933
//JsonSchema.setShouldMetaValidate(false);
3034

31-
const schemaType = args.schema || "schema";
32-
const schemaVersion = args.version || "2021-03-02";
33-
const ouputFormat = args.format || JsonSchema.BASIC;
34-
3535
// Load schemas
3636
JsonSchema.add(dialect);
3737
JsonSchema.add(vocabulary);

tests/openapi3-examples

-1
This file was deleted.

tests/v3.1/fail/no_containers.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
iopenapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0

tests/v3.1/fail/sever_enum_empty.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
servers:
6+
- url: https://example.com/{var}
7+
variables:
8+
var:
9+
enum: []
10+
default: a
11+
components: {}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
servers:
6+
- url: https://example.com/{var}
7+
variables:
8+
var:
9+
enum:
10+
- a
11+
default: b
12+
components: {}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
overlays: {}

tests/v3.1/pass/comp_pathitems.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
components:
6+
pathItems: {}

tests/v3.1/pass/info_summary.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
summary: My lovely API
5+
version: 1.0.0
6+
components: {}
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
summary: My lovely API
5+
version: 1.0.0
6+
license:
7+
name: Apache
8+
identifier: Apache-2.0
9+
components: {}

tests/v3.1/pass/mega.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
openapi: 3.1.0
2+
info:
3+
summary: My API's summary
4+
title: My API
5+
version: 1.0.0
6+
license:
7+
name: Apache 2.0
8+
identifier: Apache-2.0
9+
jsonSchemaDialect: https://spec.openapis.org/oas/3.1/dialect/base
10+
paths:
11+
/:
12+
get:
13+
parameters: []
14+
/{pathTest}: {}
15+
webhooks:
16+
myWebhook:
17+
$ref: '#/components/pathItems/myPathItem'
18+
description: Overriding description
19+
components:
20+
securitySchemes:
21+
mtls:
22+
type: mutualTLS
23+
pathItems:
24+
myPathItem:
25+
post:
26+
requestBody:
27+
required: true
28+
content:
29+
'application/json':
30+
schema:
31+
type: object
32+
properties:
33+
type:
34+
type: string
35+
int:
36+
type: integer
37+
exclusiveMaximum: 100
38+
exclusiveMinimum: 0
39+
none:
40+
type: 'null'
41+
arr:
42+
type: array
43+
$comment: Array without items keyword
44+
either:
45+
type: ['string','null']
46+
discriminator:
47+
propertyName: type
48+
x-extension: true
49+
myArbitraryKeyword: true

tests/v3.1/pass/minimal_comp.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
components: {}

tests/v3.1/pass/minimal_hooks.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
webhooks: {}

tests/v3.1/pass/minimal_paths.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
paths: {}

tests/v3.1/pass/path_no_response.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
paths:
6+
/:
7+
get: {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
paths:
6+
/{var}: {}

tests/v3.1/pass/schema.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
openapi: 3.1.0
2+
info:
3+
title: API
4+
version: 1.0.0
5+
paths: {}
6+
components:
7+
schemas:
8+
model:
9+
type: object
10+
properties:
11+
one:
12+
description: type array
13+
type:
14+
- integer
15+
- string
16+
two:
17+
description: type 'null'
18+
type: "null"
19+
three:
20+
description: type array including 'null'
21+
type:
22+
- string
23+
- "null"
24+
four:
25+
description: array with no items
26+
type: array
27+
five:
28+
description: singular example
29+
type: string
30+
examples:
31+
- exampleValue
32+
six:
33+
description: exclusiveMinimum true
34+
exclusiveMinimum: 10
35+
seven:
36+
description: exclusiveMinimum false
37+
minimum: 10
38+
eight:
39+
description: exclusiveMaximum true
40+
exclusiveMaximum: 20
41+
nine:
42+
description: exclusiveMaximum false
43+
maximum: 20
44+
ten:
45+
description: nullable string
46+
type:
47+
- string
48+
- "null"
49+
eleven:
50+
description: x-nullable string
51+
type:
52+
- string
53+
- "null"
54+
twelve:
55+
description: file/binary

tests/v3.1/test.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ const dialect = require("../../schemas/v3.1/dialect/base.schema.json");
66
const vocabulary = require("../../schemas/v3.1/meta/base.schema.json");
77

88

9-
const testSuitePath = `${__dirname}/../openapi3-examples/3.1`;
10-
119
JsonSchema.setMetaOutputFormat(JsonSchema.BASIC);
1210
//JsonSchema.setShouldMetaValidate(false);
1311

@@ -20,10 +18,10 @@ before(async () => {
2018
});
2119

2220
describe("Pass", () => {
23-
fs.readdirSync(`${testSuitePath}/pass`, { withFileTypes: true })
21+
fs.readdirSync(`${__dirname}/pass`, { withFileTypes: true })
2422
.filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name))
2523
.forEach((entry) => {
26-
const file = `${testSuitePath}/pass/${entry.name}`;
24+
const file = `${__dirname}/pass/${entry.name}`;
2725

2826
it(entry.name, async () => {
2927
const instance = yaml.parse(fs.readFileSync(file, "utf8"));
@@ -35,10 +33,10 @@ describe("Pass", () => {
3533
});
3634

3735
describe("Fail", () => {
38-
fs.readdirSync(`${testSuitePath}/fail`, { withFileTypes: true })
36+
fs.readdirSync(`${__dirname}/fail`, { withFileTypes: true })
3937
.filter((entry) => entry.isFile() && /\.yaml$/.test(entry.name))
4038
.forEach((entry) => {
41-
const file = `${testSuitePath}/fail/${entry.name}`;
39+
const file = `${__dirname}/fail/${entry.name}`;
4240

4341
it(entry.name, async () => {
4442
const instance = yaml.parse(fs.readFileSync(file, "utf8"));

0 commit comments

Comments
 (0)