Skip to content
This repository was archived by the owner on Nov 14, 2022. It is now read-only.

Commit 2cdf5e0

Browse files
tehtbltiangolo
authored andcommitted
🐛 Use new types from Pydantic v1 (#21)
1 parent e730af3 commit 2cdf5e0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import List
22

33
from fastapi import APIRouter, Body, Depends, HTTPException
4-
from pydantic.types import EmailStr
4+
from pydantic.networks import EmailStr
55

66
from app import crud
77
from app.api.utils.security import get_current_active_superuser, get_current_active_user

{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from fastapi import APIRouter, Depends
2-
from pydantic.types import EmailStr
2+
from pydantic.networks import EmailStr
33

44
from app.api.utils.security import get_current_active_superuser
55
from app.core.celery_app import celery_app

{{cookiecutter.project_slug}}/backend/app/app/crud/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from couchbase.n1ql import CONSISTENCY_REQUEST, N1QLQuery
88
from fastapi.encoders import jsonable_encoder
99
from pydantic import BaseModel
10-
from pydantic.fields import Field, Shape
10+
from pydantic.fields import Field, SHAPE_LIST, SHAPE_SET, SHAPE_TUPLE
1111

1212
from app.core import config
1313

@@ -85,7 +85,7 @@ def search_results_to_model(
8585
field: Field = doc_model.__fields__[key]
8686
if not value:
8787
value = None
88-
elif field.shape in {Shape.LIST, Shape.SET, Shape.TUPLE} and not isinstance(
88+
elif field.shape in {SHAPE_LIST, SHAPE_SET, SHAPE_TUPLE} and not isinstance(
8989
value, list
9090
):
9191
value = [value]

0 commit comments

Comments
 (0)