Browse Source

🎨 Auto format

pull/15358/head
pre-commit-ci-lite[bot] 3 months ago
committed by GitHub
parent
commit
c4b3e01b79
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      docs/en/docs/tutorial/handling-errors.md

6
docs/en/docs/tutorial/handling-errors.md

@ -243,7 +243,7 @@ If you want to use the exception along with the same default exception handlers
In this example you are just printing the error with a very expressive message, but you get the idea. You can use the exception and then just reuse the default exception handlers.
### Validating Path Parameters
### Validating Path Parameters { #validating-path-parameters }
FastAPI allows you to validate path parameters using Pydantic validators, similar to query parameter validation.
@ -267,5 +267,5 @@ ValidID = Annotated[str, AfterValidator(check_valid_id)]
def read_item(item_id: ValidID):
return {"item_id": item_id}
```
This approach ensures validation happens before the request reaches your path operation function,
keeping your code clean and consistent.
This approach ensures validation happens before the request reaches your path operation function,
keeping your code clean and consistent.

Loading…
Cancel
Save