-
Notifications
You must be signed in to change notification settings - Fork 444
Open
Open
Copy link
Labels
good first issueGood for newcomersGood for newcomershelp wantedCould use a second pair of eyes/handsCould use a second pair of eyes/handsparserParser (Pydantic) utilityParser (Pydantic) utilitytech-debtTechnical Debt tasksTechnical Debt tasks
Description
Description
Enhance the SQS parser models with field descriptions and examples using Pydantic's Field()
functionality. This improvement will provide better documentation and metadata for SQS event parsing, following the pattern established in PR #7100.
Motivation
Currently, the SQS models lack detailed field documentation, making it harder for developers to:
- Understand field purposes without referencing external AWS documentation
- Generate rich API documentation with tools like Swagger/OpenAPI
- Create realistic test data using model factories
- Get helpful IntelliSense in IDEs
Proposed Changes
Add description
and examples
parameters to all fields in the following models using Field()
:
Files to modify:
aws_lambda_powertools/utilities/parser/models/sqs.py
Reference events:
Check the sample events in tests/events/
for realistic field values:
sqsEvent.json
sqsEventBatch.json
Implementation Requirements
- ✅ Add detailed
description
for each field explaining its purpose and usage - ✅ Include practical
examples
showing realistic AWS SQS values - ✅ Base descriptions on official AWS SQS documentation
- ✅ Maintain all existing functionality, types, and validation logic
- ✅ Follow the same pattern established in EventBridge, Kinesis, and ALB models
Example Implementation
# Before
class SqsRecordModel(BaseModel):
message_id: str
receipt_handle: str
body: str
attributes: SqsAttributesModel
# After
class SqsRecordModel(BaseModel):
message_id: str = Field(
description="A unique identifier for the message.",
examples=[
"19dd0b57-b21e-4ac1-bd88-01bbb068cb78",
"059f36b4-87a3-44ab-83d2-661975830a7d"
]
)
receipt_handle: str = Field(
description="An identifier associated with the act of receiving the message.",
examples=[
"MessageReceiptHandle",
"AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a..."
]
)
body: str = Field(
description="The message's contents (not URL-encoded).",
examples=[
"Hello from SQS!",
'{"key": "value", "message": "test"}'
]
)
attributes: SqsAttributesModel = Field(
description="A map of the attributes requested in ReceiveMessage to their respective values."
)
Benefits
For Developers
- Better IntelliSense with field descriptions and example values
- Self-documenting code without needing external AWS documentation
- Faster development with immediate reference for acceptable values
For Documentation Tools
- Rich Swagger/OpenAPI docs via .model_json_schema()
- Automated documentation generation with comprehensive metadata
- Interactive documentation with practical examples
Getting Started
This is a great first issue for newcomers to Powertools for AWS! The task is straightforward and helps you get familiar with our codebase structure.
Need help?
We're here to support you! Feel free to:
- Ask questions in the comments
- Request guidance on implementation approach
Acknowledgment
- This request meets Powertools for AWS Lambda (Python) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedCould use a second pair of eyes/handsCould use a second pair of eyes/handsparserParser (Pydantic) utilityParser (Pydantic) utilitytech-debtTechnical Debt tasksTechnical Debt tasks
Type
Projects
Status
Backlog