Skip to content

feat!: remove param-regex flag, merge response schemas, mark Error non-exhaustive - #29

Merged
Arkptz merged 6 commits into
mainfrom
refactor/breaking-changes
Apr 22, 2026
Merged

feat!: remove param-regex flag, merge response schemas, mark Error non-exhaustive#29
Arkptz merged 6 commits into
mainfrom
refactor/breaking-changes

Conversation

@Arkptz

@Arkptz Arkptz commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Summary

Three breaking changes bundled into a single release window so users update once:

  1. Remove --param-regex CLI flag — was accepted by the CLI but never consulted during path matching. Scripts passing --param-regex will now get an "unknown argument" error instead of silent no-op.

  2. 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 via oneOf.

  3. #[non_exhaustive] on Error enum — downstream consumers matching on Error must add a catch-all _ => ... arm. This allows the crate to add new error variants in future minor releases without breaking consumers.

Type of Change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (fix or feature that would cause existing behavior to change)
  • Documentation update
  • Refactoring / internal cleanup
  • CI / build / tooling

Migration Guide

CLI users

  • Remove --param-regex <REGEX> from any scripts or CI invocations. The flag was never functional.
  • Regenerate any golden/snapshot fixtures that compare spec output — response merging changes the output shape.

Library consumers (mitm2openapi as a crate dependency)

  • Remove any references to Config::param_regex (field removed from the struct).
  • Add a catch-all arm (_ => ...) to any match on mitm2openapi::error::Error.
  • Generated specs now include all observed status codes per endpoint and may use oneOf for same-status divergent schemas.

Checklist

  • cargo fmt --all clean
  • cargo clippy --all-targets --all-features -- -D warnings clean
  • cargo test passes locally
  • Added or updated tests for the change
  • Updated README / CLI help text if user-facing behavior changed
  • Added entry to CHANGELOG.md under [Unreleased] (if user-facing)
  • Used conventional commit style in commit messages (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 — clean
  • cargo publish --dry-run — passes

Note: 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.

Arkptz added 6 commits April 23, 2026 00:14
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.
@Arkptz
Arkptz merged commit a43c3bc into main Apr 22, 2026
13 of 14 checks passed
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