Make automatic path parameterization safer and configurable - #7
Open
alexchexes wants to merge 4 commits into
Open
Make automatic path parameterization safer and configurable#7alexchexes wants to merge 4 commits into
alexchexes wants to merge 4 commits into
Conversation
Owner
|
Hi @alexchexes - thank you for taking the time to make these PRs, and really impressive work. I will review this later this week or the next. |
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.
Since this project is apparently discontinued, I have prepared a release (chrome extension only):
https://github.com/alexchexes/demystify/releases
Closes #5
The issue this fixes:
While capturing traffic in the Chrome extension, automatic path parameterisation could fold unrelated resource paths into templates like
/api/{api}/...ormulti-parameter paths such as
/api/{api}/{v2}/{param4}. That made the generated OpenAPI shape hard to use: stable resource names like/clientsor/orderscould disappear into path params.The heuristics also could not be disabled or narrowed, so a bad fold was hard to recover from.
This PR:
/api/order/123,/api/order/234) can fold quickly, but only with compatible request and response shape evidence./orders/1?include=...and/orders/2?include=...can still fold./api/foo,/api/bar) need4compatible observations.null, empty objects, and empty arrays are treated as unobserved inside that branch;--parameterisation safe-text|id-only|off;Representor;It also fixes repo tooling so lint/typecheck/test/build can run normally on Windows.
Notes on design
The shape matcher is intentionally heuristic as before, but the risky parts are split into small checks so they are easy to adjust later. Sparse branches are neutral rather than positive evidence: an empty array or object does not prove item shape, but it also does not count all populated item fields as missing. Folding still requires at least some compatible observed fields.
Screenshots
Before:
After:
Remaining limitation
The UI can rebuild parameterisation only from HAR entries captured or imported in the current session. Saved Demystify files don't contain raw HARs, so options changed via checkboxes apply only to future collected entries, not to the imported ones.