API Explorer hangs on large service layer

I have 2 service layer projects, in the smaller one, the API Explorer works very well. In my larger one (550+ services), the API explorer page takes a very long time (20-30 minutes) before it will come up for any service. The last step of the console log reads:

info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET http://localhost:5000/DVSvc/ui/AdvLookups - -

Unfortunately we’ve exercised previous efforts in getting API Explorer to work with large APIs where it no longer uses JSONP to workaround the exceeded JS method callstack errors, so now you’re just hitting the resource limits of your browser & pc for handling the App metadata & render its UI.

Only real solution I can recommend is splitting your App into smaller microservices to reduce the App size & resources burden.

There’s also a potential for reducing the APIs you want to show up in API Explorer by modifying the metadata returned to reduce the APIs included in API Explorer, e.g. by not including APIs grouped within a tag:

this.AddToAppMetadata(meta => {
    meta.Api.Operations.RemoveAll(x => x.Tags?.Contains(tagName) != true);
});

Out of curiosity how large is your /metadata/app.json?

It’s 9.5 MB. Thanks for the info, I think we can use the tagging to get what we need

1 Like

In the latest v6.1.1 on MyGet I’ve added the ability to restrict the metadata & ui to only display the tag groups by adding ?IncludeTypes to the URL, e.g:

/ui/?IncludeTypes={tag}

This follows the Include Types pattern where you can view multiple tag groups with:

/ui/?IncludeTypes={tag1},{tag2}

This can also be used in Locode and Admin UI

1 Like

This is now integrated on the /metadata page where if you select a tag the API Explorer link will be updated with ?IncludeTypes={tag}

So your customers will be able to open API Explorer restricted to APIs with that tag without needing to manually craft the URL.

1 Like

I’ve just realised that the IncludeTypes parameter isn’t there for the individual operations, only the API Explorer link:

Is there a way I can alter those links easily?

Not really the links are hard coded and generated from the server which doesn’t know about the tab on the client.

Only solution I can see is keeping a modified copy of IndexOperations.html in your project at /Templates/IndexOperations.html then modifying the selectTag() function to rewrite the individual links.

Perfect! That did the trick!

1 Like