Skip to main content

Migrating from swaggo

apiary and swaggo solve the same problem from opposite directions: swaggo encodes the contract in comments; apiary reads it from your types.

Annotation mapping

swaggoapiary
@Summary / @Descriptionfirst/rest of the Go doc comment, or summary: / description:
@Tags a,btags: a, b
@Param body body T true ""the request parameter type T in the signature (or request: T)
@Success 200 {object} Rthe response type R in the signature (or response: R)
@Failure 400 {object} Eerrors: 400 E
@Router /p [post]apiary:operation POST /p
@Security BearerAuthsecurity: bearer (or global -security bearer)
@ID nameoperationId: name (auto-derived by default)

What you gain

  • No duplicated schema descriptions; struct tags and signatures are the truth.
  • OpenAPI 3.1 output.
  • Validation constraints from validate: tags you already write.
  • Real go/types resolution (cross-package, generics) instead of comment parsing.

What to check

  • apiary expects one of the supported handler signatures. For framework handlers (gin, net/http) add request: / response: annotations.
  • The scanned code must compile (apiary type-checks it).