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

Add plugins to uiConfig #31

Closed
2 tasks done
conduongtong opened this issue Dec 2, 2022 · 1 comment
Closed
2 tasks done

Add plugins to uiConfig #31

conduongtong opened this issue Dec 2, 2022 · 1 comment

Comments

@conduongtong
Copy link

conduongtong commented Dec 2, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

I want to add a custom plugins filter by tag with case insensitive like this post:
swagger-api/swagger-ui#3876 (comment)

I try to add but it's not working.

fastify.register(fastifySwaggerUI, {
      routePrefix: '/documentation',
      uiConfig: {
        displayRequestDuration: true,
        filter: true,
        tryItOutEnabled: true,
        plugins: [CaseInsensitiveFilterPlugin],
      },
    });
const CaseInsensitiveFilterPlugin = function (system) {
  return {
    fn: {
      opsFilter: (taggedOps, phrase) => {
        console.log('test');
        return taggedOps.filter((tagObj, tag) => tag.toLowerCase().indexOf(phrase.toLowerCase()) !== -1);
      },
    },
  };
};
@Uzlopak
Copy link
Collaborator

Uzlopak commented Dec 2, 2022

Basically the duplicate of #25 .

The issue is that the uiConfig is serialized to json and supplied by a rest-call. And functions cant be serialized. I will close this in favor of #25

@Uzlopak Uzlopak closed this as completed Dec 2, 2022
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

2 participants