Skip to content

fix(connectivity): vpc_peering create body serializes the spec's wire keys#89

Merged
joshrotenberg merged 1 commit into
mainfrom
fix/vpc-peering-create-field-names
May 15, 2026
Merged

fix(connectivity): vpc_peering create body serializes the spec's wire keys#89
joshrotenberg merged 1 commit into
mainfrom
fix/vpc-peering-create-field-names

Conversation

@joshrotenberg
Copy link
Copy Markdown
Contributor

Summary

VpcPeeringCreateRequest previously serialized AWS and GCP fields with the wrong JSON keys — the API rejected/ignored these fields and create_vpc_peering was effectively broken for both providers.

Rust field Wire (before) Wire (after / spec)
aws_region awsRegion region
gcp_project_id gcpProjectId vpcProjectUid
network_name networkName vpcNetworkName

This 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) and for_gcp(project_uid, network_name) — provider-targeted constructors that pre-populate provider plus the spec's required fields, guiding callers to a correct body without mixing AWS+GCP fields.
  • Two regression-guard tests (test_vpc_peering_create_aws_wire_keys, test_vpc_peering_create_gcp_wire_keys) using body_json to assert the exact JSON the SDK sends.
  • Doc on VpcPeeringCreateRequest describing the relationship to the spec's oneOf and 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 -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace — all pass
  • 2 new wire-key tests green; existing test_create_vpc_peering_gcp still 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)

… 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
@joshrotenberg joshrotenberg merged commit 9110cb9 into main May 15, 2026
8 checks passed
@joshrotenberg joshrotenberg deleted the fix/vpc-peering-create-field-names branch May 15, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(connectivity): vpc_peering create sends wrong JSON keys (awsRegion vs region)

1 participant