Skip to content

Tech debt: Improve documentation of Event model fields in VPC Lattice parser Models #7101

Description

@leandrodamascena

Description

Enhance the VPC Lattice parser models with field descriptions and examples using Pydantic's Field() functionality. This improvement will provide better documentation and metadata for VPC Lattice event parsing, following the pattern established in PR #7100.

Motivation

Currently, the VPC Lattice 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/vpc_lattice.py
  • aws_lambda_powertools/utilities/parser/models/vpc_latticev2.py

Reference events:
Check the sample events in tests/events/ for realistic field values:

  • vpcLatticeEvent.json
  • vpcLatticeEventV2.json

Implementation Requirements

  • ✅ Add detailed description for each field explaining its purpose and usage
  • ✅ Include practical examples showing realistic AWS VPC Lattice values
  • ✅ Base descriptions on official AWS VPC Lattice documentation
  • ✅ Maintain all existing functionality, types, and validation logic
  • ✅ Follow the same pattern established in EventBridge, Kinesis, and ALB models

Example Implementation

# Before
class VpcLatticeRequestContext(BaseModel):
    service_arn: str
    service_network_arn: str
    target_group_arn: str

# After  
class VpcLatticeRequestContext(BaseModel):
    service_arn: str = Field(
        description="The ARN of the VPC Lattice service that processed the request.",
        examples=[
            "arn:aws:vpc-lattice:us-east-1:123456789012:service/svc-12345678901234567",
            "arn:aws:vpc-lattice:eu-west-1:123456789012:service/svc-abcdef1234567890"
        ]
    )
    service_network_arn: str = Field(
        description="The ARN of the VPC Lattice service network.",
        examples=[
            "arn:aws:vpc-lattice:us-east-1:123456789012:servicenetwork/sn-12345678901234567",
            "arn:aws:vpc-lattice:eu-west-1:123456789012:servicenetwork/sn-abcdef1234567890"
        ]
    )
    target_group_arn: str = Field(
        description="The ARN of the target group that received the request.",
        examples=[
            "arn:aws:vpc-lattice:us-east-1:123456789012:targetgroup/tg-12345678901234567",
            "arn:aws:vpc-lattice:eu-west-1:123456789012:targetgroup/tg-abcdef1234567890"
        ]
    )

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

Activity

  1. added
    help wantedCould use a second pair of eyes/hands
    parserParser (Pydantic) utility
    and removed
    triagePending triage from maintainers
    on Aug 6, 2025
  2. changed the title [-]Tech debt: Improve documentation of Event model fields in VPC Lattice Models[/-] [+]Tech debt: Improve documentation of Event model fields in VPC Lattice parser Models[/+] on Aug 6, 2025
  3. self-assigned this
    on Aug 22, 2025
  4. moved this from Backlog to Working on it in Powertools for AWS Lambda (Python)on Aug 22, 2025
  5. powertools-for-aws-oss-automation commented on Aug 24, 2025

    @powertools-for-aws-oss-automation

    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.

  6. github-actions commented on Sep 9, 2025

    @github-actions
    Contributor

    This is now released under 3.20.0 version!

  7. removed
    pending-releaseFix or implementation already in dev waiting to be released
    on Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

parserParser (Pydantic) utilitytech-debtTechnical Debt tasks

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions