-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Filter as a plugin #4255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter as a plugin #4255
Conversation
|
A couple of edge cases in the tests could be:
|
heldersepu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now on the template you can check the:
I have taken care to cover edge cases in my tests.
shockey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this! Just a couple things:
OpsFiltershould beopsFilter, in order to be consistent with most of the other things currently underfn- Tests should include the System passing around
opsFilterand then using it by system reference, to protect against breaking changes since we're exposingopsFilteras a plug point
|
@shockey Great! I have added a unit test that does what I think is what you meant by including the System passing around |
shockey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
thanks @DavidVujic! |
Description
In this PR, the filter function used for filtering Tagged Operations is written as a plugin, instead of inline code in a component (
operations.jsx). This will make it possible to implement a custom filter. One example is a custom filter making it possible to search by more than one phrase (example: pet, store).Motivation and Context
One scenario (that is very common in the organisation I work in) is that users are testing an operation that requires an authenticated session or token. Usually, getting a session/token is made executing a different operation. So, there are two operations that will be tested out. A filter that accepts more than one phrase will solve the UI issues with navigating an API with a long list of operations.
How Has This Been Tested?
A unit test is added to the source code, testing the OpsFilter plugin function.
Screenshots (if appropriate):
With a plugin, a custom filter function can easily be implemented, overriding the default filter.
This is an example of a custom filter, that will make it possible to search by multiple phrases (in this case, separated by comma).
The custom plugin can be added as any plugin to the
SwaggerUIconstructor:Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests