feat: response/request examples, enhanced path params, OPTIONS filter, redaction#49
Merged
Merged
Conversation
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
Four new capabilities added to the generate and discover pipeline, plus a fix for large mitmproxy flows.
Path parameterization —
is_param_segment()now detects UPPER_CASE slugs (BTC_USDT), hex strings (0xabcdef...), and base58 identifiers in addition to numeric/UUID. Cross-request variability detection: when ≥3 distinct values appear at the same path position, that segment is parameterized automatically.--param-regexre-introduced with a working implementation (was previously accepted but silently ignored).Examples collection — all captured response and request bodies are stored as named examples in the generated OpenAPI spec under
MediaType::examples. Multiple captures of the same endpoint produce multiple named examples. Request body schemas are merged across captures viaoneOf(same strategy already used for responses).OPTIONS filtering —
--skip-optionsflag on bothdiscoverandgeneratedrops OPTIONS requests from templates and spec. Off by default.Redaction —
--redact-fieldsand--redact-patternsapply to stored examples only, never to schema inference. Example names are re-derived from the redacted value so sensitive data does not leak into YAML keys.--max-examples N(default 5) caps examples per endpoint per status code.Large flow handling —
--max-payload-sizewired through to the tnetstring parser (was a dead flag). Oversized entries are now skipped instead of halting the iterator, so flows after a large WebSocket/streaming entry are no longer silently dropped.Test evidence
cargo clippy --all-targets -- -D warnings: cleantests/full_pipeline.rsexercises all features together--max-payload-size 1GiBrecovers fair_price/index_price/funding_rate paths previously lost behind an 800MB WebSocket entry (54734 → 82861 flows, paths=1 → paths=4)Files changed
src/path_matching.rs,src/type_hints.rs: UPPER_CASE/hex/base58 detection, variability algorithmsrc/builder.rs: examples accumulator, request body merge, redaction integration, max-examples capsrc/redact.rs(new): standalone redaction modulesrc/tnetstring.rs: skip oversized entries instead of halting iteratorsrc/mitmproxy_reader.rs: accept max_payload_size parametersrc/cli.rs,src/types.rs,src/main.rs: new flags wired throughbook/src/usage/cli-reference.md,pipeline.md,introduction.md,README.md,CHANGELOG.md: docs updated