Skip to content

Commit

Permalink
Merge pull request #36 from mike-oakley/u/mike/maintenance
Browse files Browse the repository at this point in the history
chore: Update dependencies to resolve security advisories.
  • Loading branch information
mike-oakley authored Jun 15, 2024
2 parents 3623532 + 1783927 commit 139d792
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 460 deletions.
3 changes: 1 addition & 2 deletions openapi_pydantic/v3/v3_0_3/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,7 @@ def schema_validate(
strict: Optional[bool] = None,
from_attributes: Optional[bool] = None,
context: Optional[Dict[str, Any]] = None
) -> Schema:
...
) -> Schema: ...

elif PYDANTIC_V2:
schema_validate = Schema.model_validate
Expand Down
6 changes: 2 additions & 4 deletions openapi_pydantic/v3/v3_0_3/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def get_mode(

if TYPE_CHECKING:

class GenerateOpenAPI30Schema:
...
class GenerateOpenAPI30Schema: ...

elif PYDANTIC_V2:
from enum import Enum
Expand Down Expand Up @@ -111,8 +110,7 @@ def literal_schema(self, schema: core_schema.LiteralSchema) -> JsonSchemaValue:

else:

class GenerateOpenAPI30Schema:
...
class GenerateOpenAPI30Schema: ...


def construct_open_api_with_schema_class(
Expand Down
3 changes: 1 addition & 2 deletions openapi_pydantic/v3/v3_1_0/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,7 @@ def schema_validate(
strict: Optional[bool] = None,
from_attributes: Optional[bool] = None,
context: Optional[Dict[str, Any]] = None
) -> Schema:
...
) -> Schema: ...

elif PYDANTIC_V2:
schema_validate = Schema.model_validate
Expand Down
831 changes: 395 additions & 436 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openapi-pydantic"
version = "0.4.0"
version = "0.4.1"
description = "Pydantic OpenAPI schema implementation"
authors = ["Mike Oakley <mike-oakley@users.noreply.github.com>"]
readme = "README.md"
Expand All @@ -26,15 +26,15 @@ python = "^3.8"
pydantic = ">=1.8"

[tool.poetry.group.test.dependencies]
pytest = "^7.3.0"
pytest-cov = "^4.0.0"
pytest = "^8.2.2"
pytest-cov = "^5.0.0"
openapi-spec-validator = "^0.7.0"

[tool.poetry.group.dev.dependencies]
black = "^23.12.1"
black = "^24.4.2"
mypy = "^1.8.0"
pre-commit = "^2.16.0"
ruff = "^0.1.9"
ruff = "^0.4.8"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
3 changes: 1 addition & 2 deletions tests/util/test_optional_and_computed.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ def construct_sample_api() -> OpenAPI:

if TYPE_CHECKING:

def computed_field(x: Callable) -> Callable:
...
def computed_field(x: Callable) -> Callable: ...

else:
from pydantic import computed_field
Expand Down
13 changes: 6 additions & 7 deletions tests/util/test_pydantic_field.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, Union
from typing import Union

from pydantic import BaseModel, Field
from typing_extensions import Literal
Expand Down Expand Up @@ -59,17 +59,16 @@ def construct_base_open_api() -> OpenAPI:
def test_pydantic_discriminator_schema_generation() -> None:
"""https://github.com/kuimono/openapi-schema-pydantic/issues/8"""

a_kind: Dict[str, Any]
b_kind: Dict[str, Any]
a_kind = {"const": "a", "enum": ["a"], "title": "Kind", "type": "string"}
b_kind = {"const": "b", "enum": ["b"], "title": "Kind", "type": "string"}

if PYDANTIC_V2:
_key_map, json_schema = models_json_schema([(RequestModel, "validation")])
a_kind = {"const": "a", "title": "Kind"}
b_kind = {"const": "b", "title": "Kind"}
else:
json_schema = v1_schema([RequestModel])
a_kind = {"enum": ["a"], "title": "Kind", "type": "string"}
b_kind = {"enum": ["b"], "title": "Kind", "type": "string"}
a_kind.pop("const")
b_kind.pop("const")

assert json_schema == {
DEFS_KEY: {
"DataAModel": {
Expand Down
3 changes: 1 addition & 2 deletions tests/v3_0_3/test_optional_and_computed.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def construct_sample_api() -> OpenAPI:

if TYPE_CHECKING:

def computed_field(x: Callable) -> Callable:
...
def computed_field(x: Callable) -> Callable: ...

else:
from pydantic import computed_field
Expand Down

0 comments on commit 139d792

Please sign in to comment.