fix(python): filter out nop values when generating wire test method arguments #11456
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.
Description
Fixes wire test generation to filter out
nop()values when generating method arguments. This prevents invalid Python syntax likeparam=without a value when an example contains an invalid enum value or undefined property.Link to Devin run: https://app.devin.ai/sessions/9a00a050c1fd43e1952afc9673406aca
Requested by: @tjb9dc
Changes Made
.filter((arg) => !python.TypeInstantiation.isNop(arg.value))inEndpointSnippetGenerator.tsto filter out nop values before creating method argumentsversions.ymlwith changelog entry for version 4.46.9Root Cause
When a property value is converted to
nop()(e.g., because it's an invalid enum value or an undefined property in the schema), thenop()value was still being included in method arguments, generatingparam=without a value and causing a Python syntax error.This was discovered in the Twilio API where
Status: statuswas used as a placeholder instead of a valid enum value.Testing
pnpm check)Human Review Checklist
EndpointSnippetGenerator.tsandversions.ymlare changed - user requested removal of all fixture/seed test changes, but the diff may still contain exhaustive fixture modifications that should not be includednop()should be filtered)python(notpython-sdk) to pass lint checks