Swagger UI hangs and become very slow after expanding the end point
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<PersonAddressInformation> personAddresses, IList<NodeAddressInformation> nodeAddresses, IList<CompanyAddressInformation> companyAddresses, IList<BankAddressInformation> 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
@prataparunsingh please provide the generated swagger definition.
Please find attached swagger.json file. swagger.zip
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.
Any update on this? I am seeing a similar issue with half the spec size
For a quick fix, is it possible not to allow the expansions?
https://github.com/argoproj/argo-workflows/issues/6645
Any progress on this, I am having the same issue, even with much smaller specs. Thanks
Any progress? I also have the same issue, even with 40 thousand rows of json. Thanks in advance.
Facing same issue here is my schema https://pastebin.com/efCJgYRN
On my part, it's not only the expanding that is slow, but writing in the request body section (free text json).
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.
Same issue here.
See https://app.screencast.com/28ukAb1Wq2iG4
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

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.
This solved the problem for me:
swaggerOptions: { syntaxHighlight: false, },
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',