fix(connectivity): vpc_peering create body serializes the spec's wire keys#89
Merged
Merged
Conversation
… keys `VpcPeeringCreateRequest` previously serialized AWS and GCP fields with the wrong JSON keys: `awsRegion` (spec wants `region`), `gcpProjectId` (spec wants `vpcProjectUid`), and `networkName` (spec wants `vpcNetworkName`). The API rejected or silently ignored these fields, so `create_vpc_peering` was effectively broken for both providers. This commit: - Adds `#[serde(rename = "region")]` on `aws_region`, `#[serde(rename = "vpcProjectUid")]` on `gcp_project_id`, and `#[serde(rename = "vpcNetworkName")]` on `network_name`, so the outbound JSON matches the spec for both `VpcPeeringCreateAwsRequest` and `VpcPeeringCreateGcpRequest`. - Adds `VpcPeeringCreateRequest::for_aws(...)` and `for_gcp(...)` constructors that pre-populate `provider` plus the spec's required fields, guiding callers to a correct provider-targeted body without mixing AWS+GCP fields. - Documents the existing struct as a flat representation of the spec's `oneOf`, with a forward pointer to the type-safe enum split tracked under #65. - Adds two new regression-guard tests (`test_vpc_peering_create_aws_wire_keys`, `test_vpc_peering_create_gcp_wire_keys`) that assert the exact JSON body the SDK sends via wiremock's `body_json` matcher. No public field renames; only serde wire mappings change. Callers using the struct directly continue to work but now hit the API correctly. Refs #40 (spec deltas), #65 (handler harmonization — full enum split is its own scope) Closes #75
This was referenced May 15, 2026
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.
Summary
VpcPeeringCreateRequestpreviously serialized AWS and GCP fields with the wrong JSON keys — the API rejected/ignored these fields andcreate_vpc_peeringwas effectively broken for both providers.aws_regionawsRegionregiongcp_project_idgcpProjectIdvpcProjectUidnetwork_namenetworkNamevpcNetworkNameThis PR is non-breaking — only serde wire mappings change; Rust field names and the struct shape stay the same.
Also adds
VpcPeeringCreateRequest::for_aws(region, aws_account_id, vpc_id)andfor_gcp(project_uid, network_name)— provider-targeted constructors that pre-populateproviderplus the spec's required fields, guiding callers to a correct body without mixing AWS+GCP fields.test_vpc_peering_create_aws_wire_keys,test_vpc_peering_create_gcp_wire_keys) usingbody_jsonto assert the exact JSON the SDK sends.VpcPeeringCreateRequestdescribing the relationship to the spec'soneOfand pointing to the type-safe enum split as a follow-on under api(consistency): finish harmonized handler surface across remaining domains #65.Test plan
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace— all passtest_create_vpc_peering_gcpstill passes (renames are transparent to existing tests that don't assert outbound body)Closes #75
Refs #40 (spec deltas), #65 (handler harmonization / enum split follow-on)