9
9
from utils import list_files_in_api_specs
10
10
11
11
# Conventions
12
- _REQUIRED_FIELDS = ["error " , "data" ]
12
+ _REQUIRED_FIELDS = ["data " , ]
13
13
CONVERTED_SUFFIX = "-converted.yaml"
14
14
15
15
# TESTS ----------------------------------------------------------
20
20
if not pathstr .endswith (CONVERTED_SUFFIX ) ] # skip converted schemas
21
21
22
22
23
- @pytest .mark .skip (reason = "TODO: discuss with sanderegg" )
24
23
@pytest .mark .parametrize ("path" , non_converted_yamls )
25
24
def test_openapi_envelope_required_fields (path : str ):
26
25
with io .open (path ) as file_stream :
@@ -29,25 +28,9 @@ def test_openapi_envelope_required_fields(path: str):
29
28
if "Envelope" in key :
30
29
assert "required" in value , "field required is missing from {file}" .format (file = path )
31
30
required_fields = value ["required" ]
31
+
32
32
assert "properties" in value , "field properties is missing from {file}" .format (file = path )
33
33
fields_definitions = value ["properties" ]
34
- for field in _REQUIRED_FIELDS :
35
- assert field in required_fields , ("field {field} is missing in {file}" .format (field = field , file = path ))
36
- assert field in fields_definitions , ("field {field} is missing in {file}" .format (field = field , file = path ))
37
-
38
34
39
- @pytest .mark .skip (reason = "TODO: discuss with sanderegg" )
40
- @pytest .mark .parametrize ("path" , non_converted_yamls )
41
- def test_openapi_type_name (path : str ):
42
- with io .open (path ) as file_stream :
43
- oas_dict = yaml .safe_load (file_stream )
44
-
45
- for key , value in oas_dict .items ():
46
- if "Envelope" in key :
47
- assert "properties" in value , ("field properties is missing from {file}" .format (file = path ))
48
- fields_definitions = value ["properties" ]
49
- for field_key , field_value in fields_definitions .items ():
50
- data_values = field_value
51
- for data_key , data_value in data_values .items ():
52
- if "$ref" in data_key :
53
- assert str (data_value ).endswith ("Type" ), ("field {field} name is not finishing with Type in {file}" .format (field = field_key , file = path ))
35
+ assert 'error' in required_fields or 'data' in required_fields
36
+ assert 'error' in fields_definitions or 'data' in fields_definitions
0 commit comments