Browse Source
replace `parse_obj` with `model_validate`
pull/14342/head
Ergo Lau
8 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
1 additions and
1 deletions
-
docs_src/path_operation_advanced_configuration/tutorial007_pv1.py
|
|
|
@ -28,7 +28,7 @@ async def create_item(request: Request): |
|
|
|
except yaml.YAMLError: |
|
|
|
raise HTTPException(status_code=422, detail="Invalid YAML") |
|
|
|
try: |
|
|
|
item = Item.parse_obj(data) |
|
|
|
item = Item.model_validate(data) |
|
|
|
except ValidationError as e: |
|
|
|
raise HTTPException(status_code=422, detail=e.errors()) |
|
|
|
return item |
|
|
|
|