v2: Gin binding tag (binding:"...") leaks a stray "form" key into the schema
Author: ahridinCreated Jul 14, 2026Updated Jul 14, 2026
swag version: v2.0.0-rc5
A struct field tagged for Gin's binding validation, e.g.:
type Example struct {
Status string `json:"status" binding:"omitempty,oneof=a b c" form:"status"`
}produces a schema where the property object includes a bare "form": "status" key alongside the normal type/properties. form isn't a valid OpenAPI/JSON-Schema keyword, and strict validators (e.g. kin-openapi) reject the document with something like extra sibling fields: [form].
Expected: non-OpenAPI struct tags used only for Gin binding (form, etc.) shouldn't leak into the generated schema.
Actual: they're copied through verbatim as schema sibling keys.
Source: swaggo/swag