fix: rename schema field https_verify_cert to https_verify_certificate#438
fix: rename schema field https_verify_cert to https_verify_certificate#438jarvis9443 wants to merge 1 commit intomainfrom
Conversation
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.
📝 WalkthroughWalkthroughThis PR renames the HTTPS health check certificate verification configuration field from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/cli/src/linter/specs/upstream.spec.ts (1)
96-130: Add a complementary negative case for the deprecated key.Nice positive regression at Line 97. Consider adding one case with
https_verify_certexpecting failure so the strict-key rejection is explicitly locked in.Proposed test addition
+ { + name: 'should reject deprecated https_verify_cert on active health check', + input: { + services: [ + { + name: 'HealthCheck_HTTPS_Deprecated_VerifyCert', + upstream: { + nodes: [ + { + host: '1.1.1.1', + port: 443, + weight: 100, + }, + ], + checks: { + active: { + type: 'https', + http_path: '/', + https_verify_cert: true, + }, + }, + }, + }, + ], + } as unknown as ADCSDK.Configuration, + expect: false, + },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/cli/src/linter/specs/upstream.spec.ts` around lines 96 - 130, Add a negative test case mirroring the positive case "should accept https_verify_certificate on active health check" that uses the deprecated key name https_verify_cert (e.g., name it "should reject https_verify_cert on active health check") so the linter enforces strict keys; create a new test input that is identical to the existing service object (service name like "HealthCheck_HTTPS_VerifyCert") but in the upstream.checks.active object replace https_verify_certificate with https_verify_cert and set expect: false, and assert the validation failure via the same test harness used by the surrounding spec so the suite explicitly fails on the deprecated key.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/cli/src/linter/specs/upstream.spec.ts`:
- Around line 96-130: Add a negative test case mirroring the positive case
"should accept https_verify_certificate on active health check" that uses the
deprecated key name https_verify_cert (e.g., name it "should reject
https_verify_cert on active health check") so the linter enforces strict keys;
create a new test input that is identical to the existing service object
(service name like "HealthCheck_HTTPS_VerifyCert") but in the
upstream.checks.active object replace https_verify_certificate with
https_verify_cert and set expect: false, and assert the validation failure via
the same test harness used by the surrounding spec so the suite explicitly fails
on the deprecated key.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 45995db7-d427-48e2-a987-9d9e4a5f2d00
📒 Files selected for processing (4)
apps/cli/src/linter/specs/upstream.spec.tslibs/backend-apisix-standalone/src/typing.tslibs/sdk/src/core/schema.tsschema.json
The active health check schema in
libs/sdk/src/core/schema.tsandlibs/backend-apisix-standalone/src/typing.tsdefines the field ashttps_verify_cert, but the canonical name everywhere else ishttps_verify_certificate:apisix/schema_def.luaandlua-resty-healthcheck-api7Because the parent schema uses
z.strictObject,adc dumpof a service with an HTTPS active health check produces YAML that containshttps_verify_certificate: true, and the very nextadc sync/adc lintrejects it:Round-trip dump→sync is broken for any service using HTTPS active health checks. Reported in https://github.com/api7/api7ee-3-control-plane/issues/2629.
The existing e2e fixtures (
libs/backend-api7/e2e/default-value.e2e-spec.ts,libs/differ/src/test/usecase.spec.ts) already use the correcthttps_verify_certificate, but they don't go through the lint stage so the typo wasn't caught.This PR:
https_verify_certificateschema.jsonapps/cli/src/linter/specs/upstream.spec.tsVerified locally with
nx test cli(26 passed).Summary by CodeRabbit
Bug Fixes
Tests