feat!: remove param-regex flag, merge response schemas, mark Error non-exhaustive - #29
Merged
Conversation
BREAKING CHANGE: --param-regex was accepted but never honored. Scripts passing this flag will now error with "unknown argument" instead of silently ignoring it. Remove the flag from any invocations.
BREAKING CHANGE: When a capture contains multiple responses for the same endpoint, all observed status codes are now documented in the generated OpenAPI spec. Previously only the first-observed response was kept. When the same status code is seen with different response shapes, they are merged into a oneOf schema. Generated specs are NOT byte-identical to prior versions even for the same input.
BREAKING CHANGE: Downstream consumers that match on Error must add a catch-all arm (_ => ...). Prevents future additions to the enum from breaking consumers.
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
Three breaking changes bundled into a single release window so users update once:
Remove
--param-regexCLI flag — was accepted by the CLI but never consulted during path matching. Scripts passing--param-regexwill now get an "unknown argument" error instead of silent no-op.Merge response schemas per status code — when multiple captured flows hit the same
(path, method), all observed status codes now appear in the generated spec. Previously only the first-seen response was kept. When the same status code has divergent response shapes, they are merged viaoneOf.#[non_exhaustive]onErrorenum — downstream consumers matching onErrormust add a catch-all_ => ...arm. This allows the crate to add new error variants in future minor releases without breaking consumers.Type of Change
Migration Guide
CLI users
--param-regex <REGEX>from any scripts or CI invocations. The flag was never functional.Library consumers (
mitm2openapias a crate dependency)Config::param_regex(field removed from the struct)._ => ...) to anymatchonmitm2openapi::error::Error.oneOffor same-status divergent schemas.Checklist
cargo fmt --allcleancargo clippy --all-targets --all-features -- -D warningscleancargo testpasses locallyCHANGELOG.mdunder[Unreleased](if user-facing)feat:,fix:,docs:, etc.)Testing
cargo test --lib— 228 tests pass (including new builder merge tests)cargo test --tests— all integration tests pass (cli_param_regex_removed, merge_responses, report, security, output_atomic)cargo clippy --all-targets -- -D warnings— cleancargo publish --dry-run— passesNote: Petstore/crAPI golden integration tests (Docker-based) may need regeneration since response merging changes output. The golden files should be regenerated by running the integration test scripts locally with Docker before merge.
Related Issues
N/A — internal hardening consolidation.