Skip to content

fix: support httpmock generation for array types - #1261

Open
danieleades wants to merge 9 commits into
oxidecomputer:mainfrom
danieleades:mock-vecs
Open

danieleades wants to merge 9 commits into
oxidecomputer:mainfrom
danieleades:mock-vecs

Conversation

@danieleades

@danieleades danieleades commented Dec 19, 2025 •

Copy link
Copy Markdown
Contributor

Closes #1260.

Generated httpmock query setters now use the same Serde serializer as the generated client. The matcher lives in progenitor-client behind an opt-in httpmock feature. The mock generator declares that feature when it emits a query setter.

Scalar setters continue to require the expected key/value pair and allow other values for the same key. Array setters check the exact values and their multiplicities in any order. An empty array requires the key to be absent.

The regression tests send a generated-client request to a mock server and exercise reordered, duplicate, extra, missing, empty, and regex-sensitive values. A separate assertion checks the feature metadata on generated mocks and SDKs.

The standalone generated-output fixture uses httpmock 0.8 and reqwest 0.13. Its mock modules compile. Checking the entire fixture still hits the two existing Buildomat CLI parser errors tracked in #1170.

@danieleades
danieleades marked this pull request as ready for review December 27, 2025 13:03
@danieleades

Copy link
Copy Markdown
Contributor Author

this now works against my openAPI spec.

note the need to convert &str to String to satisfy the trait bounds of httpmock json_body_obj. That bound appears however to be a bug- have opened a PR upstream - httpmock/httpmock#206

@danieleades

Copy link
Copy Markdown
Contributor Author

marking as a draft until the upstream issue in httpmock is resolved

@danieleades
danieleades marked this pull request as draft January 6, 2026 18:15
@danieleades

Copy link
Copy Markdown
Contributor Author

upstream fix has been merged, just need a new release of httpmock

@danieleades

Copy link
Copy Markdown
Contributor Author

@ahl - would it be possible to trigger CI for this one?

this issue is a blocker for me adopting progenitor

- only emit the query param helper when an operation has query params,
  avoiding a dead_code warning in generated mocks
- require an absent parameter when the client would send no pairs
  (e.g. an empty array)
- match each pair with exact (escaped, anchored) counts so extra,
  missing, or duplicated values no longer match
- replace the compile-only test with MockServer tests
@danieleades

Copy link
Copy Markdown
Contributor Author

@ahl - any movement on this one?

@ahl

ahl commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Rather than generating the helper function, should we have a helper crate akin to progenitor-client?

@danieleades

Copy link
Copy Markdown
Contributor Author

Rather than generating the helper function, should we have a helper crate akin to progenitor-client?

Makes sense, i think. Were you thinking a sibling crate, something like progenitor-httpmock?

@ahl

ahl commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Rather than generating the helper function, should we have a helper crate akin to progenitor-client?

Makes sense, i think. Were you thinking a sibling crate, something like progenitor-httpmock?

I'm unsure. Perhaps it would be better to have helpers in progenitor-client with a httpmock feature flag. What do you think?

@danieleades

Copy link
Copy Markdown
Contributor Author

Rather than generating the helper function, should we have a helper crate akin to progenitor-client?

Makes sense, i think. Were you thinking a sibling crate, something like progenitor-httpmock?

I'm unsure. Perhaps it would be better to have helpers in progenitor-client with a httpmock feature flag. What do you think?

let me know what you think of this approach

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.

httpmock generation fails for query params with array types (e.g., Vec<T>)

2 participants