From 354c24343143bb1e2536a739ee27b7f3f147916c Mon Sep 17 00:00:00 2001 From: Cam Sima Date: Wed, 11 Sep 2024 15:58:23 -0400 Subject: [PATCH] update readme --- README.md | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index e6d1dee..7e3efc4 100644 --- a/README.md +++ b/README.md @@ -217,23 +217,7 @@ async def get_user_handler(req: Request): In this example, the endpoint expects username to be a string and age to be a float. If the parameters are missing or of the wrong type, a validation error is returned. -#### Example: Using Pydantic Models for Query Validation - -```python -from pydantic import BaseModel -from ziplineio.validation.query import QueryParam, validate_query - -class UserModel(BaseModel): - username: str - age: int - -@app.get("/") -@validate_query(QueryParam("user", UserModel)) -async def get_user_handler(req: Request): - user = req.query_params.get("user") - return {"user": user.model_dump()} - -``` +```` #### Example: Simple Body Parameter Validation @@ -248,7 +232,7 @@ async def create_user_handler(req: Request): age = req.body.get("age") return {"username": username, "age": age} -``` +```` #### Example: Using Pydantic Models for Body Validation