goca icon indicating copy to clipboard operation
goca copied to clipboard

net.IP slice breaks swag generated documentation

Open necheffa opened this issue 7 months ago • 2 comments

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 avatar Jan 23 '24 04:01 necheffa