Skip to content

fix: optional request bodies across generated clients#120

Merged
adamcavendish merged 1 commit into
masterfrom
adamcavendish/fix-optional-request-bodies
Jun 15, 2026
Merged

fix: optional request bodies across generated clients#120
adamcavendish merged 1 commit into
masterfrom
adamcavendish/fix-optional-request-bodies

Conversation

@adamcavendish

Copy link
Copy Markdown
Collaborator

Summary

Fixes optional request body handling across generated clients, with the Rust generator now preserving requestBody.required through API planning and backend emission.

What changed

  • Rust API signatures now emit Option<&T> for optional request bodies and keep &T for required bodies.
  • Rust reqwest and aioduct skip body construction entirely when an optional body is None.
  • Rust ureq sends an empty body for absent optional body-capable requests, matching ureq/OkHttp-style constraints around body-capable POST flows.
  • Optional unsupported multipart bodies now error only when a body is actually provided.
  • Added focused optional non-multipart body goldens across Rust, Go, Java, Kotlin, Python, and TypeScript.
  • Regenerated Rust multipart edge-case goldens for the optional multipart behavior.

Validation

  • cargo test --test golden_tests_rust_reqwest test_optional_request_bodies_golden -- --nocapture
  • cargo test --test golden_tests_rust_ureq test_optional_request_bodies_golden -- --nocapture
  • cargo test --test golden_tests_rust_aioduct test_optional_request_bodies_golden -- --nocapture
  • cargo test --test golden_tests_go_http test_optional_request_bodies_golden -- --nocapture
  • cargo test --test golden_tests_java_okhttp test_optional_request_bodies_golden -- --nocapture
  • cargo test --test golden_tests_kotlin_okhttp test_optional_request_bodies_golden -- --nocapture
  • cargo test --test golden_tests_python_requests test_optional_request_bodies_golden -- --nocapture
  • cargo test --test golden_tests_python_httpx test_optional_request_bodies_golden -- --nocapture
  • cargo test --test golden_tests_typescript_fetch test_optional_request_bodies_golden -- --nocapture
  • cargo test --test multipart_runtime_smoke -- --nocapture
  • cargo fmt --check
  • git diff --check
  • Focused compile check for generated Rust optional-request-bodies packages for reqwest, ureq, and aioduct.

Rust:
- Preserve requestBody.required in shared API body planning
- Emit Option<&T> for optional request bodies and skip body setup on None
- Keep ureq POST-compatible by sending an empty body when optional input is absent

Tests:
- Regenerate multipart edge-case goldens for reqwest, ureq, and aioduct
- Add optional non-multipart request body fixture across all golden suites
- Pin JSON, text, binary, and required-body behavior in generated goldens
@adamcavendish adamcavendish marked this pull request as ready for review June 15, 2026 06:33
@adamcavendish adamcavendish merged commit e9615ff into master Jun 15, 2026
24 checks passed
@adamcavendish adamcavendish deleted the adamcavendish/fix-optional-request-bodies branch June 15, 2026 06:41
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.

1 participant