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",
"required": true,
"schema": {
"$ref": "#/definitions/dockerapi.StopRequest"
"$ref": "#/definitions/dockerapi.RestartRequest"
}
}
],
@@ -3515,6 +3515,16 @@
"x-nullable": 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": {
"type": "integer",
"x-nullable": false,
@@ -4198,9 +4208,13 @@
"x-omitempty": false
},
"healthcheck": {
"$ref": "#/definitions/HealthCheckConfig",
"x-nullable": false,
"x-omitempty": false
"description": "null on load-balancer routes",
"allOf": [
{
"$ref": "#/definitions/HealthCheckConfig"
}
],
"x-nullable": true
},
"homepage": {
"$ref": "#/definitions/HomepageItemConfig",
@@ -4916,12 +4930,16 @@
"x-nullable": false,
"x-omitempty": false
},
"container.Port": {
"container.PortSummary": {
"type": "object",
"properties": {
"IP": {
"description": "Host IP address that the container's port is mapped to",
"type": "string",
"allOf": [
{
"$ref": "#/definitions/netip.Addr"
}
],
"x-nullable": false,
"x-omitempty": false
},
@@ -4938,7 +4956,7 @@
"x-omitempty": false
},
"Type": {
"description": "type\nRequired: true",
"description": "type\nRequired: true\nEnum: [\"tcp\",\"udp\",\"sctp\"]",
"type": "string",
"x-nullable": false,
"x-omitempty": false
@@ -5033,6 +5051,29 @@
"x-nullable": 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": {
"type": "object",
"required": [
@@ -5066,7 +5107,7 @@
"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 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"
},
"timeout": {
@@ -5219,6 +5260,11 @@
"x-nullable": false,
"x-omitempty": false
},
"netip.Addr": {
"type": "object",
"x-nullable": false,
"x-omitempty": false
},
"route.Route": {
"type": "object",
"properties": {
@@ -5273,9 +5319,13 @@
"x-omitempty": false
},
"healthcheck": {
"$ref": "#/definitions/HealthCheckConfig",
"x-nullable": false,
"x-omitempty": false
"description": "null on load-balancer routes",
"allOf": [
{
"$ref": "#/definitions/HealthCheckConfig"
}
],
"x-nullable": true
},
"homepage": {
"$ref": "#/definitions/HomepageItemConfig",
@@ -5530,7 +5580,7 @@
"types.PortMapping": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/container.Port"
"$ref": "#/definitions/container.PortSummary"
},
"x-nullable": false,
"x-omitempty": false

View File

@@ -555,6 +555,10 @@ definitions:
options:
additionalProperties: {}
type: object
sticky:
type: boolean
sticky_max_age:
$ref: '#/definitions/time.Duration'
weight:
type: integer
type: object
@@ -881,7 +885,10 @@ definitions:
- $ref: '#/definitions/HealthJSON'
description: for swagger
healthcheck:
$ref: '#/definitions/HealthCheckConfig'
allOf:
- $ref: '#/definitions/HealthCheckConfig'
description: null on load-balancer routes
x-nullable: true
homepage:
$ref: '#/definitions/HomepageItemConfig'
host:
@@ -1248,11 +1255,12 @@ definitions:
- StateRemoving
- StateExited
- StateDead
container.Port:
container.PortSummary:
properties:
IP:
allOf:
- $ref: '#/definitions/netip.Addr'
description: Host IP address that the container's port is mapped to
type: string
PrivatePort:
description: |-
Port on the container
@@ -1265,6 +1273,7 @@ definitions:
description: |-
type
Required: true
Enum: ["tcp","udp","sctp"]
type: string
type: object
disk.IOCountersStat:
@@ -1316,6 +1325,30 @@ definitions:
used_percent:
type: number
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:
properties:
checkpointDir:
@@ -1335,7 +1368,7 @@ definitions:
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 not value is set, the default (SIGTERM) is used.
timeout expires. If no value is set, the default (SIGTERM) is used.
type: string
timeout:
description: |-
@@ -1429,6 +1462,8 @@ definitions:
description: godoxy
type: number
type: object
netip.Addr:
type: object
route.Route:
properties:
access_log:
@@ -1457,7 +1492,10 @@ definitions:
- $ref: '#/definitions/HealthJSON'
description: for swagger
healthcheck:
$ref: '#/definitions/HealthCheckConfig'
allOf:
- $ref: '#/definitions/HealthCheckConfig'
description: null on load-balancer routes
x-nullable: true
homepage:
$ref: '#/definitions/HomepageItemConfig'
host:
@@ -1592,7 +1630,7 @@ definitions:
type: object
types.PortMapping:
additionalProperties:
$ref: '#/definitions/container.Port'
$ref: '#/definitions/container.PortSummary'
type: object
widgets.Config:
properties:
@@ -2008,7 +2046,7 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/dockerapi.StopRequest'
$ref: '#/definitions/dockerapi.RestartRequest'
produces:
- application/json
responses:

View File

@@ -49,7 +49,7 @@ type (
PathPatterns []string `json:"path_patterns,omitempty" extensions:"x-nullable"`
Rules rules.Rules `json:"rules,omitempty" extension:"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"`
Middlewares map[string]types.LabelMap `json:"middlewares,omitempty" extensions:"x-nullable"`
Homepage *homepage.ItemConfig `json:"homepage"`