From a79b54f7bbeb5cf4ddd2072e36cb42822bc63a87 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Tue, 28 Apr 2026 11:49:47 +0800 Subject: [PATCH] fix: rename schema field https_verify_cert to https_verify_certificate The active health check schema in libs/sdk/src/core/schema.ts and libs/backend-apisix-standalone/src/typing.ts used `https_verify_cert`, but the canonical name in APISIX (apisix/schema_def.lua) and the Dashboard API is `https_verify_certificate`. Because the parent schema uses z.strictObject, `adc dump` of a service with an HTTPS active health check produces YAML that `adc sync` (and `adc lint`) then rejects with: Unrecognized key: "https_verify_certificate". Rename the schema field, regenerate schema.json, and add a regression test to upstream linter spec. --- apps/cli/src/linter/specs/upstream.spec.ts | 35 ++++++++++++++++++++ libs/backend-apisix-standalone/src/typing.ts | 2 +- libs/sdk/src/core/schema.ts | 2 +- schema.json | 4 +-- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/apps/cli/src/linter/specs/upstream.spec.ts b/apps/cli/src/linter/specs/upstream.spec.ts index 363daf36..7ce49df5 100644 --- a/apps/cli/src/linter/specs/upstream.spec.ts +++ b/apps/cli/src/linter/specs/upstream.spec.ts @@ -93,6 +93,41 @@ describe('Upstream Linter', () => { } as ADCSDK.Configuration, expect: true, }, + { + name: 'should accept https_verify_certificate on active health check', + input: { + services: [ + { + name: 'HealthCheck_HTTPS_VerifyCert', + upstream: { + nodes: [ + { + host: '1.1.1.1', + port: 443, + weight: 100, + }, + ], + checks: { + active: { + type: 'https', + http_path: '/', + https_verify_certificate: true, + healthy: { + interval: 2, + successes: 1, + }, + unhealthy: { + interval: 1, + timeouts: 3, + }, + }, + }, + }, + }, + ], + } as ADCSDK.Configuration, + expect: true, + }, { name: 'should only allow upstream mtls in client_cert and client_key', input: { diff --git a/libs/backend-apisix-standalone/src/typing.ts b/libs/backend-apisix-standalone/src/typing.ts index 60638d4e..25f6ef14 100644 --- a/libs/backend-apisix-standalone/src/typing.ts +++ b/libs/backend-apisix-standalone/src/typing.ts @@ -146,7 +146,7 @@ const UpstreamSchema = z.strictObject({ host: z.string().min(1).optional(), port: z.coerce.number().int().min(1).max(65535).optional(), http_path: z.string().default('/').optional(), - https_verify_cert: z.boolean().default(true).optional(), + https_verify_certificate: z.boolean().default(true).optional(), http_request_headers: z.array(z.string()).min(1).optional(), healthy: z .strictObject({ diff --git a/libs/sdk/src/core/schema.ts b/libs/sdk/src/core/schema.ts index 6c9bcbbb..b40686a7 100644 --- a/libs/sdk/src/core/schema.ts +++ b/libs/sdk/src/core/schema.ts @@ -119,7 +119,7 @@ const upstreamSchema = (extend?: ZodRawShape) => host: hostSchema.optional(), port: portSchema.optional(), http_path: z.string().default('/').optional(), - https_verify_cert: z.boolean().default(true).optional(), + https_verify_certificate: z.boolean().default(true).optional(), http_request_headers: z.array(z.string()).min(1).optional(), healthy: z .strictObject({ diff --git a/schema.json b/schema.json index 898ab646..b5989657 100644 --- a/schema.json +++ b/schema.json @@ -124,7 +124,7 @@ "default": "/", "type": "string" }, - "https_verify_cert": { + "https_verify_certificate": { "default": true, "type": "boolean" }, @@ -556,7 +556,7 @@ "default": "/", "type": "string" }, - "https_verify_cert": { + "https_verify_certificate": { "default": true, "type": "boolean" },