openapi-filter
openapi-filter copied to clipboard
Feature - additional filter options: operationIds & method
- Filter by OperationIds
- Filter by method
As mentioned https://github.com/Mermade/openapi-filter/issues/70, I have added 2 options:
- to filter by "method" (GET/POST/PUT/DELETE/....) which will remove all operations under any path that matches
- to filter by "operationId" (operationId: addPet/ operationId: updatePet / ...) which will remove the specific operations under that matches the defined operationId
@MikeRalphson
I'm doing something wrong with the tests, but not sure how to correct it. If I do a local diff the input & output show the result as expected.
Question:
When combining it with the "inverse":true
it removes really everything except the "paths" with the "method".
Example
"methods": ["post"],
"inverse": true
How can I limit the "inverse" to the "path" level?
How can I limit the "inverse" to the "path" level?
The original intent of the --inverse
option was to see exactly what would be filtered / omitted. Over time, for people who want a kind of reverse filtering, the --valid
option was added - this may be what you need in combination.
Not sure, I fully understand how I can delete the obj[key] via the state.parent?
Since in the recursion, that obj has already passed by?
state.parent
always holds the parent object (i.e. the one which has obj
in it) identified by state.pkey
which is the "parent key". So you can delete during the recursion, or hold references and delete afterwards if need be.
@MikeRalphson Let me know if you have more remarks or comments, that I can implement. I think it is good to go.
hey @thim81 @MikeRalphson , hope you are doing great, any updates on this feature, would be a great addition to the package. how can I help?
@yjose I think that everything is ready. I cant see the change request that was asked, which seems more a Github issue on my end. I'm using this PR since Jan 2021 and I haven't ran into any issues.
Thanks for the prod - I will test locally and check there's nothing outstanding before merging.
by the way, i tried to filter opertionIds using using the following config :
let options = {
flags: ['operationId'],
flagValues: operations, // array of strings
inverse: true,
strip: true,
valid: true,
info: true,
};
and look like its working but with missed parameters for paths with global parameters like /path-example/{id}/
and look like its working but with missed parameters for paths with global parameters like
/path-example/{id}/
@yjose could you create a failing testcase to show what is currently happening and what the output should be?
@MikeRalphson #93
I'm very interested in this feature. I'm not clear what if anything is holding up the approval and merge now?
@mattadamson Since then, I have created a separate NPM package which supports the filtering => https://www.npmjs.com/package/openapi-format