Tech debt: Improve documentation of Event model fields in Transfer Family parser Models
Closed this issue · 3 comments
Description
Enhance the Transfer Family parser models with comprehensive field descriptions and examples using Pydantic's Field() functionality. This improvement will provide better documentation and metadata for Transfer Family event parsing, following the pattern established in PR #7100.
Motivation
Currently, the Transfer Family 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/transfer_family.py
Reference events:
Check the sample events in tests/events/ for realistic field values:
transferFamilyAuthorizer.json
Implementation Requirements
- ✅ Add detailed
descriptionfor each field explaining its purpose and usage - ✅ Include practical
examplesshowing realistic AWS Transfer Family values - ✅ Base descriptions on official AWS Transfer Family documentation
- ✅ Maintain all existing functionality, types, and validation logic
- ✅ Follow the same pattern established in EventBridge, Kinesis, and ALB models
Example Implementation
# Before
class TransferFamilyAuthorizer(BaseModel):
username: str
server_id: str
source_ip: str
protocol: str
home_directory: str
# After
class TransferFamilyAuthorizer(BaseModel):
username: str = Field(
description="The username of the Transfer Family user attempting to authenticate.",
examples=[
"john.doe",
"sftp-user-123",
"data-transfer-user"
]
)
server_id: str = Field(
description="The server ID of the Transfer Family server.",
examples=[
"s-1234567890abcdef0",
"s-abcdef1234567890a"
]
)
source_ip: str = Field(
description="The IP address of the client connecting to the Transfer Family server.",
examples=[
"192.168.1.100",
"10.0.0.50",
"203.0.113.12"
]
)
protocol: str = Field(
description="The protocol used for the connection (SFTP, FTPS, or FTP).",
examples=[
"SFTP",
"FTPS",
"FTP"
]
)
home_directory: str = Field(
description="The home directory path for the user.",
examples=[
"/bucket/home/john.doe",
"/my-bucket/users/sftp-user-123",
"/data-bucket/uploads"
]
)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
Can i take this one ?
Yes, go ahead.
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.