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

Feature Request: Support for automatic URI parameter extraction from struct tags #1957

Open
Kerblif opened this issue Jan 3, 2025 · 0 comments

Comments

@Kerblif
Copy link

Kerblif commented Jan 3, 2025

Is your feature request related to a problem? Please describe.

Currently, I have to manually define URI parameters in my Go code when using swag to generate documentation. This can be tedious and error-prone, especially when dealing with structs that have multiple fields.

Describe the solution you'd like

I would like swag to automatically extract URI parameters from struct tags. For example, if I have the following struct:

type EditCountryRequest struct {
    Name string `form:"name" json:"name" binding:"required"`
    Code string `uri:"code" binding:"required"`
}

swag should recognize that Code is a URI parameter (based on the uri:"code" tag) and include it in the generated documentation accordingly. This would streamline the process of defining API endpoints and reduce the risk of errors.

Describe alternatives you've considered

I could continue to manually define URI parameters, but this is not ideal. I could also explore other documentation generators, but I prefer swag due to its ease of use and integration with Go.

Additional context

This feature would be particularly useful for APIs that have many endpoints with complex URI structures. It would also improve the consistency and accuracy of documentation.

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

No branches or pull requests

1 participant