Skip to content

Commit 847e6df

Browse files
committed
Update test suite 2
1 parent c484e9f commit 847e6df

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

tests/test_suite.py

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
This module integrates the external test suite from
55
https://github.com/python-openapi/openapi-schema-test-suite
6-
to validate OAS 3.1 and OAS 3.2 schema validators against
6+
to validate OAS 3.0, OAS 3.1 and OAS 3.2 schema validators against
77
the canonical test cases.
88
"""
99

@@ -14,8 +14,10 @@
1414
import pytest
1515
from jsonschema.exceptions import ValidationError
1616

17+
from openapi_schema_validator import OAS30Validator
1718
from openapi_schema_validator import OAS31Validator
1819
from openapi_schema_validator import OAS32Validator
20+
from openapi_schema_validator import oas30_format_checker
1921
from openapi_schema_validator import oas31_format_checker
2022
from openapi_schema_validator import oas32_format_checker
2123

@@ -28,6 +30,18 @@
2830

2931
# Each entry is (dialect, relative_path, case_description, test_description).
3032
_KNOWN_FAILURES: dict[tuple[str, str, str, str], str] = {
33+
(
34+
"oas30",
35+
"optional/format/format-assertion.json",
36+
"format uri with assertion",
37+
"a relative URI is not a valid URI",
38+
): "uri format checker does not validate RFC 3986 absolute-URI requirement",
39+
(
40+
"oas30",
41+
"optional/format/format-assertion.json",
42+
"format uri with assertion",
43+
"an invalid URI is not valid",
44+
): "uri format checker does not validate RFC 3986 absolute-URI requirement",
3145
(
3246
"oas31",
3347
"optional/format/format-assertion.json",
@@ -52,9 +66,49 @@
5266
"format uri with assertion",
5367
"an invalid URI is not valid",
5468
): "uri format checker does not validate RFC 3986 absolute-URI requirement",
69+
(
70+
"oas30",
71+
"discriminator.json",
72+
"discriminator as annotation",
73+
"a cat object is valid",
74+
): "discriminator not fully supported in base oas30",
75+
(
76+
"oas30",
77+
"discriminator.json",
78+
"discriminator as annotation",
79+
"a dog object is valid",
80+
): "discriminator not fully supported in base oas30",
81+
(
82+
"oas30",
83+
"discriminator.json",
84+
"discriminator with mapping",
85+
"a car object is valid",
86+
): "discriminator mapping",
87+
(
88+
"oas30",
89+
"discriminator.json",
90+
"discriminator with mapping",
91+
"a truck object is valid",
92+
): "discriminator mapping",
93+
(
94+
"oas30",
95+
"ref.json",
96+
"$ref sibling keywords are ignored",
97+
"a short string is valid because minLength sibling is ignored",
98+
): "we do not ignore sibling keywords in oas30",
99+
(
100+
"oas30",
101+
"type.json",
102+
"integer type matches integers",
103+
"a float with zero fractional part is an integer",
104+
): "float with zero fractional part",
55105
}
56106

57107
_DIALECT_CONFIG: dict[str, dict[str, Any]] = {
108+
"oas30": {
109+
"validator_class": OAS30Validator,
110+
"format_checker": oas30_format_checker,
111+
},
58112
"oas31": {
59113
"validator_class": OAS31Validator,
60114
"format_checker": oas31_format_checker,

0 commit comments

Comments
 (0)