Skip to content

feat(server): validate api#440

Merged
bzp2010 merged 6 commits intomainfrom
bzp/feat-server-validate-api
May 7, 2026
Merged

feat(server): validate api#440
bzp2010 merged 6 commits intomainfrom
bzp/feat-server-validate-api

Conversation

@bzp2010
Copy link
Copy Markdown
Collaborator

@bzp2010 bzp2010 commented May 6, 2026

Description

Add the validate API to help improve the pre-check warning experience in AIC.

The input format for this new API is the same as that of /sync.

The output structure is:

// success
{ "success": true, "source": "validate", "errors": [] }
// failed (lint invalid)
{
  "success": false,
  "source": "lint",
  "message": "[\n  {\n    \"code\": \"invalid_value\",\n    \"values\": [\n      \"GET\",\n      \"POST\",\n      \"PUT\",\n      \"DELETE\",\n      \"PATCH\",\n      \"HEAD\",\n      \"OPTIONS\",\n      \"CONNECT\",\n      \"TRACE\",\n      \"PURGE\"\n    ],\n    \"path\": [\n      \"services\",\n      0,\n      \"routes\",\n      0,\n      \"methods\",\n      0\n    ],\n    \"message\": \"Invalid option: expected one of \\\"GET\\\"|\\\"POST\\\"|\\\"PUT\\\"|\\\"DELETE\\\"|\\\"PATCH\\\"|\\\"HEAD\\\"|\\\"OPTIONS\\\"|\\\"CONNECT\\\"|\\\"TRACE\\\"|\\\"PURGE\\\"\"\n  }\n]",
  "errors": [
    {
      "code": "invalid_value",
      "values": [
        "GET",
        "POST",
        "PUT",
        "DELETE",
        "PATCH",
        "HEAD",
        "OPTIONS",
        "CONNECT",
        "TRACE",
        "PURGE"
      ],
      "path": [
        "services",
        0,
        "routes",
        0,
        "methods",
        0
      ],
      "message": "Invalid option: expected one of \"GET\"|\"POST\"|\"PUT\"|\"DELETE\"|\"PATCH\"|\"HEAD\"|\"OPTIONS\"|\"CONNECT\"|\"TRACE\"|\"PURGE\""
    }
  ]
}
// failed (server-side invalid)
{
  "success": false,
  "source": "validate",
  "message": "Configuration validation failed",
  "errors": [
    {
      "resource_type": "routes",
      "index": 0,
      "error": "doesn't match the schema: doesn't match schema due to: doesn't match schema due to: Error at \"/methods/0\": value is not one of the allowed values [\"GET\",\"POST\",\"PUT\",\"DELETE\",\"PATCH\",\"HEAD\",\"OPTIONS\",\"CONNECT\",\"TRACE\"]\nSchema:\n  {\n    \"description\": \"The API (HTTP) method.\",\n    \"enum\": [\n      \"GET\",\n      \"POST\",\n      \"PUT\",\n      \"DELETE\",\n      \"PATCH\",\n      \"HEAD\",\n      \"OPTIONS\",\n      \"CONNECT\",\n      \"TRACE\"\n    ],\n    \"type\": \"string\"\n  }\n\nValue:\n  \"GsET\"\n",
      "resource_name": "get-anything",
      "event": {
        "resourceType": "route",
        "type": "create",
        "resourceId": "0d8b769ef76efe141b7bc6531e6052e112b6c2e2",
        "resourceName": "get-anything",
        "newValue": {
          "description": "Returns anything passed in request data.",
          "methods": [
            "GsET"
          ],
          "name": "get-anything",
          "uris": [
            "/anything",
            "/anything-alias",
            "/anything-alternative"
          ],
          "id": "0d8b769ef76efe141b7bc6531e6052e112b6c2e2"
        },
        "parentId": "69cb66da8dca7f69f47d482c6a9899404d81ee4e"
      }
    },
    {
      "resource_type": "routes",
      "index": 1,
      "error": "doesn't match the schema: doesn't match schema due to: doesn't match schema due to: Error at \"/methods/0\": value is not one of the allowed values [\"GET\",\"POST\",\"PUT\",\"DELETE\",\"PATCH\",\"HEAD\",\"OPTIONS\",\"CONNECT\",\"TRACE\"]\nSchema:\n  {\n    \"description\": \"The API (HTTP) method.\",\n    \"enum\": [\n      \"GET\",\n      \"POST\",\n      \"PUT\",\n      \"DELETE\",\n      \"PATCH\",\n      \"HEAD\",\n      \"OPTIONS\",\n      \"CONNECT\",\n      \"TRACE\"\n    ],\n    \"type\": \"string\"\n  }\n\nValue:\n  \"POdST\"\n",
      "resource_name": "post-anything",
      "event": {
        "resourceType": "route",
        "type": "create",
        "resourceId": "821fe4344207fa1856bc2292d19c704afa88d23c",
        "resourceName": "post-anything",
        "newValue": {
          "description": "Returns anything passed in request data.",
          "labels": {
            "g": "g"
          },
          "methods": [
            "POdST"
          ],
          "name": "post-anything",
          "uris": [
            "/anything",
            "/post-alias",
            "/post-alternative"
          ],
          "id": "821fe4344207fa1856bc2292d19c704afa88d23c"
        },
        "parentId": "69cb66da8dca7f69f47d482c6a9899404d81ee4e"
      }
    }
  ]
}

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible

Summary by CodeRabbit

  • New Features

    • Added a /validate endpoint to validate configs, optionally run lint checks, and return structured success/error responses.
    • Validation errors now include richer context linking errors back to affected resources/events.
  • Tests

    • Added end-to-end tests for /validate (empty, valid, invalid, lint-fail cases).
    • Added unit tests for validator behavior and error-to-resource mapping.
  • Chores

    • Mock backend enhanced to support validation semantics for tests.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds a server-side validation flow: a new PUT /validate handler that accepts ValidateInput, diffs local config to produce events, invokes backend.validate, and returns structured validation results. Backend validators were extended to track per-resource event mappings; the SDK error type now carries optional event references. Tests and mock wiring for validate were added.

Changes

Server-Side Validation Feature

Layer / File(s) Summary
Schema / Types
apps/cli/src/server/schema.ts, libs/sdk/src/backend/index.ts
Introduce ValidateTask, export ValidateInput / ValidateInputType; BackendValidationError gains optional event?: ADCSDK.Event.
Core Validator Payload
libs/backend-api7/src/validator.ts, libs/backend-apisix/src/validator.ts
buildRequestBody now returns { body, nameIndex, eventIndex }. Validators populate eventIndex per resource and augment translated errors with resource_name and optional event.
Validation Handler Implementation
apps/cli/src/server/validate.ts
Add validateHandler: parse/validate input, filter config, optional lint, fill labels, init backend with HTTP/TLS agents, diff local vs empty remote to produce events, verify backend.validate exists, call backend.validate(events) and return { success, message?, errors } with logging and error handling.
Server Wiring
apps/cli/src/server/index.ts
Import and register route: PUT /validatevalidateHandler.
Mock & E2E
apps/cli/e2e/support/utils.ts, apps/cli/e2e/server/validate.e2e-spec.ts
MockBackend gains validate(events: ADCSDK.Event[]) returning success/empty errors; new E2E tests exercise /validate (empty config, valid config, invalid input, lint failure).
Validator Unit Tests
libs/backend-apisix/test/validator.spec.ts, libs/backend-api7/test/validator.spec.ts
New unit tests (mocking axios) assert validation errors are mapped back to ADC events, cover multiple/error-index-edge cases and version checks.
Diff / Logging Hygiene
apps/cli/src/server/sync.ts
Sanitize sensitive headers in AXIOS_DEBUG logging for backend requests.
Build Config
libs/backend-apisix-standalone/tsconfig.lib.json
Add "types": ["node"] and update references to include backend-apisix tsconfig first.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ADCServer
  participant Differ
  participant Backend
  participant Validator

  Client->>ADCServer: PUT /validate (ValidateInput)
  ADCServer->>ADCServer: validate input schema, lint, fill labels
  ADCServer->>Differ: DifferV3.diff(local, {} , backend.defaultValue())
  Differ-->>ADCServer: events[]
  ADCServer->>Backend: backend.validate(events)
  Backend-->>Validator: translate & send validate request (body + eventIndex)
  Validator-->>Backend: validation response (errors or success)
  Backend-->>ADCServer: BackendValidateResult (errors augmented with event)
  ADCServer-->>Client: 200 { success, errors }
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • api7/adc#434: Implements the same server-side "validate" feature with Validator and validate() integrations.
  • api7/adc#433: Modifies backend validation flow and API, related to validate behavior changes.
  • api7/adc#432: Adds backend validation functionality with SDK validation types and Validator support.

Suggested labels

test/api7, test/apisix-standalone

Suggested reviewers

  • nic-6443

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Security Check ❌ Error CRITICAL: validate.ts logs X-API-KEY in request headers (line 86) unlike sync.ts. Also, unsanitized error logging (line 147) exposes axios error config with credentials. Remove headers from line 86 request logging to match sync.ts. Sanitize error responses in catch block to prevent credential leakage from toString(err) on axios errors containing config.
E2e Test Quality Review ⚠️ Warning E2E tests do not cover backend validation failures. MockBackend always returns success: true, leaving error paths untested. Missing scenarios for validation errors, backend support failure. Add tests for backend validation errors with details, unsupported backend, and multiple errors. Mock backend to emit validation errors.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(server): validate api' directly corresponds to the main change: a new validate API endpoint for the ADC server.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bzp/feat-server-validate-api

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
apps/cli/e2e/server/basic.e2e-spec.ts (1)

267-353: ⚡ Quick win

Add a failing backend-validation case.

The new tests cover parse/lint failures, but they never exercise the core branch where backend.validate() returns { success: false, errorMessage, errors }. Without that, the response contract described in this PR is still unpinned.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/cli/e2e/server/basic.e2e-spec.ts` around lines 267 - 353, Add a new e2e
test "test validate with backend failure" that exercises the code path where
backend.validate() returns { success: false, errorMessage, errors }: use
server.TEST_ONLY_getExpress() to PUT '/validate' with task.opts pointing to a
test backend that is stubbed to return that failing response (or mock the
backend factory/create to return an object whose validate method returns the
failing payload), send a valid config, then assert the response status and body
indicate failure (expect body.success toEqual false and that body.errorMessage
and body.errors match the values returned by the mocked backend.validate).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/cli/e2e/server/sync-standalone.e2e-spec.ts`:
- Around line 6-17: The test suite only allocates fixtures in beforeAll and
never runs a test; add at least one it(...) case that exercises the standalone
sync flow (e.g., start server, call a basic endpoint or verify server.listen
state) and add an afterAll teardown to stop/cleanup the fixtures. Locate the
beforeAll block that constructs BackendAPISIXStandalone and ADCServer and
implement an it('runs standalone sync flow', async () => { ... }) that uses
those instances, then implement afterAll to call the appropriate
shutdown/close/stop methods on BackendAPISIXStandalone and ADCServer to release
resources.
- Around line 10-12: The test instantiates BackendAPISIXStandalone without the
required ADCSDK.BackendOptions causing TS2554 and runtime crashes; update the
beforeAll instantiation of BackendAPISIXStandalone to pass a proper opts object
containing the mandatory fields (server, token, cacheKey, httpAgent, httpsAgent)
— e.g., construct an options object (or reuse existing helpers) with a test
server URL for server, a valid token string, a cacheKey string, and valid
http/https agent instances, then call new BackendAPISIXStandalone(opts) so the
constructor has the required data and accessing opts.server no longer throws.

In `@apps/cli/src/server/schema.ts`:
- Around line 24-33: The opts schema uses z.looseObject so unknown keys like
tlsSkipVerify can slip through as strings; update the opts definition in
schema.ts (the z.looseObject({ ... }) block for opts) to include a typed
tlsSkipVerify field (e.g., tlsSkipVerify: z.boolean().optional().default(false))
so that task.opts.tlsSkipVerify in validate.ts is guaranteed to be a boolean
before branching on it. Ensure you reference the existing opts entry and add the
tlsSkipVerify key alongside backend, server, token, etc., rather than relying on
looseObject to accept it implicitly.

In `@apps/cli/src/server/validate.ts`:
- Around line 77-94: The AXIOS_DEBUG event handler is currently logging raw
request/response headers and bodies (see the backend.on('AXIOS_DEBUG'...)
handler and similar logging around the other backend debug handler), which can
leak Authorization, Cookie, tokens (Bearer, JWT, access_token, refresh_token),
client_secret, and plugin config; update these handlers to redact sensitive
fields before logging or returning them by stripping or masking sensitive header
keys (e.g., Authorization, Cookie, Set-Cookie), scanning and masking token-like
fields in request/response bodies and config (access_token, refresh_token,
client_secret, secret, password), and replace raw error objects returned to
clients with a safe generic message; ensure you perform masking in the
AXIOS_DEBUG callback where response.config.* and response.* are read and in the
other debug handler referenced in the comment so logs and any 500 responses
never include unredacted secrets.

---

Nitpick comments:
In `@apps/cli/e2e/server/basic.e2e-spec.ts`:
- Around line 267-353: Add a new e2e test "test validate with backend failure"
that exercises the code path where backend.validate() returns { success: false,
errorMessage, errors }: use server.TEST_ONLY_getExpress() to PUT '/validate'
with task.opts pointing to a test backend that is stubbed to return that failing
response (or mock the backend factory/create to return an object whose validate
method returns the failing payload), send a valid config, then assert the
response status and body indicate failure (expect body.success toEqual false and
that body.errorMessage and body.errors match the values returned by the mocked
backend.validate).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c67ae1fe-1550-4bff-8552-e3d30070ea12

📥 Commits

Reviewing files that changed from the base of the PR and between 8e6fe40 and 56fe406.

📒 Files selected for processing (6)
  • apps/cli/e2e/server/basic.e2e-spec.ts
  • apps/cli/e2e/server/sync-standalone.e2e-spec.ts
  • apps/cli/e2e/support/utils.ts
  • apps/cli/src/server/index.ts
  • apps/cli/src/server/schema.ts
  • apps/cli/src/server/validate.ts

Comment thread apps/cli/e2e/server/sync-standalone.e2e-spec.ts Outdated
Comment thread apps/cli/e2e/server/sync-standalone.e2e-spec.ts Outdated
Comment thread apps/cli/src/server/schema.ts
Comment thread apps/cli/src/server/validate.ts
Comment thread libs/backend-apisix/test/validator.spec.ts Fixed
Comment thread libs/backend-apisix/test/validator.spec.ts Fixed
Comment thread libs/backend-apisix/test/validator.spec.ts Fixed
Comment thread libs/backend-apisix/test/validator.spec.ts Fixed
Comment thread libs/backend-apisix/test/validator.spec.ts Fixed
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/cli/e2e/server/validate.e2e-spec.ts (1)

18-109: ⚡ Quick win

Add one e2e for backend validation failure contract.

Current tests miss the key /validate failure shape from backend (success: false, source: 'validate', message, mapped errors). Adding that case would lock the new API behavior and prevent regressions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/cli/e2e/server/validate.e2e-spec.ts` around lines 18 - 109, Add an E2E
that asserts the server returns the backend validation-failure contract
(success: false, source: 'validate', a top-level message, and mapped errors) for
the /validate endpoint; copy the style of existing tests in validate.e2e-spec.ts
and add a new it(...) that PUTs to '/validate' with task.opts including backend:
'mock', server/token/cacheKey and a config payload designed to trigger the mock
backend validation failure, then assert status (likely 200 or the expected
code), body.success === false, body.source === 'validate', body.message is
present, and body.errors contains the mapped errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/cli/src/server/validate.ts`:
- Around line 124-137: The code is directly logging and returning result.errors
(from validate handler) which may contain sensitive payloads via
BackendValidationError.event; update the logging and response to sanitize errors
before exposing them: introduce/use a sanitizer that maps each error in
result.errors to a safe shape (e.g., { message, code, field } only) and replace
references to result.errors in logger.log (function logger.log) and in
res.status(200).json (response returned from the validate handler) with the
sanitizedErrors array; ensure BackendValidationError instances are handled
specially by extracting non-sensitive fields only and never including the raw
event/payload.

---

Nitpick comments:
In `@apps/cli/e2e/server/validate.e2e-spec.ts`:
- Around line 18-109: Add an E2E that asserts the server returns the backend
validation-failure contract (success: false, source: 'validate', a top-level
message, and mapped errors) for the /validate endpoint; copy the style of
existing tests in validate.e2e-spec.ts and add a new it(...) that PUTs to
'/validate' with task.opts including backend: 'mock', server/token/cacheKey and
a config payload designed to trigger the mock backend validation failure, then
assert status (likely 200 or the expected code), body.success === false,
body.source === 'validate', body.message is present, and body.errors contains
the mapped errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d5bda7bd-8d30-43af-b227-ff9d7a8dbc0d

📥 Commits

Reviewing files that changed from the base of the PR and between 714e3cb and 0be4d40.

📒 Files selected for processing (2)
  • apps/cli/e2e/server/validate.e2e-spec.ts
  • apps/cli/src/server/validate.ts

Comment thread apps/cli/src/server/validate.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
libs/backend-apisix/test/validator.spec.ts (1)

33-235: ⚡ Quick win

Add explicit test for the 404 “validate unsupported” branch

The validator has a dedicated 404 path with a specific upgrade message; this file currently doesn’t assert that behavior. Adding it will lock down a key compatibility UX path.

Proposed test addition
 describe('Validator', () => {
+  it('should throw upgrade hint when validate endpoint is unsupported (404)', async () => {
+    const events = [createEvent(ADCSDK.ResourceType.SERVICE, 'httpbin.org')];
+    const client = axios.create();
+    const err = new AxiosError(
+      'Request failed with status code 404',
+      AxiosError.ERR_BAD_REQUEST,
+    );
+    err.response = {
+      status: 404,
+      statusText: 'Not Found',
+      headers: {},
+      data: {},
+      config: {} as any,
+    };
+    vi.spyOn(client, 'post').mockRejectedValue(err);
+
+    const validator = new Validator({
+      client,
+      eventSubject: new Subject<ADCSDK.BackendEvent>(),
+    });
+
+    await expect(validator.validate(events)).rejects.toThrow(
+      'Validate is not supported by the current APISIX version. Please upgrade to a newer version.',
+    );
+  });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/backend-apisix/test/validator.spec.ts` around lines 33 - 235, Add a new
unit test in validator.spec.ts that exercises the Validator.validate 404 branch:
mock the axios client.post used by the Validator instance to reject with an
Axios error whose response.status === 404 and response.data contains the
validator’s "upgrade/unsupported" payload, call new Validator({ client,
eventSubject: new Subject() }).validate(events), and assert the returned result
indicates failure and that result.errorMessage matches the validator’s 404
upgrade message (use the same string/constant defined in Validator or compare
using includes if the constant isn’t exported); ensure the test uses createEvent
to build events and follows the pattern of other tests for setup and
expectations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@libs/backend-apisix/test/validator.spec.ts`:
- Around line 33-235: Add a new unit test in validator.spec.ts that exercises
the Validator.validate 404 branch: mock the axios client.post used by the
Validator instance to reject with an Axios error whose response.status === 404
and response.data contains the validator’s "upgrade/unsupported" payload, call
new Validator({ client, eventSubject: new Subject() }).validate(events), and
assert the returned result indicates failure and that result.errorMessage
matches the validator’s 404 upgrade message (use the same string/constant
defined in Validator or compare using includes if the constant isn’t exported);
ensure the test uses createEvent to build events and follows the pattern of
other tests for setup and expectations.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3e8bd189-6de6-4c0b-a474-e554b6a91399

📥 Commits

Reviewing files that changed from the base of the PR and between 0be4d40 and 91bd1a1.

📒 Files selected for processing (2)
  • apps/cli/src/server/sync.ts
  • libs/backend-apisix/test/validator.spec.ts
💤 Files with no reviewable changes (1)
  • apps/cli/src/server/sync.ts

@bzp2010 bzp2010 merged commit bcf6199 into main May 7, 2026
29 checks passed
@bzp2010 bzp2010 deleted the bzp/feat-server-validate-api branch May 7, 2026 01:28
AlinsRan added a commit to AlinsRan/apisix-ingress-controller that referenced this pull request May 7, 2026
Previously the apisix-standalone backend bypassed the ADC server and called
APISIX's /apisix/admin/configs/validate directly. With api7/adc#440, the ADC
server now exposes a /validate endpoint (same input format as /sync) that
handles both apisix-standalone and apisix backends uniformly.

Changes:
- Remove apisix-standalone special-case in runHTTPValidateForSingleServer;
  all backends now call ADC server POST /validate
- Fix ADCValidateResult.ErrorMessage JSON tag: errorMessage -> message
  to match the ADC server response format from api7/adc#440
- Remove buildAPISIXValidateRequest, apisixValidateRequest,
  newBackendHTTPClient, buildAPISIXValidatePayload and helpers
- Update unit tests accordingly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AlinsRan added a commit to api7/api7-ingress-controller that referenced this pull request May 7, 2026
Previously the apisix-standalone backend bypassed the ADC server and called
APISIX's /apisix/admin/configs/validate directly. With api7/adc#440, the ADC
server now exposes a /validate endpoint (same input format as /sync) that
handles both apisix-standalone and apisix backends uniformly.

Changes:
- Remove apisix-standalone special-case in runHTTPValidateForSingleServer;
  all backends now call ADC server POST /validate
- Fix ADCValidateResult.ErrorMessage JSON tag: errorMessage -> message
  to match the ADC server response format from api7/adc#440
- Remove buildAPISIXValidateRequest, apisixValidateRequest,
  newBackendHTTPClient, buildAPISIXValidatePayload and helpers
- Update unit tests accordingly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants