#2194·swag

v2 --v3.1: leftover OpenAPI 2.0 fields (schemes, host, basePath) in the output

Author: ahridinCreated Jul 14, 2026Updated Jul 14, 2026

swag version: v2.0.0-rc5 Command: swag init --v3.1 ...

Running swag init with --v3.1 still emits schemes, host, and basePath at the document root. These are Swagger 2.0-only keys — OpenAPI 3.x replaced them with servers. Their presence doesn't break strict validators, but it's inconsistent with an otherwise-3.1 document and can confuse anything that fingerprints the version by field presence rather than the openapi key.

Expected: with --v3.1, the generator should omit schemes/host/basePath entirely (or only emit them under --v2).

Actual: all three keys are present regardless of --v3.1.