fix: enable strict mode for swagger generation & upgrade swag (#21975)

Adds a Go wrapper (`scripts/apidocgen/swaginit/main.go`) that calls
swag's Go API with `Strict: true`. The `--strict` flag isn't available
in swag's CLI in any version, so the wrapper is the only way to enable
it.

Also upgrades swag from v1.16.2 to v1.16.6 (better generics support,
precise numeric formats, `x-enum-descriptions`, CVE-2024-45338 fix).
This commit is contained in:
Marcin Tojek
2026-02-06 13:04:35 +01:00
committed by GitHub
parent 193e4bd73b
commit 456c0bced9
7 changed files with 97 additions and 25 deletions
+26 -8
View File
@@ -14901,6 +14901,16 @@ const docTemplate = `{
"ExperimentWorkspaceSharing": "Enables updating workspace ACLs for sharing with users and groups.",
"ExperimentWorkspaceUsage": "Enables the new workspace usage tracking."
},
"x-enum-descriptions": [
"This isn't used for anything.",
"This should not be taken out of experiments until we have redesigned the feature.",
"Sends notifications via SMTP and webhooks following certain events.",
"Enables the new workspace usage tracking.",
"Enables web push notifications through the browser.",
"Enables OAuth2 provider functionality.",
"Enables the MCP HTTP server functionality.",
"Enables updating workspace ACLs for sharing with users and groups."
],
"x-enum-varnames": [
"ExperimentExample",
"ExperimentAutoFillParameters",
@@ -21495,10 +21505,12 @@ const docTemplate = `{
"type": "object",
"properties": {
"p50": {
"type": "number"
"type": "number",
"format": "float64"
},
"p95": {
"type": "number"
"type": "number",
"format": "float64"
}
}
},
@@ -21884,10 +21896,12 @@ const docTemplate = `{
]
},
"recv": {
"type": "integer"
"type": "integer",
"format": "int64"
},
"sent": {
"type": "integer"
"type": "integer",
"format": "int64"
}
}
},
@@ -22514,21 +22528,24 @@ const docTemplate = `{
"description": "keyed by DERP Region ID",
"type": "object",
"additionalProperties": {
"type": "integer"
"type": "integer",
"format": "int64"
}
},
"regionV4Latency": {
"description": "keyed by DERP Region ID",
"type": "object",
"additionalProperties": {
"type": "integer"
"type": "integer",
"format": "int64"
}
},
"regionV6Latency": {
"description": "keyed by DERP Region ID",
"type": "object",
"additionalProperties": {
"type": "integer"
"type": "integer",
"format": "int64"
}
},
"udp": {
@@ -22771,7 +22788,8 @@ const docTemplate = `{
"description": "RegionScore scales latencies of DERP regions by a given scaling\nfactor when determining which region to use as the home\n(\"preferred\") DERP. Scores in the range (0, 1) will cause this\nregion to be proportionally more preferred, and scores in the range\n(1, ∞) will penalize a region.\n\nIf a region is not present in this map, it is treated as having a\nscore of 1.0.\n\nScores should not be 0 or negative; such scores will be ignored.\n\nA nil map means no change from the previous value (if any); an empty\nnon-nil map can be sent to reset all scores back to 1.0.",
"type": "object",
"additionalProperties": {
"type": "number"
"type": "number",
"format": "float64"
}
}
}
+26 -8
View File
@@ -13442,6 +13442,16 @@
"ExperimentWorkspaceSharing": "Enables updating workspace ACLs for sharing with users and groups.",
"ExperimentWorkspaceUsage": "Enables the new workspace usage tracking."
},
"x-enum-descriptions": [
"This isn't used for anything.",
"This should not be taken out of experiments until we have redesigned the feature.",
"Sends notifications via SMTP and webhooks following certain events.",
"Enables the new workspace usage tracking.",
"Enables web push notifications through the browser.",
"Enables OAuth2 provider functionality.",
"Enables the MCP HTTP server functionality.",
"Enables updating workspace ACLs for sharing with users and groups."
],
"x-enum-varnames": [
"ExperimentExample",
"ExperimentAutoFillParameters",
@@ -19744,10 +19754,12 @@
"type": "object",
"properties": {
"p50": {
"type": "number"
"type": "number",
"format": "float64"
},
"p95": {
"type": "number"
"type": "number",
"format": "float64"
}
}
},
@@ -20112,10 +20124,12 @@
]
},
"recv": {
"type": "integer"
"type": "integer",
"format": "int64"
},
"sent": {
"type": "integer"
"type": "integer",
"format": "int64"
}
}
},
@@ -20698,21 +20712,24 @@
"description": "keyed by DERP Region ID",
"type": "object",
"additionalProperties": {
"type": "integer"
"type": "integer",
"format": "int64"
}
},
"regionV4Latency": {
"description": "keyed by DERP Region ID",
"type": "object",
"additionalProperties": {
"type": "integer"
"type": "integer",
"format": "int64"
}
},
"regionV6Latency": {
"description": "keyed by DERP Region ID",
"type": "object",
"additionalProperties": {
"type": "integer"
"type": "integer",
"format": "int64"
}
},
"udp": {
@@ -20949,7 +20966,8 @@
"description": "RegionScore scales latencies of DERP regions by a given scaling\nfactor when determining which region to use as the home\n(\"preferred\") DERP. Scores in the range (0, 1) will cause this\nregion to be proportionally more preferred, and scores in the range\n(1, ∞) will penalize a region.\n\nIf a region is not present in this map, it is treated as having a\nscore of 1.0.\n\nScores should not be 0 or negative; such scores will be ignored.\n\nA nil map means no change from the previous value (if any); an empty\nnon-nil map can be sent to reset all scores back to 1.0.",
"type": "object",
"additionalProperties": {
"type": "number"
"type": "number",
"format": "float64"
}
}
}