fix(types/route): update HealthCheck JSON tag to be nullable for load-balancer routes

This commit is contained in:
yusing
2025-11-14 22:16:30 +08:00
parent 84b17baf46
commit 28fdf3d2f4
3 changed files with 108 additions and 20 deletions

View File

@@ -618,7 +618,7 @@
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/dockerapi.StopRequest" "$ref": "#/definitions/dockerapi.RestartRequest"
} }
} }
], ],
@@ -3515,6 +3515,16 @@
"x-nullable": false, "x-nullable": false,
"x-omitempty": false "x-omitempty": false
}, },
"sticky": {
"type": "boolean",
"x-nullable": false,
"x-omitempty": false
},
"sticky_max_age": {
"$ref": "#/definitions/time.Duration",
"x-nullable": false,
"x-omitempty": false
},
"weight": { "weight": {
"type": "integer", "type": "integer",
"x-nullable": false, "x-nullable": false,
@@ -4198,9 +4208,13 @@
"x-omitempty": false "x-omitempty": false
}, },
"healthcheck": { "healthcheck": {
"$ref": "#/definitions/HealthCheckConfig", "description": "null on load-balancer routes",
"x-nullable": false, "allOf": [
"x-omitempty": false {
"$ref": "#/definitions/HealthCheckConfig"
}
],
"x-nullable": true
}, },
"homepage": { "homepage": {
"$ref": "#/definitions/HomepageItemConfig", "$ref": "#/definitions/HomepageItemConfig",
@@ -4916,12 +4930,16 @@
"x-nullable": false, "x-nullable": false,
"x-omitempty": false "x-omitempty": false
}, },
"container.Port": { "container.PortSummary": {
"type": "object", "type": "object",
"properties": { "properties": {
"IP": { "IP": {
"description": "Host IP address that the container's port is mapped to", "description": "Host IP address that the container's port is mapped to",
"type": "string", "allOf": [
{
"$ref": "#/definitions/netip.Addr"
}
],
"x-nullable": false, "x-nullable": false,
"x-omitempty": false "x-omitempty": false
}, },
@@ -4938,7 +4956,7 @@
"x-omitempty": false "x-omitempty": false
}, },
"Type": { "Type": {
"description": "type\nRequired: true", "description": "type\nRequired: true\nEnum: [\"tcp\",\"udp\",\"sctp\"]",
"type": "string", "type": "string",
"x-nullable": false, "x-nullable": false,
"x-omitempty": false "x-omitempty": false
@@ -5033,6 +5051,29 @@
"x-nullable": false, "x-nullable": false,
"x-omitempty": false "x-omitempty": false
}, },
"dockerapi.RestartRequest": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "string",
"x-nullable": false,
"x-omitempty": false
},
"signal": {
"description": "Signal (optional) is the signal to send to the container to (gracefully)\nstop it before forcibly terminating the container with SIGKILL after the\ntimeout expires. If no value is set, the default (SIGTERM) is used.",
"type": "string"
},
"timeout": {
"description": "Timeout (optional) is the timeout (in seconds) to wait for the container\nto stop gracefully before forcibly terminating it with SIGKILL.\n\n- Use nil to use the default timeout (10 seconds).\n- Use '-1' to wait indefinitely.\n- Use '0' to not wait for the container to exit gracefully, and\n immediately proceeds to forcibly terminating the container.\n- Other positive values are used as timeout (in seconds).",
"type": "integer"
}
},
"x-nullable": false,
"x-omitempty": false
},
"dockerapi.StartRequest": { "dockerapi.StartRequest": {
"type": "object", "type": "object",
"required": [ "required": [
@@ -5066,7 +5107,7 @@
"x-omitempty": false "x-omitempty": false
}, },
"signal": { "signal": {
"description": "Signal (optional) is the signal to send to the container to (gracefully)\nstop it before forcibly terminating the container with SIGKILL after the\ntimeout expires. If not value is set, the default (SIGTERM) is used.", "description": "Signal (optional) is the signal to send to the container to (gracefully)\nstop it before forcibly terminating the container with SIGKILL after the\ntimeout expires. If no value is set, the default (SIGTERM) is used.",
"type": "string" "type": "string"
}, },
"timeout": { "timeout": {
@@ -5219,6 +5260,11 @@
"x-nullable": false, "x-nullable": false,
"x-omitempty": false "x-omitempty": false
}, },
"netip.Addr": {
"type": "object",
"x-nullable": false,
"x-omitempty": false
},
"route.Route": { "route.Route": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -5273,9 +5319,13 @@
"x-omitempty": false "x-omitempty": false
}, },
"healthcheck": { "healthcheck": {
"$ref": "#/definitions/HealthCheckConfig", "description": "null on load-balancer routes",
"x-nullable": false, "allOf": [
"x-omitempty": false {
"$ref": "#/definitions/HealthCheckConfig"
}
],
"x-nullable": true
}, },
"homepage": { "homepage": {
"$ref": "#/definitions/HomepageItemConfig", "$ref": "#/definitions/HomepageItemConfig",
@@ -5530,7 +5580,7 @@
"types.PortMapping": { "types.PortMapping": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/definitions/container.Port" "$ref": "#/definitions/container.PortSummary"
}, },
"x-nullable": false, "x-nullable": false,
"x-omitempty": false "x-omitempty": false

View File

@@ -555,6 +555,10 @@ definitions:
options: options:
additionalProperties: {} additionalProperties: {}
type: object type: object
sticky:
type: boolean
sticky_max_age:
$ref: '#/definitions/time.Duration'
weight: weight:
type: integer type: integer
type: object type: object
@@ -881,7 +885,10 @@ definitions:
- $ref: '#/definitions/HealthJSON' - $ref: '#/definitions/HealthJSON'
description: for swagger description: for swagger
healthcheck: healthcheck:
$ref: '#/definitions/HealthCheckConfig' allOf:
- $ref: '#/definitions/HealthCheckConfig'
description: null on load-balancer routes
x-nullable: true
homepage: homepage:
$ref: '#/definitions/HomepageItemConfig' $ref: '#/definitions/HomepageItemConfig'
host: host:
@@ -1248,11 +1255,12 @@ definitions:
- StateRemoving - StateRemoving
- StateExited - StateExited
- StateDead - StateDead
container.Port: container.PortSummary:
properties: properties:
IP: IP:
allOf:
- $ref: '#/definitions/netip.Addr'
description: Host IP address that the container's port is mapped to description: Host IP address that the container's port is mapped to
type: string
PrivatePort: PrivatePort:
description: |- description: |-
Port on the container Port on the container
@@ -1265,6 +1273,7 @@ definitions:
description: |- description: |-
type type
Required: true Required: true
Enum: ["tcp","udp","sctp"]
type: string type: string
type: object type: object
disk.IOCountersStat: disk.IOCountersStat:
@@ -1316,6 +1325,30 @@ definitions:
used_percent: used_percent:
type: number type: number
type: object type: object
dockerapi.RestartRequest:
properties:
id:
type: string
signal:
description: |-
Signal (optional) is the signal to send to the container to (gracefully)
stop it before forcibly terminating the container with SIGKILL after the
timeout expires. If no value is set, the default (SIGTERM) is used.
type: string
timeout:
description: |-
Timeout (optional) is the timeout (in seconds) to wait for the container
to stop gracefully before forcibly terminating it with SIGKILL.
- Use nil to use the default timeout (10 seconds).
- Use '-1' to wait indefinitely.
- Use '0' to not wait for the container to exit gracefully, and
immediately proceeds to forcibly terminating the container.
- Other positive values are used as timeout (in seconds).
type: integer
required:
- id
type: object
dockerapi.StartRequest: dockerapi.StartRequest:
properties: properties:
checkpointDir: checkpointDir:
@@ -1335,7 +1368,7 @@ definitions:
description: |- description: |-
Signal (optional) is the signal to send to the container to (gracefully) Signal (optional) is the signal to send to the container to (gracefully)
stop it before forcibly terminating the container with SIGKILL after the stop it before forcibly terminating the container with SIGKILL after the
timeout expires. If not value is set, the default (SIGTERM) is used. timeout expires. If no value is set, the default (SIGTERM) is used.
type: string type: string
timeout: timeout:
description: |- description: |-
@@ -1429,6 +1462,8 @@ definitions:
description: godoxy description: godoxy
type: number type: number
type: object type: object
netip.Addr:
type: object
route.Route: route.Route:
properties: properties:
access_log: access_log:
@@ -1457,7 +1492,10 @@ definitions:
- $ref: '#/definitions/HealthJSON' - $ref: '#/definitions/HealthJSON'
description: for swagger description: for swagger
healthcheck: healthcheck:
$ref: '#/definitions/HealthCheckConfig' allOf:
- $ref: '#/definitions/HealthCheckConfig'
description: null on load-balancer routes
x-nullable: true
homepage: homepage:
$ref: '#/definitions/HomepageItemConfig' $ref: '#/definitions/HomepageItemConfig'
host: host:
@@ -1592,7 +1630,7 @@ definitions:
type: object type: object
types.PortMapping: types.PortMapping:
additionalProperties: additionalProperties:
$ref: '#/definitions/container.Port' $ref: '#/definitions/container.PortSummary'
type: object type: object
widgets.Config: widgets.Config:
properties: properties:
@@ -2008,7 +2046,7 @@ paths:
name: request name: request
required: true required: true
schema: schema:
$ref: '#/definitions/dockerapi.StopRequest' $ref: '#/definitions/dockerapi.RestartRequest'
produces: produces:
- application/json - application/json
responses: responses:

View File

@@ -49,7 +49,7 @@ type (
PathPatterns []string `json:"path_patterns,omitempty" extensions:"x-nullable"` PathPatterns []string `json:"path_patterns,omitempty" extensions:"x-nullable"`
Rules rules.Rules `json:"rules,omitempty" extension:"x-nullable"` Rules rules.Rules `json:"rules,omitempty" extension:"x-nullable"`
RuleFile string `json:"rule_file,omitempty" extensions:"x-nullable"` RuleFile string `json:"rule_file,omitempty" extensions:"x-nullable"`
HealthCheck *types.HealthCheckConfig `json:"healthcheck"` HealthCheck *types.HealthCheckConfig `json:"healthcheck,omitempty" extensions:"x-nullable"` // null on load-balancer routes
LoadBalance *types.LoadBalancerConfig `json:"load_balance,omitempty" extensions:"x-nullable"` LoadBalance *types.LoadBalancerConfig `json:"load_balance,omitempty" extensions:"x-nullable"`
Middlewares map[string]types.LabelMap `json:"middlewares,omitempty" extensions:"x-nullable"` Middlewares map[string]types.LabelMap `json:"middlewares,omitempty" extensions:"x-nullable"`
Homepage *homepage.ItemConfig `json:"homepage"` Homepage *homepage.ItemConfig `json:"homepage"`