You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Finally, when searching for other issues, several issues occurred during the period when Go added generics, and the problems were caused by the users using versions of the frameworks that were too old. However, my version is the latest v1.16.3, which is far beyond the required version for this feature, yet the problem still persists.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi
A type is defined as follows:
Add the following comments for the HTTP method in the Controller:
After executing the relevant commands, the OpenAPI was correctly generated, although the result was not what I expected.
To get the expected result, I added a generic to the Response struct:
Then I modified the comments in the HTTP function of the Controller:
After executing the relevant commands and regenerating the OpenAPI, an error occurred: "cannot find type definition".
I searched it in documentation, it clearly states that it supports Go generics: https://github.com/swaggo/swag/tree/master?tab=readme-ov-file#how-to-use-generics
Finally, when searching for other issues, several issues occurred during the period when Go added generics, and the problems were caused by the users using versions of the frameworks that were too old. However, my version is the latest v1.16.3, which is far beyond the required version for this feature, yet the problem still persists.
Has anyone encountered this issue before?
Beta Was this translation helpful? Give feedback.
All reactions