Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes during porting raster-service to pydantic 2 #28

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion clean_python/base/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
from .repository import * # NOQA
from .root_entity import * # NOQA
from .types import * # NOQA
from .value import * # NOQA
from .value_object import * # NOQA
5 changes: 3 additions & 2 deletions clean_python/base/presentation/link.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# (c) Nelen & Schuurmans

from typing import TypedDict

from pydantic import AnyHttpUrl

from ..domain import ValueObject

__all__ = ["Link"]


class Link(TypedDict):
class Link(ValueObject):
href: AnyHttpUrl
2 changes: 1 addition & 1 deletion clean_python/celery/celery_rmq_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CeleryRmqBroker(Gateway):
def __init__(
self, broker_url: AnyUrl, queue: str, origin: str, declare_queue: bool = False
):
self._parameters = pika.URLParameters(broker_url)
self._parameters = pika.URLParameters(str(broker_url))
self._queue = queue
self._origin = origin
self._declare_queue = declare_queue
Expand Down
4 changes: 2 additions & 2 deletions clean_python/fastapi/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class OAuth2SPAClientSchema(OAuth2AuthorizationCodeBearer):

def __init__(self, client: OAuth2SPAClientSettings):
super().__init__(
scheme_name="OAuth2 Authorization Code Flow with PKCE",
scheme_name="OAuth2Bearer",
authorizationUrl=str(client.authorization_url),
tokenUrl=str(client.token_url),
)
Expand All @@ -76,7 +76,7 @@ class JWTBearerTokenSchema(HTTPBearer):
"""

def __init__(self):
super().__init__(scheme_name="JWT Bearer token", bearerFormat="JWT")
super().__init__(scheme_name="OAuth2Bearer", bearerFormat="JWT")

async def __call__(self) -> None:
pass
5 changes: 3 additions & 2 deletions clean_python/oauth2/token.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from pydantic import validator
from pydantic import field_validator

from clean_python import Json
from clean_python import Scope
Expand All @@ -14,7 +14,8 @@
class Token(ValueObject):
claims: Json

@validator("claims")
@field_validator("claims")
@classmethod
def validate_claims(cls, v):
if not isinstance(v, dict):
return v
Expand Down