blob: d6c9a111b655d9d1bff3285213af9a02afff6a74 [file]
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
post:
tags:
- Schema Validation
operationId: validateConfiguration
summary: Validate a Configuration Without Applying It
description: |-
Validates a declarative APISIX configuration when the deployment uses either the `etcd` or `yaml` configuration provider. The endpoint accepts JSON and YAML request bodies up to 1.5 MiB and uses the normal Admin API authentication.
Validation covers known resource arrays, numeric `*_conf_version` fields, duplicate resource identifiers, resource JSON Schemas, and plugin `check_schema` functions. All detected errors are returned together. Cross-resource existence is not checked, so a reference such as an `upstream_id` can pass even when the referenced resource is absent. The operation does not persist or apply any configuration.
requestBody:
required: true
content:
application/json:
schema:
$ref: ../components/schemas/ConfigValidationDocument.yaml
application/yaml:
schema:
$ref: ../components/schemas/ConfigValidationDocument.yaml
responses:
"200":
description: The supplied configuration passed all applicable checks.
content:
application/json:
schema:
type: object
maxProperties: 0
example: {}
"400":
description: The request body could not be parsed, exceeded 1.5 MiB, or failed one or more configuration checks.
content:
application/json:
schema:
anyOf:
- $ref: ../components/schemas/ErrorResponse.yaml
- $ref: ../components/schemas/ConfigValidationErrorResponse.yaml
examples:
invalidBody:
summary: Malformed or empty request body
value:
error_msg: "invalid request body: empty request body"
configurationErrors:
summary: Multiple configuration errors
value:
error_msg: Configuration validation failed
errors:
- resource_type: routes
resource_id: route-a
index: 0
error: 'property "uri" validation failed: wrong type'
- resource_type: upstreams
resource_id: upstream-a
index: 0
error: missing key
"401":
$ref: ../components/responses/Unauthorized.yaml
parameters: []