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.
Files changed (48) hide show
  1. {schema_first-0.14.2 → schema_first-0.14.3}/PKG-INFO +1 -1
  2. {schema_first-0.14.2 → schema_first-0.14.3}/pyproject.toml +4 -1
  3. {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/PKG-INFO +1 -1
  4. schema_first-0.14.3/src/schema_first/__init__.py +3 -0
  5. schema_first-0.14.3/src/schema_first/loaders/__init__.py +3 -0
  6. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/loaders/exc.py +1 -1
  7. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/loaders/yaml_loader.py +2 -2
  8. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/__init__.py +3 -3
  9. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/base.py +1 -1
  10. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/specification/spilli_api.py +15 -14
  11. schema_first-0.14.2/src/schema_first/__init__.py +0 -3
  12. schema_first-0.14.2/src/schema_first/loaders/__init__.py +0 -3
  13. {schema_first-0.14.2 → schema_first-0.14.3}/README.md +0 -0
  14. {schema_first-0.14.2 → schema_first-0.14.3}/setup.cfg +0 -0
  15. {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/SOURCES.txt +0 -0
  16. {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/dependency_links.txt +0 -0
  17. {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/requires.txt +0 -0
  18. {schema_first-0.14.2 → schema_first-0.14.3}/src/Schema_First.egg-info/top_level.txt +0 -0
  19. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/exceptions.py +0 -0
  20. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/exc.py +0 -0
  21. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/__init__.py +0 -0
  22. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/constants.py +0 -0
  23. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/custom_fields.py +0 -0
  24. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/fields.py +0 -0
  25. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/components_object_schema.py +0 -0
  26. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/contact_object_schema.py +0 -0
  27. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/example_object_schema.py +0 -0
  28. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/external_docs_object_schema.py +0 -0
  29. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/header_object_schema.py +0 -0
  30. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/info_object_schema.py +0 -0
  31. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/license_object_schema.py +0 -0
  32. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/media_type_object_schema.py +0 -0
  33. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/openapi_object_schema.py +0 -0
  34. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/operation_object_schema.py +0 -0
  35. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/parameter_object_schema.py +0 -0
  36. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/path_item_object_schema.py +0 -0
  37. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/reference_object_schema.py +0 -0
  38. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/request_body_object_schema.py +0 -0
  39. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/responses_object_schema.py +0 -0
  40. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/schema_object_schema.py +0 -0
  41. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/security_scheme_object_schema.py +0 -0
  42. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/server_object_schema.py +0 -0
  43. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/server_variable_object_schema.py +0 -0
  44. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/v3_2/tag_object_schema.py +0 -0
  45. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/openapi/schemas/validators.py +0 -0
  46. {schema_first-0.14.2 → schema_first-0.14.3}/src/schema_first/specification/__init__.py +0 -0
  47. {schema_first-0.14.2 → schema_first-0.14.3}/tests/test_specification.py +0 -0
  48. {schema_first-0.14.2 → schema_first-0.14.3}/tests/test_validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Schema-First
3
- Version: 0.14.2
3
+ Version: 0.14.3
4
4
  Summary: OpenAPI specification validator and converter to Marshmallow schemas.
5
5
  Author-email: Konstantin Fadeev <jredkiy@yandex.ru>
6
6
  License-Expression: LGPL-2.1-only
@@ -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.2"
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Schema-First
3
- Version: 0.14.2
3
+ Version: 0.14.3
4
4
  Summary: OpenAPI specification validator and converter to Marshmallow schemas.
5
5
  Author-email: Konstantin Fadeev <jredkiy@yandex.ru>
6
6
  License-Expression: LGPL-2.1-only
@@ -0,0 +1,3 @@
1
+ from schema_first.specification import Specification
2
+
3
+ __all__ = ['Specification']
@@ -0,0 +1,3 @@
1
+ from schema_first.loaders.yaml_loader import load_from_yaml
2
+
3
+ __all__ = ['load_from_yaml']
@@ -1,4 +1,4 @@
1
- from ..exceptions import SchemaFirstException
1
+ from schema_first.exceptions import SchemaFirstException
2
2
 
3
3
 
4
4
  class YAMLReaderError(SchemaFirstException):
@@ -6,8 +6,8 @@ from typing import Any
6
6
 
7
7
  import yaml
8
8
 
9
- from .exc import ResolverError
10
- from .exc import YAMLReaderError
9
+ from schema_first.loaders.exc import ResolverError
10
+ from schema_first.loaders.exc import YAMLReaderError
11
11
 
12
12
 
13
13
  class YAMLReader:
@@ -3,9 +3,9 @@ from pprint import pformat
3
3
 
4
4
  from marshmallow import ValidationError
5
5
 
6
- from ..loaders.yaml_loader import load_from_yaml
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.keys())
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 _make_to_spilli_api_format(self) -> None:
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
- if 'parameters' in methods:
56
- common_params = methods.pop('parameters', [])
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
- for _, operation_obj in methods.items():
59
- if 'parameters' in operation_obj:
60
- method_params = common_params + operation_obj.pop('parameters', [])
61
- operation_obj['parameters'] = self._params_list_to_dict(method_params)
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()
@@ -1,3 +0,0 @@
1
- from .specification import Specification
2
-
3
- __all__ = ['Specification']
@@ -1,3 +0,0 @@
1
- from .yaml_loader import load_from_yaml
2
-
3
- __all__ = ['load_from_yaml']
File without changes
File without changes