Documentation
¶
Overview ¶
Command dedupe-enums works around a swag v2.0.0-rc5 nondeterminism bug: loadExternalPackage (in swag's packages.go) reparses an external module's package without memoizing by import path, which can non-deterministically repeat the "enum"/"x-enum-varnames" arrays it emits for types defined outside this module (model.ArgumentType, model.Format, model.Icon from github.com/modelcontextprotocol/registry). The repeat count varies by machine — 2x and 3x have both been seen. When an array is the same block repeated back to back, this collapses it to one copy.
Run after `swag init`, on each generated docs/server file:
go run ./cmd/help/dedupe-enums docs/server/docs.go docs/server/swagger.json docs/server/swagger.yaml
Click to show internal directories.
Click to hide internal directories.