kairoaraujo / goca

Golang Certificate Authority (CA) package
MIT License
38 stars 14 forks source link

net.IP slice breaks swag generated documentation #33

Open necheffa opened 5 months ago

necheffa commented 5 months ago

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.

ZenkieBear commented 3 months ago

聪明宝宝

necheffa commented 2 months ago

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.