Comments (3)
Assigning myself to answer it tomorrow!
from powertools-lambda-python.
Hi @ran-isenberg! I've changed this issue to a feature request. We agree that adding 422 should be mandatory even when the customer creates custom responses on specific routes, but we need to investigate whether it is possible to allow clients to customize the 422 response if necessary.
I'm adding this feature to our backlog and will probably deliver it in the next releases.
Thanks for reporting this and helping us to improve this new feature.
from powertools-lambda-python.
I found a workaround for now @leandrodamascena
I added it manually and i created a proper pydantic code.
Here's the pydantic class:
from typing import Annotated, List, Optional, Union
from pydantic import BaseModel, Field
class PydanticError(BaseModel):
loc: Annotated[List[Union[str, int]], Field(description='Error location')]
type: Annotated[str, Field(description='Error type')]
msg: Annotated[Optional[str], Field(description='Error message')]
class InvalidRestApiRequest(BaseModel):
details: Annotated[List[PydanticError], Field(description='Error details')]
here's the code:
responses={
200: {
'description': 'The created order',
'content': {'application/json': {'model': MyModel}},
},
442: {
'description': 'Invalid create order request',
'content': {'application/json': {'model': InvalidRestApiRequest}},
},
501: {
'description': 'Internal server error',
'content': {'application/json': {'model': MyErrorModel}},
},
from powertools-lambda-python.
Related Issues (20)
- [I Made This]: Serverless API Documentation with Powertools for AWS HOT 1
- Feature request:Provide event handler for Lexv2 lambda integration HOT 1
- Bug: idempotency logic should first validate the payload and then cache HOT 2
- Bug: Event Handler Data Validation `KeyError: 'multiValueHeaders'` regression when running locally HOT 3
- Docs: Improve install section with minimal dependencies first HOT 2
- Static typing: missing @overload to ensure return type is a str when default_value is set HOT 3
- Bug: RequestValidationError handling behavior should not be affected if we add exception handler for Exception HOT 7
- Feature request: Function to retrieve mutli-value query string parameters HOT 2
- Feature request: Add event object sent from Cloudwatch Alarms HOT 7
- Bug: CORS headers not appending to API Gateway REST API responses HOT 7
- Bug: Importing AWSEncryptionSDKProvider in the AWSLambdaPowertoolsPythonV2 layer results in ModuleNotFoundError: No module named '_cffi_backend' HOT 6
- Maintenance: Create a Powertools Lambda layer for each Python version HOT 11
- RFC: Canonical Wide Log utility for emitting a single log entry per lambda execution or processed transaction (batch) HOT 2
- Bug: SQSMessageAttributes __getitem__ has a different type to items() values HOT 6
- Bug: Mongo ObjectIds not serializing out of the box HOT 7
- Maintenance: ruff needs a new parameter "check" HOT 2
- Bug: Validating POST body fails with BedrockAgentResolver HOT 3
- Static typing: parameters get_secret HOT 1
- Bug: Event handler middleware not triggered for not found routes HOT 12
- Feature request: Remove 'service' dimension from single_metric() HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powertools-lambda-python.