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

net.IP slice breaks swag generated documentation #33

Open
necheffa opened this issue Jan 23, 2024 · 2 comments
Open

net.IP slice breaks swag generated documentation #33

necheffa opened this issue Jan 23, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@necheffa
Copy link
Collaborator

The tags on the goca.Identity.IPAddresses field for swag generated documentation cause the doc tests to fail. Swag doesn't know what to do with the []net.IP type when parsing the provided example.

As a temporary workaround, the tag can be replaced with swaggerignore:"true" to have swag skip it.

The swaggertype tag can be used to provide a type hint to swag, but since byte isn't a primitive type to swag, it fails on this too. (net.IP is a typedef of []byte).

According to the swag README section "Use swaggertype tag to supported custom type" we may be able to implement the encoding.JSON.Marshaler interface and use the swaggertype tag to get example parsing working.

@necheffa necheffa added the documentation Improvements or additions to documentation label Jan 23, 2024
@ZacharyBear
Copy link
Contributor

聪明宝宝

@necheffa
Copy link
Collaborator Author

PR #37 introduces a workaround by removing the example from tags for the goca.Identity.IPAddresses field.

Ideally we will be able to figure out how to support IP address examples with swaggo at some point.

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

No branches or pull requests

2 participants