Open arunpoudel opened 3 years ago
@arunpoudel, thanks for letting us know. If you have a solution to this issue, please feel free to contribute with a PR, and I will be more than happy to assist you with a code review.
Is there a reason why ref has to be set inorder for recursive structure to be parsed as reference? If we remove the ref check, then the document seem to be generated.
For embedded struct, all its field schemas, not a reference, are required to expand.
Describe the bug swaggo crashes when generating doc for recursive structure
To Reproduce I have prepared a sample that causes it to crash. Can be found at https://github.com/medsensio/swag-go-crash-demo
Expected behavior swagger documentation should be updated
Screenshots N/A
Exception
Your swag version 1.7.3
Your go version go version go1.17.1 linux/amd64
Desktop (please complete the following information):
Additional context I did some digging around and looks like https://github.com/swaggo/swag/blob/master/parser.go#L771 is the culprit.
Is there a reason why ref has to be set inorder for recursive structure to be parsed as reference? If we remove the ref check, then the document seem to be generated.