counterfact icon indicating copy to clipboard operation
counterfact copied to clipboard

Add Prune option for clearing out defunct paths and endpoints

Open dethell opened this issue 6 months ago • 1 comments

Sometimes an OpenApi spec might change path names or endpoint names. In that case, if a consumer tries to run Counterfact again, since it will leave the old paths and routes alone it is possible to end up with multiple wild card routes at the same end path. Example:

Old path: /pet/{id}/update/{Name}.ts New path: /pet/{id}/update/{nickname}.ts

In this case, the old file will be left in place and the new one created. Then when module-tree.ts attempts to resolve the path it will have ambiguity because both wildcards can be a math if they both have the same HTTP verb.

We should offer a --prune option that will clean out any paths that aren't represented in the OpenApi spec.

dethell avatar Jun 09 '25 19:06 dethell

Or maybe it should detect this situation and rename {Name}.ts to {nickname}.ts

pmcelhaney avatar Jun 13 '25 13:06 pmcelhaney