Skip to content
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

How to add FilterContainer to swagger-ui-react? #7002

Closed
alexrejto opened this issue Feb 26, 2021 · 5 comments
Closed

How to add FilterContainer to swagger-ui-react? #7002

alexrejto opened this issue Feb 26, 2021 · 5 comments

Comments

@alexrejto
Copy link

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Version: 88.0.4324.182
  • Method of installation: yarn add swagger-ui-react
  • Swagger-UI version: 3.35.0
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Swagger/OpenAPI definition:

Swagger-UI configuration options:

SwaggerUI({
  // your config options here
})
?yourQueryStringConfig

Screenshots

How can we help?

@mathis-m
Copy link
Contributor

mathis-m commented Feb 26, 2021

@alexrejto using the following Swagger-UI configuration options:

SwaggerUI({
  filter: true
})
?filter=true

Example:
https://petstore3.swagger.io/?filter=pet

FYI: In case you are interested in a more advanced filter follow the PR #6851

@alexrejto
Copy link
Author

I'm beyond interested in your PR #6851. In the mean time, I was hoping to use the basic filter. I use swagger-ui-react so am unable to pass filter through to the swaggerUI instance. Is there a workaround?

@alexrejto
Copy link
Author

Resolved! The solution was a plugin to the filter state selector.

const enableFilterPlugin = function(system) {
  return {
    statePlugins: {
      layout: {
        selectors: {
          currentFilter: (state) => (state.get('filter') == null ? true : state.get('filter')),
        },
      },
    },
  };
};

@mathis-m
Copy link
Contributor

@alexrejto I think it you can keep the issue open.
Cc @tim-lai shall the filter configuration not be available through swagger-ui-react. Eg. <SwaggerUI filter="true" />.

@maicWorkGithub
Copy link

docker -e filter=true not work, help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants