Schema-First 0.14.2__tar.gz → 0.14.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {schema_first-0.14.2 → schema_first-0.14.3}/PKG-INFO +1 -1
- {schema_first-0.14.2 → schema_first-0.14.3}/pyproject.toml +4 -1
- {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/PKG-INFO +1 -1
- schema_first-0.14.3/src/schema_first/__init__.py +3 -0
- schema_first-0.14.3/src/schema_first/loaders/__init__.py +3 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/loaders/exc.py +1 -1
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/loaders/yaml_loader.py +2 -2
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/__init__.py +3 -3
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/base.py +1 -1
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/specification/spilli_api.py +15 -14
- schema_first-0.14.2/src/schema_first/__init__.py +0 -3
- schema_first-0.14.2/src/schema_first/loaders/__init__.py +0 -3
- {schema_first-0.14.2 → schema_first-0.14.3}/README.md +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/setup.cfg +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/SOURCES.txt +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/dependency_links.txt +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/requires.txt +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/top_level.txt +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/exceptions.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/exc.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/__init__.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/constants.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/custom_fields.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/fields.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/components_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/contact_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/example_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/external_docs_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/header_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/info_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/license_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/media_type_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/openapi_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/operation_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/parameter_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/path_item_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/reference_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/request_body_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/responses_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/schema_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/security_scheme_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/server_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/server_variable_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/tag_object_schema.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/validators.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/specification/__init__.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/tests/test_specification.py +0 -0
- {schema_first-0.14.2 → schema_first-0.14.3}/tests/test_validator.py +0 -0
|
@@ -20,7 +20,7 @@ license-files = ["LICENSE.txt"]
|
|
|
20
20
|
name = "Schema-First"
|
|
21
21
|
readme = "README.md"
|
|
22
22
|
requires-python = ">=3.14"
|
|
23
|
-
version = "0.14.
|
|
23
|
+
version = "0.14.3"
|
|
24
24
|
|
|
25
25
|
[project.optional-dependencies]
|
|
26
26
|
dev = [
|
|
@@ -38,6 +38,9 @@ dev = [
|
|
|
38
38
|
changelog = "https://github.com/flask-pro/schema-first/blob/master/CHANGES.md"
|
|
39
39
|
repository = "https://github.com/flask-pro/schema-first"
|
|
40
40
|
|
|
41
|
+
[tool.bandit]
|
|
42
|
+
exclude_dirs = ["tests"]
|
|
43
|
+
|
|
41
44
|
[tool.black]
|
|
42
45
|
extend-exclude = '''
|
|
43
46
|
# A regex preceded with ^/ will apply only to files and directories
|
|
@@ -3,9 +3,9 @@ from pprint import pformat
|
|
|
3
3
|
|
|
4
4
|
from marshmallow import ValidationError
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from .exc import OpenAPIValidationError
|
|
8
|
-
from .schemas.v3_2.openapi_object_schema import OpenAPIObjectSchema
|
|
6
|
+
from schema_first.loaders.yaml_loader import load_from_yaml
|
|
7
|
+
from schema_first.openapi.exc import OpenAPIValidationError
|
|
8
|
+
from schema_first.openapi.schemas.v3_2.openapi_object_schema import OpenAPIObjectSchema
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class OpenAPI:
|
|
@@ -15,7 +15,7 @@ class BaseSchema(Schema):
|
|
|
15
15
|
def validate_ref(self, data, **kwargs) -> None:
|
|
16
16
|
if 'ref' in data:
|
|
17
17
|
ALLOWED_FIELDS = {'ref', 'description', 'summary'}
|
|
18
|
-
ALL_FIELDS = set(data
|
|
18
|
+
ALL_FIELDS = set(data)
|
|
19
19
|
if ALL_FIELDS.difference(ALLOWED_FIELDS):
|
|
20
20
|
raise ValidationError(
|
|
21
21
|
f"If there is a <'ref'> field, then only <{ALLOWED_FIELDS}>,"
|
|
@@ -11,10 +11,7 @@ class ConverterOpenAPIToSpilliAPI:
|
|
|
11
11
|
def _convert_params_to_schema(
|
|
12
12
|
self, params: list[dict], place: t.Literal['header', 'cookie', 'path', 'query']
|
|
13
13
|
) -> Any | None:
|
|
14
|
-
schema = {
|
|
15
|
-
'type': 'object',
|
|
16
|
-
'additionalProperties': True,
|
|
17
|
-
}
|
|
14
|
+
schema = {'type': 'object', 'additionalProperties': True}
|
|
18
15
|
|
|
19
16
|
required = []
|
|
20
17
|
properties = {}
|
|
@@ -47,18 +44,22 @@ class ConverterOpenAPIToSpilliAPI:
|
|
|
47
44
|
|
|
48
45
|
return params_as_dict
|
|
49
46
|
|
|
50
|
-
def
|
|
51
|
-
self.spilli_api_spec = json.loads(json.dumps(self.open_api_spec))
|
|
52
|
-
|
|
47
|
+
def _convert_method_params(self) -> None:
|
|
53
48
|
for _, methods in self.spilli_api_spec['paths'].items():
|
|
54
|
-
common_params = []
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
common_params = methods.pop('parameters', [])
|
|
50
|
+
|
|
51
|
+
for method, operation_obj in methods.items():
|
|
52
|
+
if method in ('summary', 'description', 'servers'):
|
|
53
|
+
continue
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
operation_obj['parameters'] = self._params_list_to_dict(
|
|
55
|
+
method_params = operation_obj.get('parameters', [])
|
|
56
|
+
all_method_params = common_params + method_params
|
|
57
|
+
if all_method_params:
|
|
58
|
+
operation_obj['parameters'] = self._params_list_to_dict(all_method_params)
|
|
59
|
+
|
|
60
|
+
def _make_to_spilli_api_format(self) -> None:
|
|
61
|
+
self.spilli_api_spec = json.loads(json.dumps(self.open_api_spec))
|
|
62
|
+
self._convert_method_params()
|
|
62
63
|
|
|
63
64
|
def convert(self) -> dict:
|
|
64
65
|
self._make_to_spilli_api_format()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/custom_fields.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|