swagger-api / swagger-api/swagger-ui

Swagger UI hangs and become very slow after expanding the end point

Open
#6,787 16 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: support
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Hi Team,

I have integrated swagger to my API controller. The UI gets hanged once I click to expand any of the endpoint. I some analysis I figured out this is because of the complexity of the Response schema. Please find the class definition below.

public class AddressTypeInformation : IInformationWithKey, IDataTransferObjectBase
{
public AddressTypeInformation();
public AddressTypeInformation(string id, long myId, int? addressTypeNumber, string name, string description, int status, IList personAddresses, IList nodeAddresses, IList companyAddresses, IList bankAddresses);

    public virtual string InformationKey { get; set; }
    public virtual string Id { get; set; }
    public virtual long MyId { get; set; }
    public virtual int? AddressTypeNumber { get; set; }
    public virtual string Name { get; set; }
    public virtual string Description { get; set; }
    public virtual int Status { get; set; }
    public virtual IList<PersonAddressInformation> PersonAddresses { get; set; }
    public virtual IList<NodeAddressInformation> NodeAddresses { get; set; }
    public virtual IList<CompanyAddressInformation> CompanyAddresses { get; set; }
    public virtual IList<BankAddressInformation> BankAddresses { get; set; }

Once I remove the last four properties (of IList type) from the response class definition, it works fine.

Can you please help me on this. Is there any work around to handle complex schema in swagger.

Thanks,
Arun

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the hang in Swagger UI when expanding an endpoint whose response schema contains the four nested IList properties described in the issue. Trace the endpoint-expansion and complex-schema rendering path, then verify that the same schema expands without freezing or becoming unacceptably slow.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.