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

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

Open
prataparunsingh opened this issue Jan 7, 2021 · 16 comments
Open

Comments

@prataparunsingh
Copy link

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

@mathis-m
Copy link
Contributor

mathis-m commented Jan 7, 2021

@prataparunsingh please provide the generated swagger definition.

@prataparunsingh
Copy link
Author

Please find attached swagger.json file.
swagger.zip

@mathis-m
Copy link
Contributor

mathis-m commented Jan 7, 2021

Very large one! Nearly 1M lines of json sample that is beeing generated for the GetAddressesResponse.
I tracked it down to the response rendering. I have tried to disable highlighting the sample. But still does not render.

@ferrantejake
Copy link

Any update on this? I am seeing a similar issue with half the spec size

@russm3086
Copy link

For a quick fix, is it possible not to allow the expansions?

@alexec
Copy link

alexec commented Sep 1, 2021

@SkinnyPete63
Copy link

Any progress on this, I am having the same issue, even with much smaller specs. Thanks

@MelihCelik00
Copy link

Any progress? I also have the same issue, even with 40 thousand rows of json. Thanks in advance.

@prash-kr-meena
Copy link

Facing same issue
here is my schema https://pastebin.com/efCJgYRN

@billybraga
Copy link

On my part, it's not only the expanding that is slow, but writing in the request body section (free text json).

@MelihCelik00
Copy link

Hey y'all, in my case, the problem is the swagger ui itself. I tested in Postman and my api works very well even in large JSON response body. This solved my issue maybe it will be useful for you either.

@mdchafin
Copy link

Same issue here.

See https://app.screencast.com/28ukAb1Wq2iG4

@msures4
Copy link

msures4 commented Nov 15, 2022

I m also getting the same issue.When i open any of the endpoints the ui hang after a quite long time i found the response body the json generated for the entire db schema

image
image

@mnkhtrbukhbold
Copy link

On my part, it's not only the expanding that is slow, but writing in the request body section (free text json).

I am also facing this issue on dev.

@josteint
Copy link

josteint commented Mar 1, 2024

This solved the problem for me:
swaggerOptions: { syntaxHighlight: false, },

@yuryturing
Copy link

Still experiencing this issue. Example generator eagerly generates all nested properties w/o depth limitation. Is there any way to override this behaviour?

As a workaround I had to switch model rendering to render model by default. This helps with the initial operation expansion.

defaultModelRendering: 'model',

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

No branches or pull requests