Repository navigation
fix(parser): accept multi-value headers and query strings in VPC Lattice v2 events - #8774
Open
Manishram-ai wants to merge 1 commit into
Conversation
…ice v2 events VPC Lattice sends every header and query string value in a V2 event as a list, even when there is only one value. VpcLatticeV2Model typed both fields as dict[str, str], so every real V2 event failed validation and VpcLatticeV2Envelope could not parse any of them. Type both fields as dict[str, list[str]], matching the V2 event structure in the VPC Lattice docs and the TypeScript parser. The parser tests now use the list-shaped fixtures, plus the event captured from a live V2 target group.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issue number:
closes #8773
Summary
Changes
headersandquery_string_parametersinVpcLatticeV2Modelare nowdict[str, list[str]]. VPC Lattice sends every header and query string value in a V2 event as a list, even a single one (docs). I updated the field descriptions and examples to match.vpcLatticeV2Event.json, which has plain string values that VPC Lattice doesn't send. They now usevpcLatticeV2EventWithHeaders.json, which has the same request context with list values. I didn't change any fixtures, since other tests still usevpcLatticeV2Event.json.vpcLatticeV2EventWithQueryString.json), once with the model and once throughVpcLatticeV2Envelope.This is the same fix as aws-powertools/powertools-lambda-typescript#5773.
User experience
Before, every real V2 event failed with a
ValidationError, soVpcLatticeV2ModelandVpcLatticeV2Envelopecouldn't be used with VPC Lattice. Now they parse, and the values come back as lists, like{"header1": ["value1", "value2"]}.Events with plain string values, like the old test fixture, fail validation now. VPC Lattice never sends that shape, so I treated this as a fix to match the AWS contract (ADR 0006). If you'd rather keep accepting strings with a
PowertoolsUserWarninguntil the next major, I'm happy to change it.Verification
develop, 6 of the 7 tests intests/unit/parser/_pydantic/test_vpc_latticev2.pyfail: the 4 existing tests that now use list values and the 2 new ones. All 7 pass with this change.tests/unit/parser,tests/unit/data_classes/required_dependencies,tests/functional/parserandtests/functional/event_handler: 1701 passed, 1 skipped (Python 3.12).ruff format --check,ruff checkandmypyare clean on the changed files.tests/events.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.