magidoc icon indicating copy to clipboard operation
magidoc copied to clipboard

Blacklisting

Open ashleyww93 opened this issue 2 years ago • 3 comments

Describe the problem

I have an API that I am building that has some functions that have no use for external users.

They are restricted via Authentication, but ideally, we wouldn't even want them in the documentation as they can never be called.

I think it would be useful if there was a way to blacklist parts of the schema so that they just are not included in the documentation.

Describe the proposed solution

Ideally, the website configuration would have an area for blacklists, which would support explicit names, wildcards and/or regex matching.

options: {
    blacklist: {
        queries: ["explicitQuery", "queriesWithWildcards*"],
        mutations: [],
        subscriptions: [],
    },
}

Importance

I cannot use Magidoc without it

ashleyww93 avatar Aug 14 '23 12:08 ashleyww93

Hi! We have considered this feature before, and the feature in itself is not that complex to implement.

Where it gets more complicated is when you have a type used only in a blacklisted query, then your type becomes orphan and it should naturally be excluded from the docs as well, but orphan detection is not that easy to do. That said, this is not strictly required.

I'd you want to dig into it, I'd gladly accept a pull request adding that, it should be relatively straightforward.

pelletier197 avatar Aug 16 '23 11:08 pelletier197

In our case we would only need to blacklist queries or mutations.

It could still be generated (it’s not the end of the world if someone tries to call them, as authentication will block it), but just hidden from the side menu.

Perhaps blacklisting is the wrong word for it, and they could simply be “hidden entities”.

Either way, I’d be happy to give this a try when I have the free time.

ashleyww93 avatar Aug 22 '23 19:08 ashleyww93