v2: empty externalDocs.url emitted when no @externalDocs annotation is present
Author: ahridinCreated Jul 14, 2026Updated Jul 14, 2026
swag version: v2.0.0-rc5
With no @externalDocs.url annotation anywhere, the generated document still includes:
"externalDocs": { "url": "" }An empty string isn't a valid uri-format value, so strict validators reject the document (externalDocs.url must match format "uri").
Expected: omit externalDocs entirely when no URL was ever set, rather than emitting it with an empty/invalid url.
Source: swaggo/swag