diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml
index 0e98c1a8..d93246a2 100644
--- a/.github/workflows/build-containers.yml
+++ b/.github/workflows/build-containers.yml
@@ -23,12 +23,6 @@ jobs:
with:
python-version: '3.x'
- - name: Install Python test dependencies
- run: pip install pytest pyyaml pytest-cov
-
- - name: Run Python unit tests
- run: pytest tests/ -v --cov=src --cov-report=xml --cov-report=term-missing
-
- name: Set up Node.js
uses: actions/setup-node@v7
with:
@@ -36,6 +30,12 @@ jobs:
cache: 'npm'
cache-dependency-path: webui/package-lock.json
+ - name: Install Python test dependencies
+ run: pip install -r src/requirements.txt pytest pytest-cov
+
+ - name: Run Python unit tests
+ run: pytest tests/ -v --cov=src --cov-report=xml --cov-report=term-missing
+
- name: Install WebUI dependencies
working-directory: webui
run: npm ci
diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml
index 667c4ec9..934cc426 100644
--- a/.github/workflows/build-pr.yml
+++ b/.github/workflows/build-pr.yml
@@ -23,12 +23,6 @@ jobs:
with:
python-version: '3.x'
- - name: Install Python test dependencies
- run: pip install pytest pyyaml pytest-cov
-
- - name: Run Python unit tests
- run: pytest tests/ -v --cov=src --cov-report=xml --cov-report=term-missing
-
- name: Set up Node.js
uses: actions/setup-node@v7
with:
@@ -36,6 +30,12 @@ jobs:
cache: 'npm'
cache-dependency-path: webui/package-lock.json
+ - name: Install Python test dependencies
+ run: pip install -r src/requirements.txt pytest pytest-cov
+
+ - name: Run Python unit tests
+ run: pytest tests/ -v --cov=src --cov-report=xml --cov-report=term-missing
+
- name: Install WebUI dependencies
working-directory: webui
run: npm ci
diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml
index 4aef61f4..9afdf673 100644
--- a/.github/workflows/build-release.yml
+++ b/.github/workflows/build-release.yml
@@ -24,12 +24,6 @@ jobs:
with:
python-version: '3.x'
- - name: Install Python test dependencies
- run: pip install pytest pyyaml pytest-cov
-
- - name: Run Python unit tests
- run: pytest tests/ -v --cov=src --cov-report=xml --cov-report=term-missing
-
- name: Set up Node.js
uses: actions/setup-node@v7
with:
@@ -37,6 +31,12 @@ jobs:
cache: 'npm'
cache-dependency-path: webui/package-lock.json
+ - name: Install Python test dependencies
+ run: pip install -r src/requirements.txt pytest pytest-cov
+
+ - name: Run Python unit tests
+ run: pytest tests/ -v --cov=src --cov-report=xml --cov-report=term-missing
+
- name: Install WebUI dependencies
working-directory: webui
run: npm ci
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
new file mode 100644
index 00000000..4f2a6ba3
--- /dev/null
+++ b/ARCHITECTURE.md
@@ -0,0 +1,246 @@
+# Architecture
+
+This document describes the system architecture, rendering pipeline, and operational workflows of the **NGINX Declarative API**.
+
+> For a feature overview, quickstart examples, and deployment instructions, see [README.md](/README.md).
+
+## Table of Contents
+
+- [System Overview](#system-overview)
+ - [Key Components](#key-components)
+- [Configuration Rendering Pipeline](#configuration-rendering-pipeline)
+- [API Gateway Runtime Request Flow](#api-gateway-runtime-request-flow)
+- [GitOps Autosync Mode](#gitops-autosync-mode)
+- [Concurrent Access and Queueing Mode](#concurrent-access-and-queueing-mode)
+- [Related Documentation](#related-documentation)
+
+---
+
+## System Overview
+
+NGINX Declarative API accepts high-level JSON declarations (as well as incremental `PATCH` updates), resolves any external Sources of Truth, compiles complete NGINX Plus configurations and auxiliary artifacts, and publishes staged bundles to your NGINX control plane.
+
+```mermaid
+flowchart LR
+ subgraph Clients["Clients and Automation"]
+ REST["REST Clients"]
+ CICD["CI/CD Pipelines"]
+ WEBUI["Web UI"]
+ MCPC["MCP Client"] --> MCP["MCP Server"]
+ end
+
+ subgraph Core["NGINX Declarative API"]
+ API["FastAPI Service & Validator"]
+ BUILDER["Config Builder & Template Engine"]
+ DEVP["Developer Portal Service"]
+ REDIS[("Redis Store & Queue")]
+ API --> BUILDER
+ BUILDER --> DEVP
+ API <--> REDIS
+ BUILDER <--> REDIS
+ end
+
+ subgraph External["External Services"]
+ SOT["Source of Truth (Git / HTTP)"]
+ THIRDP["3rd-Party Integrations (Moesif)"]
+ end
+
+ subgraph Planes["Control and Data Planes"]
+ OUTPUT["Output Publisher"]
+ NIM["NGINX Instance Manager"]
+ N1["NGINX One Console"]
+ AGENT1["NGINX Agent"]
+ AGENT2["NGINX Agent"]
+ NGINX1["NGINX Plus Instances"]
+ NGINX2["NGINX Plus Instances"]
+
+ OUTPUT --> NIM --> AGENT1 --> NGINX1
+ OUTPUT --> N1 --> AGENT2 --> NGINX2
+ end
+
+ REST --> API
+ CICD --> API
+ WEBUI --> API
+ MCP --> API
+ BUILDER <--> SOT
+ BUILDER <--> THIRDP
+ BUILDER --> OUTPUT
+```
+
+### Key Components
+
+| Component | Role |
+| --- | --- |
+| **Clients (`REST`, `CI/CD`, `Web UI`, `MCP Server`)** | Submit full declarations (`POST`), incremental updates (`PATCH`), or natural-language operations (via [`contrib/mcp`](/contrib/mcp) and [`webui`](/webui)) over REST. |
+| **FastAPI Service & Validator (`src/main.py`)** | Exposes versioned endpoints (`/v5.5`, `/v5.6`, `/v5.7`), validates declarations against Pydantic schemas, and routes asynchronous `PATCH` requests through the queue manager. |
+| **Config Builder & Template Engine** | Resolves external artifacts, parses OpenAPI/Swagger specs, renders NGINX/WAF configuration files and `njs` modules via Jinja2, and packages staged config bundles. |
+| **Redis Store & Queue (`src/NcgRedis.py`)** | Stores active declarations, submission job statuses, autosync artifact metadata/timestamps, and serialized asynchronous `PATCH` queues. |
+| **Source of Truth (`SOT`)** | External HTTP(S) or Git endpoints hosting OpenAPI/Swagger schemas, F5 WAF for NGINX policies, TLS certificates/keys/chains, snippets, and custom `njs` scripts. |
+| **Developer Portal Service (`src/v5_7/DevPortal.py`)** | Builds Redocly developer portal HTML bundles or Backstage catalog YAML manifests from referenced OpenAPI specs. |
+| **3rd-Party Integrations** | Instruments API Gateways with external visibility/telemetry providers such as Moesif. |
+| **Output Publishers (`NIMOutput` / `NGINXOneOutput`)** | Deploy staged configurations and auxiliary files (`njs`, TLS certs, MIME types) to NGINX Instance Manager instance groups or NGINX One Console config sync groups, where NGINX Agent applies them to NGINX Plus. |
+
+---
+
+## Configuration Rendering Pipeline
+
+In API **v5.7**, every `POST /v5.7/config`, `PATCH /v5.7/config/{configuid}`, or autosync rebuild passes through a deterministic compilation pipeline before publishing:
+
+```mermaid
+flowchart TD
+ REQ["Declaration JSON (POST / PATCH / Autosync)"]
+ PATCH["Incremental Merge (DeclarationPatcher)"]
+ SCHEMA["Pydantic Schema Validation (V5_7_NginxConfigDeclaration)"]
+ CTX["ConfigBuildContext Initialization (V5_7_ConfigBuilder)"]
+ FETCH["Resolve Source of Truth Artifacts (GitOps)"]
+ OAS["Parse OpenAPI 2.0 / 3.0 / 3.1 / 3.2 (OpenAPIParser & APIGateway)"]
+ RENDER["Render Configs & Auxiliary Files (Jinja2 templates)"]
+ PUBLISH["Stage & Publish Bundle (NIMOutput / NGINXOneOutput)"]
+
+ REQ --> PATCH --> SCHEMA --> CTX
+ CTX --> FETCH --> OAS --> RENDER --> PUBLISH
+```
+
+| Stage | Primary Modules (`src/`) | Output Produced |
+| --- | --- | --- |
+| **API & Queue Routing** | `main.py`, `v5_7/Asynchronous.py` | Immediate execution or queued submission UID for `/v5.7/config/{configuid}/submission/{submissionuid}` |
+| **Patching & Validation** | `v5_7/DeclarationPatcher.py`, `V5_7_NginxConfigDeclaration.py` | Validated `.output` and `.declaration` objects (`v5.7` Pydantic models) |
+| **Artifact Fetching & Parsing** | `v5_7/GitOps.py`, `v5_7/OpenAPIParser.py`, `v5_7/APIGateway.py` | Dereferenced OpenAPI paths, operations, parameters, response codes, `requestBody` schemas, and `$ref` definitions |
+| **Config & `njs` Generation** | `V5_7_ConfigBuilder.py`, `templates/v5.7/*.tmpl` | `nginx.conf`, `http.conf`, `stream.conf`, server/upstream/map files, `@apigw_proxy_*` internal locations, and `apigw_body_*.js` validators in `auxFiles` |
+| **Control Plane Publishing** | `v5_7/NIMOutput.py`, `v5_7/NGINXOneOutput.py`, `v5_7/NIMNAPUtils.py`, `v5_7/NGINXOneNAPUtils.py` | Staged deployment with automatic `ngx_http_js_module` loading when generated body validators are present |
+
+---
+
+## API Gateway Runtime Request Flow
+
+When `api_gateway.enforce_bodies` is enabled (`true` by default) in API v5.7 and an endpoint defines a resolvable OpenAPI request body schema, generated NGINX locations delegate payload validation to NGINX JavaScript (`njs`) before proxying upstream:
+
+```mermaid
+sequenceDiagram
+ participant Client
+ participant Loc as "NGINX API Location"
+ participant NJS as "njs Validator (apigw_body_*.js)"
+ participant Proxy as "Internal Location (@apigw_proxy_*)"
+ participant Upstream
+
+ Client ->> Loc: HTTP Request (method, headers, body)
+ Loc ->> Loc: Method & param maps check (enforce_methods / enforce_parameters)
+
+ alt Undocumented method or missing required param
+ Loc -->> Client: HTTP 405 / 400
+ else Request passes method & header/query checks
+ Loc ->> NJS: js_content validate_req_body_*
+ NJS ->> NJS: Validate required body, Content-Type & JSON Schema ($ref / OAS)
+ alt Body validation fails
+ NJS -->> Client: HTTP 400 JSON error
+ else Valid payload or non-body method
+ NJS ->> Proxy: r.internalRedirect("@apigw_proxy_*")
+ Proxy ->> Proxy: Apply strip_uri, auth, headers, cache & proxy_intercept_errors
+ Proxy ->> Upstream: proxy_pass upstream request
+ Upstream -->> Client: HTTP Response (masked if enforce_response_codes)
+ end
+ end
+```
+
+Endpoints without request body schemas (or deployments with `enforce_bodies: false`) skip the `njs` phase and proxy directly inside the endpoint `location` block.
+
+---
+
+## GitOps Autosync Mode
+
+When `synctime` is configured under `.output.nms.synctime` or `.output.nginxone.synctime`, a background scheduler in `V5_7_CreateConfig.py` periodically polls every HTTP(S)-referenced Source of Truth artifact (OpenAPI specs, F5 WAF policies, TLS certificates/keys/chains, snippets, and `njs` scripts). Any detected upstream change triggers an automatic rebuild and staged deployment.
+
+```mermaid
+sequenceDiagram
+ participant CICD as "CI/CD Pipeline"
+ participant SOT as "Source of Truth"
+
+ box NGINX Declarative API
+ participant NDAPI as "Scheduler & Config Builder"
+ participant DevP as "Developer Portal Service"
+ participant Redis
+ end
+
+ participant CP as "NIM / NGINX One Console"
+ participant Agent as "NGINX Agent"
+ participant NGINX as "NGINX Plus"
+
+ CICD ->> SOT: Commit updated schema, policy, cert, or snippet
+
+ loop Every synctime seconds
+ NDAPI ->> SOT: Poll referenced artifacts metadata/timestamps
+ SOT -->> NDAPI: Latest timestamps & ETags
+ NDAPI ->> Redis: Compare with cached artifact state
+
+ alt Updates detected
+ NDAPI ->> SOT: Pull updated artifacts
+ SOT -->> NDAPI: Updated contents
+
+ opt Developer Portal enabled
+ NDAPI ->> DevP: Generate updated portal / catalog
+ DevP -->> NDAPI: DevPortal artifacts
+ end
+
+ NDAPI ->> NDAPI: Rebuild staged NGINX config & njs validators
+ NDAPI ->> CP: Publish staged config bundle
+ CP ->> Agent: Distribute updated config
+ Agent ->> NGINX: Reload NGINX Plus
+ CP -->> NDAPI: Deployment outcome
+ NDAPI ->> Redis: Persist updated config state & timestamps
+ end
+ end
+```
+
+---
+
+## Concurrent Access and Queueing Mode
+
+For CI/CD pipelines issuing concurrent updates against a shared configuration (`PATCH /v5.7/config/{configuid}`), setting `.output.synchronous` to `false` switches updates to Redis-backed queued execution. Callers receive a submission identifier immediately and can poll `GET /v5.7/config/{configuid}/submission/{submissionuid}` for completion status.
+
+```mermaid
+sequenceDiagram
+ participant CICD as "CI/CD Pipelines"
+ participant API as "FastAPI Endpoint"
+ participant Redis as "Redis Queue & Status Store"
+ participant Worker as "Queue Manager Worker"
+ participant CP as "NIM / NGINX One Console"
+ participant NGINX as "NGINX Agent & NGINX Plus"
+
+ Note over CICD,NGINX: Initial baseline deployment (POST /v5.7/config)
+ CICD ->> API: POST /v5.7/config
+ API ->> CP: Publish initial staged config
+ CP ->> NGINX: Apply config to target group
+ CP -->> API: Return outcome
+ API -->> CICD: Return configUid & status
+
+ Note over CICD,NGINX: Concurrent asynchronous updates (synchronous: false)
+ CICD ->> API: PATCH /v5.7/config/{configUid} (Update 1)
+ API ->> Redis: Enqueue Update 1 (submissionUid 1)
+ API -->> CICD: HTTP 202 Accepted (submissionUid 1)
+
+ CICD ->> API: PATCH /v5.7/config/{configUid} (Update 2)
+ API ->> Redis: Enqueue Update 2 (submissionUid 2)
+ API -->> CICD: HTTP 202 Accepted (submissionUid 2)
+
+ loop Serialized Queue Processing
+ Worker ->> Redis: Dequeue next pending PATCH
+ Worker ->> Worker: Apply DeclarationPatcher & rebuild staged config
+ Worker ->> CP: Publish staged config
+ CP ->> NGINX: Apply updated config
+ CP -->> Worker: Return outcome
+ Worker ->> Redis: Store completion status & timestamp
+ end
+
+ CICD ->> API: GET /v5.7/config/{configUid}/submission/{submissionUid}
+ API ->> Redis: Read submission status
+ Redis -->> API: Completed / pending status
+ API -->> CICD: JSON submission status response
+```
+
+---
+
+## Related Documentation
+
+- [README.md](/README.md) — Overview, outcome-driven examples, GitOps & API Gateway use cases, deployment, and testing
+- [FEATURES.md](/FEATURES.md) — Complete feature matrix, Request Body Schema Validation reference, and OAS support details
+- [USAGE-v5.7.md](/USAGE-v5.7.md) — REST endpoints and JSON schema reference for API `v5.7`
diff --git a/FEATURES.md b/FEATURES.md
index 25d0228a..8b818181 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -1,127 +1,260 @@
-# Supported features
-
-## NGINX Control plane support
-
-NGINX Declarative API has been tested with the following NGINX control plane releases:
-
-| Control plane | API v5.5 | API v5.6 | API v5.7 | Notes |
-|---------------------------|----------------------|----------------------|------------|-------|
-| NGINX Instance Manager | 2.18+ | 2.20+ | 2.22+ | |
-| NGINX One Console | General availability | General availability | July 2027 | |
-
-### NGINX `http` and `stream` servers
-
-| Feature | API v5.5 | API v5.6 | API v5.7 | Notes |
-|-------------------------------|----------|----------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| Upstreams | X | X | X |
Snippets supported: static and from source of truth |
-| HTTP servers | X | X | X | Snippets supported (`http`, `servers`, `locations`): static and from source of truth |
-| TCP/UDP servers | X | X | X | Snippets supported (`streams`, `servers`): static and from source of truth |
-| TLS | X | X | X | Certificates and keys can be dynamically fetched from source of truth |
-| ACME Protocol | X | X | X | See [TLS](#tls) |
-| Client authentication | X | X | X | See [client authentication](#Client-authentication) |
-| Upstream authentication | X | X | X | See [upstream and Source of truth authentication](#Upstream-and-Source-of-truth-authentication) |
-| Rate limiting | X | X | X | |
-| Active healthchecks | X | X | X | |
-| Cookie-based stickiness | X | X | X | |
-| HTTP headers manipulation | X | X | X | To server: set, deleteTo client: add, delete, replace |
-| Maps | X | X | X | |
-| Cache | X | X | X | Supported for `http`, `servers`, `locations` and API Gateway |
-| HTTP Logging | X | X | X | Access and error logging supported for `servers`, `locations` and API Gateway |
-| HTTP access logging formats | X | X | X | Customizable HTTP access logging formats |
-| NGINX Plus REST API access | X | X | X | |
-| F5 WAF for NGINX policies | X | X | X | Per-policy CRUD at `server` and `location` levelSupport for dataplane-based bundle compilationSecurity policies can be fetched from source of truth |
-| F5 WAF for NGINX log profiles | | | X | |
-
-### HTTP Locations
-
-Locations `.declaration.http.servers[].locations[].uri` match modifiers in `.declaration.http.servers[].locations[].urimatch` can be:
-
-- *prefix* - prefix URI matching
-- *exact* - exact URI matching
-- *regex* - case sensitive regex matching
-- *iregex* - case insensitive regex matching
-- *best* - case sensitive regex matching that halts any other location matching once a match is made
-
-### NGINX API Gateway use case
-
-| Feature | API v5.5 | API v5.6 | API v5.7 | Notes |
-|----------------------------------------------|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------|-----------------------------------------------|
-| Configuration generation from OpenAPI schema | X | X | X | OpenAPI 2.0, 3.0, 3.0.1, YAML and JSON format |
-| HTTP methods enforcement | X | X | X | |
-| Requests payload enforcement | | | X | |
-| Query string parameters enforcement | | X | X | |
-| Query string parameters values enforcement | | X | X | |
-| Mandatory HTTP headers enforcement | | X | X | |
-| HTTP Response codes enforcement | | | X | |
-| per-URI rate limiting | X | X | X | |
-| per-URI client authentication | Static JWT keyJWT key fetched from URLBearer token | Static JWT keyJWT key fetched from URLBearer token | Static JWT keyJWT key fetched from URLBearer token | |
-| per-URI client authorization | JWT claims | JWT claims | JWT claims | |
-| per-URI cache | X | X | X | |
-| Developer portal | RedoclyBackstage | RedoclyBackstage | RedoclyBackstage | Supported through 3rd party integration |
-| API visibility | Moesif | Moesif | Moesif | Supported through 3rd party integration |
-
-
-Swagger files and OpenAPI schemas can be used to automatically configure NGINX as an API Gateway
-
-Declaration path `.declaration.http.servers[].locations[].apigateway` defines the API Gateway configuration:
-
-- `openapi_schema` - the base64-encoded schema, or the schema URL. YAML and JSON are supported
-- `api_gateway.enabled` - enable/disable API Gateway provisioning
-- `api_gateway.strip_uri` - removes the `.declaration.http.servers[].locations[].uri` part of the URI before forwarding requests to the upstream
-- `api_gateway.server_url` - the base URL of the upstream server
-- `api_gateway.enforce_methods` - enable/disable HTTP methods enforcement (`true` by default)
-- `api_gateway.enforce_bodies` - enable/disable HTTP request bodies and Content-Type enforcement (`true` by default)
-- `api_gateway.enforce_parameters` - enable/disable mandatory query string parameters and HTTP headers enforcement (`true` by default)
-- `api_gateway.enforce_response_codes` - enable/disable HTTP response codes enforcement (`true` by default)
-- `developer_portal.enabled` - enable/disable Developer portal provisioning
-- `developer_portal.type` - developer portal type. `redocly` and `backstage` are currently supported
-- `developer_portal.redocly.*` - Redocly-based developer portal parameters. See the [Postman collection](/contrib/postman)
-- `developer_portal.backstage.*` - Backstage-based developer portal parameters. See the [Postman collection](/contrib/postman)
-- `visibility[]` - API Gateway visibility
- - `visibility[].enabled` - enable/disable API gateway visibility
- - `visibility[].type` - visibility integration type. `moesif` is currently supported
- - `visibility[].moesif.*` - Moesif visibility parameters. See the [Postman collection](/contrib/postman)
-- `authentication` - optional, used to enforce authentication at the API Gateway level
-- `authentication.client[]` - authentication profile names
-- `authentication.enforceOnPaths` - if set to `true` authentication is enforced on all API endpoints listed under `authentication[].paths`. if set to `false` authentication is enforced on all API endpoints but those listed under `authentication.paths`
-- `authentication.paths` - paths to enforce authentication on
-- `authorization[]` - optional, used to enforce authorization
-- `authorization[].profile` - authorization profile name
-- `authorization[].enforceOnPaths` - if set to `true` authorization is enforced on all API endpoints listed under `authorization[].paths`. if set to `false` authorization is enforced on all API endpoints but those listed under `authorization[].paths`
-- `authorization[].paths` - paths to enforce authorization on
-- `cache[]` - optional, used to enforce authorization
-- `cache[].profile` - cache profile name
-- `cache[].enforceOnPaths` - if set to `true` caching is performed on all API endpoints listed under `cache[].paths`. if set to `false` caching is performed on all API endpoints but those listed under `cache[].paths`
-- `cache[].paths` - paths to perform caching on
-- `rate_limit` - optional, used to enforce rate limiting at the API Gateway level
-- `rate_limit.enforceOnPaths` - if set to `true` rate limiting is enforced on all API endpoints listed under `rate_limit.paths`. if set to `false` rate limiting is enforced on all API endpoints but those listed under `rate_limit.paths`
-
-See the [Postman collection](/contrib/) for usage examples
-
-### NGINX API Gateway use case - Developer Portal
-
-| Type | API v5.5 | API v5.6 | API v5.7 | Notes |
-|-----------------|----------|-----------|----------|------------------------------------------|
-| Redocly | X | X | X | Developer portal published by NGINX Plus |
-| Backstage.io | X | X | X | Backstage YAML manifest generated |
-
-### NGINX API Gateway use case - Visibility
-
-| Type | API v5.5 | API v5.6 | API v5.7 | Notes |
-|---------------|----------|----------|-------------|-----------------------------------------------------------------------------------------------|
-| Moesif | X | X | X | Integration with Moesif - see https://www.moesif.com/docs/server-integration/nginx-openresty/ |
-
-
-### TLS
-
-| Type | Description | API v5.5 | API v5.6 | API v5.7 | Notes |
-|-------|-------------------------|----------|----------|----------|-------|
-| ACME | ACME Protocol support | X | X | X | |
-
-#### Examples
-
-ACME issuer profiles to be defined under `.declaration.http.acme_issuers[]`
-For full details for all fields see https://nginx.org/en/docs/http/ngx_http_acme_module.html
+# Supported Features
+
+NGINX Declarative API translates JSON/YAML declarations—and Swagger/OpenAPI specifications—into staged NGINX Plus configurations for **NGINX Instance Manager** and **NGINX One Console** across API versions `v5.5`, `v5.6`, and `v5.7`.
+
+> **Legend:** `✅` Supported · `—` Not supported in this API version
+
+## Table of Contents
+
+- [Control Plane Support](#control-plane-support)
+- [NGINX HTTP and Stream Servers](#nginx-http-and-stream-servers)
+ - [Core Capabilities](#core-capabilities)
+ - [HTTP Location Match Modifiers](#http-location-match-modifiers)
+ - [HTTP Headers Manipulation](#http-headers-manipulation)
+ - [Maps](#maps)
+- [NGINX API Gateway](#nginx-api-gateway)
+ - [API Gateway Capabilities](#api-gateway-capabilities)
+ - [Request Body Schema Validation](#request-body-schema-validation)
+ - [OpenAPI Specification Version Support](#openapi-specification-version-support)
+ - [Configuration Reference](#configuration-reference)
+ - [Developer Portal and API Visibility](#developer-portal-and-api-visibility)
+- [Security and Authentication](#security-and-authentication)
+ - [TLS and ACME Protocol](#tls-and-acme-protocol)
+ - [Client Authentication](#client-authentication)
+ - [Client Authorization](#client-authorization)
+ - [Upstream and Source of Truth Authentication](#upstream-and-source-of-truth-authentication)
+- [Observability, DNS, and Scripting](#observability-dns-and-scripting)
+ - [HTTP Access and Error Logging](#http-access-and-error-logging)
+ - [Access Logging Formats](#access-logging-formats)
+ - [DNS Resolvers](#dns-resolvers)
+ - [NGINX JavaScript](#nginx-javascript)
+
+---
+
+## Control Plane Support
+
+Tested control plane compatibility across NGINX Declarative API releases:
+
+| Control Plane | API v5.5 | API v5.6 | API v5.7 | Notes |
+| --- | --- | --- | --- | --- |
+| **NGINX Instance Manager** | `2.18+` | `2.20+` | `2.22+` | Uses NMS staged configuration deployment |
+| **NGINX One Console** | General availability | General availability | July 2027 | Targets NGINX One config sync groups |
+
+---
+
+## NGINX HTTP and Stream Servers
+
+### Core Capabilities
+
+| Feature | API v5.5 | API v5.6 | API v5.7 | Notes |
+| --- | :---: | :---: | :---: | --- |
+| **Upstreams** | ✅ | ✅ | ✅ | Custom snippets supported (inline/static or fetched from source of truth) |
+| **HTTP servers** | ✅ | ✅ | ✅ | Snippets supported at `http`, `servers[]`, and `locations[]` levels |
+| **TCP/UDP (`stream`) servers** | ✅ | ✅ | ✅ | Snippets supported at `streams` and `servers[]` levels |
+| **TLS** | ✅ | ✅ | ✅ | Certificates and private keys can be dynamically fetched from source of truth |
+| **ACME Protocol** | ✅ | ✅ | ✅ | Automated certificate issuance; see [TLS and ACME Protocol](#tls-and-acme-protocol) |
+| **Client authentication** | ✅ | ✅ | ✅ | See [Client Authentication](#client-authentication) |
+| **Upstream authentication** | ✅ | ✅ | ✅ | See [Upstream and Source of Truth Authentication](#upstream-and-source-of-truth-authentication) |
+| **Rate limiting** | ✅ | ✅ | ✅ | Request rate enforcement for servers, locations, and API Gateway |
+| **Active health checks** | ✅ | ✅ | ✅ | NGINX Plus upstream health probing |
+| **Cookie-based stickiness** | ✅ | ✅ | ✅ | Session persistence for HTTP upstreams |
+| **HTTP headers manipulation** | ✅ | ✅ | ✅ | **To server:** `set`, `delete` · **To client:** `add`, `delete`, `replace` |
+| **Maps** | ✅ | ✅ | ✅ | Variable mapping; see [Maps](#maps) |
+| **Response caching** | ✅ | ✅ | ✅ | Supported across `http`, `servers[]`, `locations[]`, and API Gateway |
+| **HTTP logging** | ✅ | ✅ | ✅ | Access and error logging for `servers[]`, `locations[]`, and API Gateway |
+| **HTTP access log formats** | ✅ | ✅ | ✅ | Customizable `log_format` definitions |
+| **NGINX Plus REST API** | ✅ | ✅ | ✅ | Live activity monitoring and dynamic API endpoint |
+| **F5 WAF for NGINX policies** | ✅ | ✅ | ✅ | Per-policy CRUD at `server`/`location` level, dataplane bundle compilation, and remote policy fetch |
+| **F5 WAF for NGINX log profiles** | — | — | ✅ | Custom App Protect WAF security log profiles |
+
+### HTTP Location Match Modifiers
+
+Configured via `.declaration.http.servers[].locations[].urimatch` for `.declaration.http.servers[].locations[].uri`:
+
+| Modifier | NGINX Equivalent | Behavior |
+| --- | --- | --- |
+| `prefix` | *(none)* | Prefix URI matching |
+| `exact` | `=` | Exact URI matching |
+| `regex` | `~` | Case-sensitive regular expression matching |
+| `iregex` | `~*` | Case-insensitive regular expression matching |
+| `best` | `^~` | Non-regex prefix match that halts regex evaluation when matched |
+
+### HTTP Headers Manipulation
+
+Configured under `.declaration.http.servers[].headers` and/or `.declaration.http.servers[].locations[].headers`:
+
+| Direction | API v5.5 | API v5.6 | API v5.7 | Supported Operations |
+| --- | :---: | :---: | :---: | --- |
+| **Request** (client → upstream) | ✅ | ✅ | ✅ | `set` (inject/override header), `delete` (strip client header) |
+| **Response** (upstream → client) | ✅ | ✅ | ✅ | `add` (append header), `delete` (strip server header), `replace` (override header) |
+
+
+Configuration schema: HTTP headers object
+
+```json
+"headers": {
+ "to_server": {
+ "set": [
+ {
+ "name": "",
+ "value": ""
+ }
+ ],
+ "delete": [
+ ""
+ ]
+ },
+ "to_client": {
+ "add": [
+ {
+ "name": "",
+ "value": ""
+ }
+ ],
+ "delete": [
+ ""
+ ],
+ "replace": [
+ {
+ "name": "",
+ "value": ""
+ }
+ ]
+ }
+}
+```
+
+
+
+### Maps
+
+Configured via `.declaration.http.maps[].entries[].keymatch`:
+
+| Modifier | Behavior |
+| --- | --- |
+| `exact` | Exact string matching |
+| `regex` | Case-sensitive regular expression matching |
+| `iregex` | Case-insensitive regular expression matching |
+
+---
+
+## NGINX API Gateway
+
+OpenAPI and Swagger definitions can be referenced directly to provision NGINX Plus as an API Gateway with automated routing, security, and contract enforcement. Complete declaration examples are available in the [Postman collection](/contrib/postman).
+
+### API Gateway Capabilities
+
+| Feature | API v5.5 | API v5.6 | API v5.7 | Notes |
+| --- | :---: | :---: | :---: | --- |
+| **OpenAPI-driven provisioning** | ✅ | ✅ | ✅ | YAML and JSON schemas.
**v5.5 / v5.6:** OAS `3.0.x`
**v5.7:** OAS `2.0`, `3.0.x`, `3.1.x`, `3.2.x` |
+| **HTTP methods enforcement** | ✅ | ✅ | ✅ | Restricts endpoints to documented HTTP methods |
+| **Request body presence, `Content-Type` & schema enforcement** | — | — | ✅ | Validates presence, `Content-Type`, and OpenAPI/JSON Schema payload structure via auto-generated `njs`; see [Request Body Schema Validation](#request-body-schema-validation) |
+| **Query parameter presence enforcement** | — | ✅ | ✅ | Rejects requests missing required query parameters |
+| **Query parameter value enforcement** | — | ✅ | ✅ | Enforces allowed `enum` values and defaults |
+| **Mandatory HTTP headers enforcement** | — | ✅ | ✅ | Rejects requests missing required request headers |
+| **HTTP response codes enforcement** | — | — | ✅ | Masks undocumented upstream status codes via `proxy_intercept_errors` |
+| **Per-URI rate limiting** | ✅ | ✅ | ✅ | Selective path inclusion or exclusion |
+| **Per-URI client authentication** | Static JWT key, JWT JWKS URL, Bearer | Static JWT key, JWT JWKS URL, Bearer | Static JWT key, JWT JWKS URL, Bearer | Supports selective path enforcement |
+| **Per-URI client authorization** | JWT claims | JWT claims | JWT claims | Regex-capable claim validation |
+| **Per-URI caching** | ✅ | ✅ | ✅ | Selective path caching |
+| **Developer portal** | Redocly, Backstage | Redocly, Backstage | Redocly, Backstage | Built-in portal / manifest generation |
+| **API visibility** | Moesif | Moesif | Moesif | Telemetry and analytics integration |
+
+### Request Body Schema Validation
+
+In **API v5.7**, when `api_gateway.enforce_bodies` is enabled (`true` by default) and an operation defines a resolvable request body schema, NGINX Declarative API automatically compiles and attaches an NGINX JavaScript (`njs`) request body validator (`ngx_http_js_module` is added automatically if omitted):
+
+- **Media types & `Content-Type` matching:**
+ - Enforces required vs. optional bodies (`required: true` rejects empty bodies with HTTP `400`).
+ - Matches `Content-Type` headers ignoring parameters (such as `; charset=utf-8`) and supports exact matches as well as structured suffixes and wildcards (`application/*+json`, `*+json`, `application/*`, `*/*`).
+ - Structurally validates **JSON** (`application/json`, `text/json`, `*+json`), **`application/x-www-form-urlencoded`** (with schema-guided coercion for numbers, integers, booleans, and repeated array keys), and **`text/plain`**. Non-JSON/form/text payloads (e.g., XML, multipart, binary) still undergo presence and `Content-Type` validation and pass through on match.
+- **JSON Schema & OpenAPI schema keywords supported:**
+ - **References & structure:** Local JSON Pointer `$ref` (`#/components/schemas/...`, `#/components/requestBodies/...`, `#/definitions/...`, `#/$defs/...`), recursive/cyclic references, `$ref` sibling keywords, boolean schemas (`true`/`false`), `nullable`, `type` (single type or type array), `enum`, `const`.
+ - **Objects:** `required` (automatically skipping `readOnly: true` properties in request payloads per OAS), `properties`, `patternProperties`, `additionalProperties` (`false` or schema), `minProperties` / `maxProperties`, `propertyNames`, `dependentRequired`, `dependentSchemas`, `dependencies`.
+ - **Arrays:** `items`, `prefixItems` (OAS 3.1 tuples), `additionalItems`, `minItems` / `maxItems`, `uniqueItems`, `contains`, `minContains`, `maxContains`.
+ - **Strings & numbers:** `minLength` / `maxLength` (Unicode code-point aware), `pattern`, `format` (`date`, `date-time`, `time`, `uuid`, `email`, `ipv4`, `ipv6`, `uri`, `hostname`, `byte`, `int32`, `int64`), `minimum` / `maximum`, boolean and numeric `exclusiveMinimum` / `exclusiveMaximum`, and decimal-safe `multipleOf`.
+ - **Composition:** `allOf`, `anyOf`, `oneOf`, `not`, `if` / `then` / `else`.
+- **Runtime behavior:** Invalid requests receive an HTTP `400` JSON error (`{"code": 400, "message": "..."}`); valid requests internally redirect to generated `@apigw_proxy_*` locations preserving upstream routing, `strip_uri`, authentication, headers, caching, logging, and response code enforcement.
+
+### OpenAPI Specification Version Support
+
+Support across OpenAPI Specification versions in **API v5.7** (YAML and JSON):
+
+| Spec Version | Status | Supported Features | Current Limitations & Caveats |
+| --- | --- | --- | --- |
+| **Swagger 1.x / 1.2** | Not supported | — | Legacy `swaggerVersion` / `apis` resource-listing format is not supported |
+| **OAS 2.0 (Swagger 2.0)** | Supported | • `swagger`, `info`, `paths`, response status codes
• Upstream URL resolution from `host`, `basePath`, and `schemes`
• Body presence, `Content-Type`, and schema enforcement from `in: "body"` parameters and `consumes` (operation overriding root)
• Local `$ref` dereferencing for body schemas (`#/definitions/...`) and parameters (`#/parameters/...`)
• Parameter `type` / `default` / `enum` parsing including `items` arrays | • Unresolvable local `$ref`s on request body schemas are skipped gracefully; external file/URL `$ref`s and response `$ref`s are not dereferenced
• When multiple `schemes` (`http`, `https`) are listed, the first `http`/`https` entry is used per host |
+| **OAS 3.0.x** (`3.0.0`–`3.0.4`) | Supported | • Root, path-level, and operation-level `servers[]` with server `variables` substitution
• Standard HTTP methods (`GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `CONNECT`, `OPTIONS`, `TRACE`, `PATCH`)
• Path/operation `parameters` merging (`query`/`header` enforcement and enum maps)
• Local `$ref` dereferencing on `requestBody`, media objects, `parameters`, and request body `schema` (`#/components/...`)
• Full `requestBody` schema enforcement and `responses` code enforcement | • `pathItem.$ref`, response `$ref`, and external remote `$ref`s are not dereferenced
• Parameter enforcement targets `required: true` `query` and `header` parameters (`cookie` and `content`-based parameters are not enforced) |
+| **OAS 3.1.x** (`3.1.0`–`3.1.2`) | Supported | • All OAS `3.0.x` features in YAML and JSON
• Request body schemas supporting JSON Schema 2020-12 keywords (`$defs`, boolean schemas, type arrays, `const`, `prefixItems`, `dependentRequired`, `dependentSchemas`, `if`/`then`/`else`)
• Schemas omitting `paths` return an empty path list cleanly | • Top-level `webhooks`, `pathItem.$ref`, and response `$ref`s are not parsed
• Query/header parameter schemas beyond `type` / `default` / `enum` are not validated at runtime |
+| **OAS 3.2.x** (`3.2.0`) | Supported | • All OAS `3.0.x` / `3.1.x` features plus optional `server.name`
• `additionalOperations` custom HTTP methods with path-parameter merging and sanitized NGINX variable names | • The `QUERY` HTTP method is ignored (not yet supported by NGINX)
• `webhooks` and `pathItem.$ref` are not parsed
• When `enforce_methods` generates `limit_except`, support for custom method tokens (`PURGE`, `M-SEARCH`, etc.) depends on the target NGINX binary |
+
+> **API v5.5 & v5.6 Note:** Earlier API versions only parse top-level OAS `3.0.x` `servers[]`, standard HTTP methods, and inline `parameter.schema` definitions, and do not enforce request body schemas or response status codes.
+
+### Configuration Reference
+
+Declaration path: `.declaration.http.servers[].locations[].apigateway`
+
+#### Schema, Routing, and Enforcement
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `openapi_schema` | `object` | — | Base64-encoded OpenAPI/Swagger content or remote schema URL (YAML or JSON) |
+| `api_gateway.enabled` | `boolean` | `false` | Enable or disable API Gateway provisioning on this location |
+| `api_gateway.strip_uri` | `boolean` | `false` | Strip the parent location `uri` prefix before forwarding requests upstream |
+| `api_gateway.server_url` | `string` | `""` | Base destination URL of the upstream server (used when OpenAPI `servers` are absent or overridden) |
+| `api_gateway.enforce_methods` | `boolean` | `true` | Enforce HTTP methods defined per path |
+| `api_gateway.enforce_bodies` | `boolean` | `true` | Enforce mandatory request bodies, allowed `Content-Type` headers, and request body schemas |
+| `api_gateway.enforce_parameters` | `boolean` | `true` | Enforce mandatory query parameters, header parameters, and enum value constraints |
+| `api_gateway.enforce_response_codes` | `boolean` | `true` | Intercept and normalize undocumented upstream HTTP response status codes |
+
+#### Path-Scoped Policies (`authentication`, `authorization`, `cache`, `rate_limit`)
+
+| Field | Description |
+| --- | --- |
+| `authentication.client[]` | Client authentication profile names applied at the API Gateway level |
+| `authentication.enforceOnPaths` | `true`: enforce only on `authentication.paths` · `false`: enforce on all paths except `authentication.paths` |
+| `authentication.paths` | List of API endpoint paths for scoped client authentication |
+| `authorization[].profile` | Authorization profile name |
+| `authorization[].enforceOnPaths` | `true`: enforce only on `authorization[].paths` · `false`: enforce on all paths except `authorization[].paths` |
+| `authorization[].paths` | List of API endpoint paths for scoped authorization |
+| `cache[].profile` | Cache profile name |
+| `cache[].enforceOnPaths` | `true`: cache only `cache[].paths` · `false`: cache all paths except `cache[].paths` |
+| `cache[].paths` | List of API endpoint paths for scoped caching |
+| `rate_limit.enforceOnPaths` | `true`: rate limit only `rate_limit.paths` · `false`: rate limit all paths except `rate_limit.paths` |
+| `rate_limit.paths` | List of API endpoint paths for scoped rate limiting |
+
+#### Developer Portal and Visibility Fields
+
+| Field | Description |
+| --- | --- |
+| `developer_portal.enabled` | Enable or disable Developer Portal provisioning |
+| `developer_portal.type` | Portal type (`redocly` or `backstage`) |
+| `developer_portal.redocly.*` | Redocly configuration options — see the [Postman collection](/contrib/postman) |
+| `developer_portal.backstage.*` | Backstage manifest options — see the [Postman collection](/contrib/postman) |
+| `visibility[].enabled` | Enable or disable API visibility integration |
+| `visibility[].type` | Integration provider (`moesif`) |
+| `visibility[].moesif.*` | Moesif collector configuration — see the [Postman collection](/contrib/postman) |
+
+### Developer Portal and API Visibility
+
+| Integration | Category | API v5.5 | API v5.6 | API v5.7 | Notes |
+| --- | --- | :---: | :---: | :---: | --- |
+| **Redocly** | Developer Portal | ✅ | ✅ | ✅ | Static developer portal served directly by NGINX Plus |
+| **Backstage.io** | Developer Portal | ✅ | ✅ | ✅ | Generates Backstage catalog YAML entity files |
+| **Moesif** | API Visibility | ✅ | ✅ | ✅ | Telemetry integration — see [Moesif NGINX/OpenResty docs](https://www.moesif.com/docs/server-integration/nginx-openresty/) |
+
+---
+
+## Security and Authentication
+
+### TLS and ACME Protocol
+
+| Feature | API v5.5 | API v5.6 | API v5.7 | Declaration Path | NGINX Reference |
+| --- | :---: | :---: | :---: | --- | --- |
+| **ACME Protocol** | ✅ | ✅ | ✅ | `.declaration.http.acme_issuers[]` | [`ngx_http_acme_module`](https://nginx.org/en/docs/http/ngx_http_acme_module.html) |
+
+
+Configuration schema: ACME issuer profile
```json
{
@@ -130,43 +263,48 @@ For full details for all fields see https://nginx.org/en/docs/http/ngx_http_acme
"contact": "",
"account_key": "",
"ssl_trusted_certificate": "",
- "ssl_verify": ,
+ "ssl_verify": "",
"state_path": "",
- "accept_terms_of_service":
+ "accept_terms_of_service": ""
}
```
-### Client authentication
+
-| Type | Description | API v5.5 | API v5.6 | API v5.7 | Notes |
-|------|----------------------|----------|----------|----------|-------------------------------------|
-| jwt | JSON Web Token (JWT) | X | X | X | |
-| mtls | Mutual TLS | X | X | X | Supported for HTTP servers |
-| oidc | OpenID Connect | X | X | X | Supported for HTTP servers |
+### Client Authentication
-#### Examples
+**Declaration path:**
+- **API v5.5 – v5.6:** `.declaration.http.authentication.client[]`
+- **API v5.7+:** `.declaration.authentication.client[]`
-Client-side authentication profiles to be defined under `.declaration.http.authentication.client[]` (up to API v5.6) or `.declaration.authentication.client[]` (API v5.7+)
+| Type | Description | API v5.5 | API v5.6 | API v5.7 | Scope Notes |
+| --- | --- | :---: | :---: | :---: | --- |
+| `jwt` | JSON Web Token (JWT) | ✅ | ✅ | ✅ | Inline JWK or remote JWKS URL |
+| `mtls` | Mutual TLS | ✅ | ✅ | ✅ | Supported for HTTP servers |
+| `oidc` | OpenID Connect | ✅ | ✅ | ✅ | Powered by [`ngx_http_oidc_module`](https://nginx.org/en/docs/http/ngx_http_oidc_module.html) |
-- jwt client authentication profile
+
+Configuration schemas: JWT, mTLS, and OIDC client authentication profiles
- ```json
+**JWT Client Authentication Profile:**
+
+```json
{
"name": "",
"type": "jwt",
"jwt": {
"realm": "",
"key": "|",
- "cachetime": ,
+ "cachetime": "",
"token_location": ""
}
}
```
-- mTLS client authentication profile
+**mTLS Client Authentication Profile:**
- ```json
- {
+```json
+{
"name": "",
"type": "mtls",
"mtls": {
@@ -178,18 +316,17 @@ Client-side authentication profiles to be defined under `.declaration.http.authe
"responder": ""
},
"stapling": {
- "enabled": ,
- "verify": ,
+ "enabled": "",
+ "verify": "",
"responder": ""
}
}
}
```
-- OpenID Connect client authentication profile
-For additional details see https://nginx.org/en/docs/http/ngx_http_oidc_module.html
+**OpenID Connect (OIDC) Client Authentication Profile:**
- ```json
+```json
{
"name": "",
"type": "oidc",
@@ -198,69 +335,77 @@ For additional details see https://nginx.org/en/docs/http/ngx_http_oidc_module.h
"client_id": "",
"client_secret": "",
"config_url": "",
- "cookie_name" : "",
+ "cookie_name": "",
"extra_auth_args": "",
"redirect_uri": "",
"logout_uri": "",
"post_logout_uri": "",
- "logout_token_hint": ,
+ "logout_token_hint": "",
"scope": "",
"session_store": "",
"session_timeout": "",
"session_sync_leeway": "",
"ssl_crl": "",
"ssl_trusted_certificate": "",
- "userinfo":
+ "userinfo": ""
}
}
```
-### Client authorization
+
-| Type | Description | API v5.5 | API v5.6 | API v5.7 | Notes |
-|------|------------------------|----------|----------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| jwt | JSON Web Token (JWT) | X | X | X | Based on JWT claims. Supported under .declaration.http.servers[].declaration.http.servers[].location[].declaration.http.servers[].location[].apigateway |
+### Client Authorization
-#### Examples
+**Declaration path:**
+- **API v5.5 – v5.6:** `.declaration.http.authorization`
+- **API v5.7+:** `.declaration.authorization`
-Client-side authorization profiles to be defined under `.declaration.http.authorization` (up to API v5.6) or `.declaration.authorization` (API v5.7+)
+| Type | Description | API v5.5 | API v5.6 | API v5.7 | Supported Scopes |
+| --- | --- | :---: | :---: | :---: | --- |
+| `jwt` | JSON Web Token (JWT) claims | ✅ | ✅ | ✅ | `.declaration.http.servers[]`, `.locations[]`, and `.apigateway` |
-- jwt client authorization profile
+
+Configuration schema: JWT claims authorization profile
- ```json
+```json
{
- "name": "",
- "type": "jwt",
- "jwt": {
- "claims": [
- {
- "name": "",
- "value": [
- ""
- ],
- "errorcode":
- }
- ]
- }
+ "name": "",
+ "type": "jwt",
+ "jwt": {
+ "claims": [
+ {
+ "name": "",
+ "value": [
+ ""
+ ],
+ "errorcode": ""
+ }
+ ]
+ }
}
```
-### Upstream and Source of truth authentication
+
-| Type | Description | API v5.5 | API v5.6 | API v5.7 | Notes |
-|--------------|------------------------------------------------|----------|----------|----------|------------------------------------------------------------------------------|
-| Bearer token | Authentication token as Authorization Bearer | X | X | X | `Bearer` Authorization header is injected in requests to upstreams and source of truth |
-| Basic Auth | Authentication token as Authorization Basic | X | X | X | `Basic` Authorization header is injected in requests to upstreams and source of truth |
-| HTTP header | Authentication token in custom HTTP header | X | X | X | HTTP header is injected in requests to upstreams and source of truth |
-| mTLS | Mutual TLS | X | X | X | Client certificate is sent to upstream / source of truth |
+### Upstream and Source of Truth Authentication
-#### Examples
+**Declaration path:**
+- **API v5.5 – v5.6:** `.declaration.http.authentication.server[]`
+- **API v5.7+:** `.declaration.authentication.server[]`
-Server-side authentication profiles to be defined under `.declaration.http.authentication.server[]` (up to API v5.6) or `.declaration.authentication.server[]` (API v5.7+)
+| Type | Mechanism | API v5.5 | API v5.6 | API v5.7 | Notes |
+| --- | --- | :---: | :---: | :---: | --- |
+| **Bearer token** | `Authorization: Bearer` header | ✅ | ✅ | ✅ | Sent to upstreams and external sources of truth |
+| **Basic Auth** | `Authorization: Basic` credentials | ✅ | ✅ | ✅ | Sent to upstreams and external sources of truth |
+| **HTTP header** | Custom authentication header | ✅ | ✅ | ✅ | Sent to upstreams and external sources of truth |
+| **mTLS** | Client TLS certificate & key | ✅ | ✅ | ✅ | Mutual TLS to upstreams and external sources of truth |
-- Bearer token authentication profile
+
+Configuration schemas: Bearer, Basic Auth, HTTP header, and mTLS server profiles
- ```json
+**Bearer Token Profile:**
+
+```json
{
"name": "",
"type": "token",
@@ -271,9 +416,9 @@ Server-side authentication profiles to be defined under `.declaration.http.authe
}
```
-- Basic authentication profile
+**Basic Auth Profile:**
- ```json
+```json
{
"name": "",
"type": "token",
@@ -285,9 +430,9 @@ Server-side authentication profiles to be defined under `.declaration.http.authe
}
```
-- HTTP header authentication profile
+**HTTP Header Profile:**
- ```json
+```json
{
"name": "",
"type": "token",
@@ -299,7 +444,7 @@ Server-side authentication profiles to be defined under `.declaration.http.authe
}
```
-- mTLS authentication profile
+**mTLS Profile:**
```json
"server": [
@@ -311,140 +456,133 @@ Server-side authentication profiles to be defined under `.declaration.http.authe
"key": ""
}
}
+]
```
-### HTTP Headers manipulation
+
+
+---
-| Type | API v5.5 | API v5.6 | API v5.7 | Notes |
-|-------------------------------|----------|----------|----------|--------------------------------------------------------------------------------------------------------------------|
-| Request (client to server) | X | X | X | `set` - new header injection`delete` - client header removal |
-| Response (server to client) | X | X | X | `add` - new header injection`delete` - server header removal`replace` - server header replacement |
+## Observability, DNS, and Scripting
-#### Examples
+### HTTP Access and Error Logging
-To be defined under `.declaration.http.servers[].headers` and/or `.declaration.http.servers[].location[]`
+| Feature | API v5.5 | API v5.6 | API v5.7 | Notes |
+| --- | :---: | :---: | :---: | --- |
+| **Access & error logging** | ✅ | ✅ | ✅ | Supported in `.declaration.http.servers[].log` and `.declaration.http.servers[].locations[].log`.
`condition` disables access logging when evaluating to `"0"` or `""`. |
+
+**NGINX references:** [`access_log`](https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log) · [`syslog`](https://nginx.org/en/docs/syslog.html) · [`error_log`](https://nginx.org/en/docs/ngx_core_module.html#error_log)
+
+
+Configuration schema: Server / location logging object
```json
- "headers": {
- "to_server": {
- "set": [
- {
- "name": "",
- "value": ""
- },
- ...
- ],
- "delete": [
- "",
- ...
- ]
+{
+ "access": {
+ "destination": "",
+ "format": "",
+ "condition": ""
},
- "to_client": {
- "add": [
- {
- "name": "",
- "value": ""
- },
- ...
- ],
- "delete": [
- "",
- ...
- ],
- "replace": [
- {
- "name": "",
- "value": ""
- },
- ...
- ]
+ "error": {
+ "destination": "",
+ "level": ""
}
}
```
-### NGINX Javascript
-
-| Hook type | API v5.5 | API v5.6 | API v5.7 | Notes |
-|---------------------|----------|----------|----------|----------------------------------------------------------------------------------------------------------------------|
-| js_body_filter | X | X | X | Available in `declaration.http.servers[].location[]` |
-| js_content | X | X | X | Available in `declaration.http.servers[].location[]` |
-| js_header_filter | X | X | X | Available in `declaration.http.servers[].location[]` |
-| js_periodic | X | X | X | Available in `declaration.http.servers[].location[]` |
-| js_preload_object | X | X | X | Available in `.declaration.http``declaration.http.servers[]``declaration.http.servers[].location[]` |
-| js_set | X | X | X | Available in `.declaration.http``declaration.http.servers[]``declaration.http.servers[].location[]` |
+
-Note: `njs` profiles can be included in base64-encoded format under `.declaration.http.njs[]` of fetched from an external source of truth
-For detailed examples see the [Postman collection](/contrib/postman)
+### Access Logging Formats
-### Examples
+| Feature | API v5.5 | API v5.6 | API v5.7 | Declaration Path | NGINX Reference |
+| --- | :---: | :---: | :---: | --- | --- |
+| **Custom log formats** | ✅ | ✅ | ✅ | `.declaration.http.logformats[]` | [`log_format`](https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format) |
-`njs` profile example:
+
+Configuration schema: HTTP access log format
```json
{
- ...
- "declaration": {
- "http": {
- ...
- "njs_profiles": [
- {
- "name": "",
- "file": {
- "content": "",
- "authentication": [
- {
- "profile": ""
- }
- ]
- }
- }
- ]
- }
- }
+ "name": "",
+ "escape": "",
+ "format": ""
}
-
```
-`njs` hook examples (under `.declaration.http`, `.declaration.http.servers[]`, `.declaration.http.servers[].location[]`):
+
+
+### DNS Resolvers
+
+| Feature | API v5.5 | API v5.6 | API v5.7 | Declaration Path | Referenceable From |
+| --- | :---: | :---: | :---: | --- | --- |
+| **DNS resolver profiles** | ✅ | ✅ | ✅ | `.declaration.resolvers[]` | `.declaration.http.servers[]`, `.declaration.http.upstreams[]`, `.declaration.layer4.upstreams[]` |
+
+
+Configuration schema: DNS resolver profile
```json
-"njs": [
- {
- "hook": {
- "type": ""
- },
- "profile": "",
- "function": ""
- }
-]
+{
+ "name": "",
+ "address": "",
+ "valid": "5s",
+ "ipv4": true,
+ "ipv6": false,
+ "timeout": "30s"
+}
```
-Example hooks:
+
+
+### NGINX JavaScript
+
+`njs` profiles can be supplied inline (base64-encoded under `.declaration.http.njs_profiles[]`) or fetched from a source of truth, and bound via `njs` hook arrays at `http`, `servers[]`, or `locations[]` levels. In API v5.7, API Gateway request body schema enforcement also automatically generates and wires dedicated `apigw_body_*` `njs` modules. See the [Postman collection](/contrib/postman) for full examples.
+
+| Hook Type | API v5.5 | API v5.6 | API v5.7 | Scope Availability | NGINX Documentation |
+| --- | :---: | :---: | :---: | --- | --- |
+| `js_body_filter` | ✅ | ✅ | ✅ | `locations[]` | [`js_body_filter`](https://nginx.org/en/docs/http/ngx_http_js_module.html#js_body_filter) |
+| `js_content` | ✅ | ✅ | ✅ | `locations[]` | [`js_content`](https://nginx.org/en/docs/http/ngx_http_js_module.html#js_content) |
+| `js_header_filter` | ✅ | ✅ | ✅ | `locations[]` | [`js_header_filter`](https://nginx.org/en/docs/http/ngx_http_js_module.html#js_header_filter) |
+| `js_periodic` | ✅ | ✅ | ✅ | `locations[]` | [`js_periodic`](https://nginx.org/en/docs/http/ngx_http_js_module.html#js_periodic) |
+| `js_preload_object` | ✅ | ✅ | ✅ | `http`, `servers[]`, `locations[]` | [`js_preload_object`](https://nginx.org/en/docs/http/ngx_http_js_module.html#js_preload_object) |
+| `js_set` | ✅ | ✅ | ✅ | `http`, `servers[]`, `locations[]` | [`js_set`](https://nginx.org/en/docs/http/ngx_http_js_module.html#js_set) |
-- `js_body_filter` - see https://nginx.org/en/docs/http/ngx_http_js_module.html#js_body_filter
+
+Configuration schemas: njs_profiles[] definition and hook examples
+
+**`njs` Profile:**
```json
-"njs": [
- {
- "hook": {
- "type": "js_body_filter",
- "js_body_filter": {
- "buffer_type": ""
- }
- },
- "profile": "",
- "function": ""
+{
+ "declaration": {
+ "http": {
+ "njs_profiles": [
+ {
+ "name": "",
+ "file": {
+ "content": "",
+ "authentication": [
+ {
+ "profile": ""
+ }
+ ]
+ }
+ }
+ ]
+ }
}
-]
+}
```
-- `js_content` - see https://nginx.org/en/docs/http/ngx_http_js_module.html#js_content
+**`js_body_filter` Hook:**
```json
"njs": [
{
"hook": {
- "type": "js_content"
+ "type": "js_body_filter",
+ "js_body_filter": {
+ "buffer_type": ""
+ }
},
"profile": "",
"function": ""
@@ -452,13 +590,13 @@ Example hooks:
]
```
-- `js_header_filter` - see https://nginx.org/en/docs/http/ngx_http_js_module.html#js_header_filter
+**`js_content`, `js_header_filter`, and `js_preload_object` Hooks:**
```json
"njs": [
{
"hook": {
- "type": "js_header_filter"
+ "type": ""
},
"profile": "",
"function": ""
@@ -466,7 +604,7 @@ Example hooks:
]
```
-- `js_periodic` - see https://nginx.org/en/docs/http/ngx_http_js_module.html#js_periodic
+**`js_periodic` Hook:**
```json
"njs": [
@@ -477,21 +615,7 @@ Example hooks:
"interval": "",
"jitter": "",
"worker_affinity": ""
- }
- },
- "profile": "",
- "function": ""
- }
-]
-```
-
-- `js_preload_object` - see https://nginx.org/en/docs/http/ngx_http_js_module.html#js_preload_object
-
-```json
-"njs": [
- {
- "hook": {
- "type": "js_preload_object"
+ }
},
"profile": "",
"function": ""
@@ -499,7 +623,7 @@ Example hooks:
]
```
-- `js_set` - see https://nginx.org/en/docs/http/ngx_http_js_module.html#js_set
+**`js_set` Hook:**
```json
"njs": [
@@ -507,7 +631,7 @@ Example hooks:
"hook": {
"type": "js_set",
"js_set": {
- "variable": ""
+ "variable": ""
}
},
"profile": "",
@@ -516,81 +640,4 @@ Example hooks:
]
```
-### DNS resolvers
-
-| | API v5.5 | API v5.6 | API v5.7 | Notes |
-|-------------------------|----------|----------|----------|--------------------------------------------------------------------------------------------------------------------------|
-| DNS resolver profiles | X | X | X | Available in `declaration.http.servers[]``declaration.http.upstreams[]``declaration.layer4.upstreams[]` |
-
-#### Examples
-
-DNS resolver profiles to be defined under `.declaration.http.resolvers[]`
-
-- DNS resolver profile:
-
- ```json
-{
- "name": "",
- "address": "",
- "valid": "5s",
- "ipv4": true,
- "ipv6": false,
- "timeout": "30s"
-}
-```
-
-#### HTTP Access and error logging
-
-| | API v5.5 | API v5.6 | API v5.7 | Notes |
-|---------|----------|----------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| Logging | X | X | X | Available in `.declaration.http.servers[].log``.declaration.http.servers[].locations[].log`
`condition` enables conditional logging. Logging will be disabled if `condition` evaluates to "0" or an empty string |
-
-### Access logging formats
-
-| | API v5.5 | API v5.6 | API v5.7 | Notes |
-|-----------------|----------|----------|----------|-------|
-| Logging formats | X | X | X | |
-
-#### Examples
-
-Access and error logging available in `.declaration.http.servers[].log` and `.declaration.http.servers[].locations[].log`
-See:
-
-* Access log: https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
-* Logging to syslog: https://nginx.org/en/docs/syslog.html
-* Error log: https://nginx.org/en/docs/ngx_core_module.html#error_log
-
-```json
-{
- "access": {
- "destination": "",
- "format": "",
- "condition": ""
- },
- "error": {
- "destination": "",
- "level": ""
- }
-}
-```
-
-Access logging formats to be defined in `.declaration.http.logformats[]`
-See:
-
-* Access log format: https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
-
-```json
-{
- "name": "",
- "escape": "",
- "format": ""
-}
-```
-
-### Maps
-
-Map entries `.declaration.http.maps[].entries.keymatch` can be:
-
-- *exact* - exact variable matching
-- *regex* - case sensitive regex matching
-- *iregex* - case insensitive regex matching
\ No newline at end of file
+
diff --git a/README.md b/README.md
index e2788fde..9ce36ddf 100644
--- a/README.md
+++ b/README.md
@@ -1,246 +1,185 @@
-# NGINX-Declarative-API
+# NGINX Declarative API
[](https://www.repostatus.org/#active)
[](https://codecov.io/gh/f5devcentral/NGINX-Declarative-API)
-NGINX Declarative API enables users to manage **NGINX configurations** in a modern **declarative style**. Instead of modifying configurations manually or using low-level APIs, this project simplifies operational workflows by allowing users to express desired configurations as a single JSON object.
-The API abstracts the complexity of managing NGINX configurations, empowering developers, operators, and automation systems to integrate seamlessly with NGINX.
+**NGINX Declarative API** builds, validates, and deploys complete NGINX Plus configurations from a single **declarative JSON** describing your **intended outcome**—replacing hand-written `nginx.conf` files and imperative control-plane scripts with an automation-first API designed for CI/CD, GitOps, and OpenAPI-driven API Gateway delivery.
-This project supports [F5 NGINX Instance Manager](https://docs.nginx.com/nginx-instance-manager/) and [F5 NGINX One Console](https://docs.nginx.com/nginx-one-console/)
+It publishes staged configurations to both [F5 NGINX Instance Manager](https://docs.f5.com/nginx-instance-manager/) (instance groups) and [F5 NGINX One Console](https://docs.f5.com/nginx-one-console/) (config sync groups).
-## 📚 Overview
+## Table of Contents
-At its core, the NGINX Declarative API supports **declarative configuration management** by letting users define what the state of NGINX *should be*, rather than how to get there. It eliminates the need for procedural changes by processing user-defined JSON payloads into valid and optimized NGINX configurations.
+- [Why NGINX Declarative API](#why-nginx-declarative-api)
+- [Describe the Intended Outcome](#describe-the-intended-outcome)
+- [Core Use Cases](#core-use-cases)
+ - [API Gateway Automation](#api-gateway-automation)
+ - [GitOps Workflows and Autosync](#gitops-workflows-and-autosync)
+ - [Traffic Management, Security, and WAF](#traffic-management-security-and-waf)
+- [Supported Releases](#supported-releases)
+- [Architecture and Ecosystem](#architecture-and-ecosystem)
+- [Documentation and Examples](#documentation-and-examples)
+- [Deployment](#deployment)
+- [Running Tests](#running-tests)
+- [Security, License, and Community](#security-license-and-community)
-This tool is ideal for managing NGINX in **modern, dynamic infrastructures** such as CI/CD environments, containerized applications (like Kubernetes), or large-scale proxy server setups.
-
-### ➡️ Why Use the NGINX Declarative API?
-
-- ✅ **Declarative Simplicity**: Express configurations as a single, high-level JSON object.
-- ✅ **Automation-First Design**: Integrate configurations into CI/CD pipelines with minimal effort.
-- ✅ **Error Reduction**: Built-in validation for accurate and optimized configurations.
-- ✅ **Dynamic Updates**: Handle frequent configuration changes in highly dynamic environments.
-- ✅ **Seamless Scalability**: Simplifies managing NGINX setups in high-scale distributed architectures.
-- ✅ **MCP Server**: Provides the ability to configure NGINX using natural language.
-
-
-GitOps integration is supported: source of truth is checked for updates (F5 WAF for NGINX policies, TLS certificates, keys and chains/bundles, Swagger/OpenAPI definitions, snippets) and NGINX configurations are automatically kept in sync.
-
-### 📝 Use Cases
-
-- Integration with F5 NGINX Instance Manager (instance group) and F5 NGINX One Console (config sync group)
-- F5 WAF for NGINX DevSecOps integration
-- API Gateway deployments with automated Swagger / OpenAPI schema import
-- API Developer portals zero-touch deployment (redocly and backstage supported)
-- API Visibility (moesif supported)
-- GitOps integration with source of truth support for
- - F5 WAF for NGINX policies
- - TLS certificates, keys and chains/bundles
- - mTLS certificates
- - `http` snippets, upstreams, servers, locations
- - `stream` snippets, upstreams, servers
- - Swagger / OpenAPI schemas
- - NGINX Javascript
-
-A **blog article** to automate NGINX API Gateway management from OpenAPI schemas is available [here](https://www.f5.com/company/blog/nginx/from-openapi-to-nginx-as-an-api-gateway-using-a-declarative-api)
-
-## 🚀 Supported releases
-
-| API Version | F5 NGINX Instance Manager | F5 NGINX One Console | F5 NGINX Plus | F5 WAF for NGINX |
-|-------------|---------------------------|----------------------|---------------|------------------|
-| v5.5 | 2.20+ | January 2026 | R33+ | 5.x |
-| v5.6 | 2.20+ | January 2026 | R33+ | 5.x |
-| v5.7 | 2.22+ | August 2026 | R35+ | 5.x |
-
->**Note**: F5 NGINX Plus R33 and above [require a valid license](https://docs.nginx.com/solutions/about-subscription-licenses/) and the `.output.license` section in the declarative JSON is required.
-
-## 🛠️ Architecture
-
-```mermaid
---
-title: NGINX Declarative API architecture
----
-stateDiagram-v2
- Client: **REST Client**
- Pipeline: **CI/CD Pipeline**
- NIM: NGINX Instance Manager
- N1: NGINX One Console
- AGENT1: NGINX Agent
- NGINX1: NGINX
- AGENT2: NGINX Agent
- NGINX2: NGINX
- SOT: Source of Truth
- NDAPI: NGINX Declarative API
- DEVP: Developer Portal Service
- OUTPUT: Output
- REDIS: Redis
- 3RDPARTY: 3rd Party integrations
- MCP: MCP Server
- MCPC: **MCP Client**
-
- MCPC --> MCP
- MCP --> NDAPI
- Pipeline --> NDAPI
- Client --> NDAPI
- NDAPI --> OUTPUT
- NDAPI --> SOT
- SOT --> NDAPI
- NDAPI --> 3RDPARTY
- 3RDPARTY --> NDAPI
- NDAPI --> REDIS
- REDIS --> NDAPI
- OUTPUT --> NIM
- OUTPUT --> N1
- NDAPI --> DEVP
- DEVP --> NDAPI
- NIM --> AGENT1
- AGENT1 --> NGINX1
- N1 --> AGENT2
- AGENT2 --> NGINX2
-```
-
-## 🤖 GitOps Autosync Mode
-
-```mermaid
-sequenceDiagram
-
-title GitOps autosync operations
-
-participant CI/CD Pipeline
-participant Source of Truth
-participant NGINX Declarative API
-participant Redis
-participant Developer Portal Service
-participant NGINX Instance Manager / NGINX One Console
-participant NGINX
-
-box NGINX Declarative API
- participant NGINX Declarative API
- participant Developer Portal Service
- participant Redis
-end
-
-CI/CD Pipeline ->> Source of Truth: Commit object updates
-
-critical Run every "synctime" seconds
-
-NGINX Declarative API ->>+ Source of Truth: Check for referenced objects updates
-Source of Truth ->>- NGINX Declarative API: Latest timestamp
-
-Note over NGINX Declarative API, Redis: data synchronization
-
-option If updates available
-NGINX Declarative API ->>+ Source of Truth: Pull updated objects
-Source of Truth ->>- NGINX Declarative API: Updated objects
-critical Build Staged Config
-critical If Developer Portal enabled
- NGINX Declarative API ->>+ Developer Portal Service: DevPortal generation request
- Developer Portal Service ->>- NGINX Declarative API: DevPortal definition
-end
-end
+## Why NGINX Declarative API
-NGINX Declarative API ->>+ NGINX Instance Manager / NGINX One Console: Publish staged config to instance group / config sync group
-NGINX Instance Manager / NGINX One Console ->> NGINX: Publish config to NGINX instances
-NGINX Instance Manager / NGINX One Console ->>- NGINX Declarative API: Return outcome
+- **Declarative Simplicity:** Model your entire NGINX Plus edge in a single high-level JSON payload instead of managing fragmented configuration templates.
+- **Built-In Contract Enforcement:** Generate full API Gateway enforcement directly from Swagger and OpenAPI definitions—covering methods, headers, query parameters, response codes, `Content-Type`, and request body schemas.
+- **GitOps-Native Reconciliation:** Reference remote Sources of Truth for OpenAPI specs, F5 WAF for NGINX policies, TLS certificates/keys/chains, snippets, and `njs` modules; keep deployments continuously in sync via `synctime`.
+- **Safe Concurrent Delivery:** Queue concurrent `PATCH` updates safely across CI/CD pipelines with asynchronous submission tracking.
+- **Natural-Language Automation:** Includes a dedicated [Model Context Protocol (MCP) server](/contrib/mcp) and web UI ([`webui`](/webui)) alongside the REST API.
-Note over NGINX Declarative API, Redis: data synchronization
+---
-end
+## Describe the Intended Outcome
+
+Instead of writing low-level `upstream`, `map`, `location`, TLS, WAF, or `proxy_pass` blocks manually, every declaration has two clean top-level sections:
+
+| Section | Responsibility | Key Settings |
+| --- | --- | --- |
+| **`.output`** | *Where and how to publish* | Target control plane (`nms` or `nginxone`), instance group / config sync group, NGINX Plus license, GitOps poll interval (`synctime`), synchronous vs. queued execution |
+| **`.declaration`** | *What NGINX should serve and enforce* | HTTP and Layer 4 (`stream`) servers/upstreams, TLS & ACME issuers, auth/authz profiles, F5 WAF for NGINX policies, `njs` hooks, and OpenAPI-driven API Gateways |
+
+```json
+{
+ "output": {
+ "type": "nms",
+ "nms": {
+ "url": "https://nim.example.com",
+ "instancegroup": "prod-apigw",
+ "synctime": 60
+ }
+ },
+ "declaration": {
+ "http": {
+ "servers": [
+ {
+ "name": "api_edge",
+ "names": ["api.example.com"],
+ "locations": [
+ {
+ "uri": "/v1",
+ "apigateway": {
+ "openapi_schema": {
+ "content": "https://gitops.example.com/specs/orders-openapi.yaml"
+ },
+ "api_gateway": {
+ "enabled": true,
+ "strip_uri": true,
+ "enforce_methods": true,
+ "enforce_bodies": true,
+ "enforce_parameters": true,
+ "enforce_response_codes": true
+ }
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
```
-## 🕒 Concurrent access and queuing mode
-
-```mermaid
-sequenceDiagram
+From that single declaration, NGINX Declarative API fetches the OpenAPI specification, compiles upstream definitions, per-path routing locations, parameter validation `map` rules, and `njs` request body schema validators, publishes the complete bundle to NGINX Instance Manager, and re-checks external artifacts every `60` seconds.
-title Concurrent access and queueing mode
-
-participant CI/CD Pipeline
-participant NGINX Declarative API
-participant NGINX Instance Manager / NGINX One Console
-participant NGINX
+---
-critical Initial configuration deployment
+## Core Use Cases
-CI/CD Pipeline ->> NGINX Declarative API: POST request - base configuration deployment
+### API Gateway Automation
-NGINX Declarative API ->>+ NGINX Instance Manager / NGINX One Console: Publish staged config to instance group / config sync group
-NGINX Instance Manager / NGINX One Console ->> NGINX: Publish config to NGINX instances
-NGINX Instance Manager / NGINX One Console ->>- NGINX Declarative API: Return outcome
+Turn OpenAPI contracts directly into production NGINX Plus API Gateways (see also [From OpenAPI to NGINX as an API Gateway using a Declarative API](https://www.f5.com/company/blog/nginx/from-openapi-to-nginx-as-an-api-gateway-using-a-declarative-api)):
-NGINX Declarative API ->> CI/CD Pipeline: Response
+- **Broad OpenAPI Coverage (`v5.7`):** Supports YAML and JSON schemas across **OAS 2.0 (Swagger 2.0)**, **OAS 3.0.x**, **OAS 3.1.x**, and **OAS 3.2.x**, including local `$ref` dereferencing, root/path/operation `servers[]`, server `variables`, `additionalOperations`, and Swagger `in: "body"` + `consumes`.
+- **Full Contract Enforcement:**
+ - `enforce_methods` — restricts each endpoint to documented HTTP methods.
+ - `enforce_bodies` — validates required request body presence, `Content-Type` headers, and full OpenAPI / JSON Schema request payloads (JSON, `*+json`, `application/x-www-form-urlencoded`, and `text/plain`) via auto-generated NGINX JavaScript (`njs`).
+ - `enforce_parameters` — validates required query parameters, mandatory HTTP headers, and enumerated values.
+ - `enforce_response_codes` — intercepts and normalizes undocumented upstream status codes.
+- **Scoped Traffic & Security Policies:** Apply rate limiting, client authentication (JWT, Bearer token, mTLS, OIDC), JWT claim authorization, response caching, and access/error logging across targeted endpoint subsets (`enforceOnPaths`).
+- **Developer Portals & Visibility:** Publish integrated **Redocly** portals or **Backstage.io** catalog manifests ([`contrib/devportal`](/contrib/devportal)), and instrument API telemetry with **Moesif**.
-end
+### GitOps Workflows and Autosync
-critical Asynchronous configuration submission
+Keep edge configurations aligned with Git repositories and external **Sources of Truth** without re-submitting declarations on every upstream change ([`contrib/gitops-examples`](/contrib/gitops-examples)):
-CI/CD Pipeline ->> NGINX Declarative API: PATCH request - asynchronous configuration update 1
-NGINX Declarative API ->>+ NGINX Declarative API: request added to the queue
-CI/CD Pipeline ->> NGINX Declarative API: PATCH request - asynchronous configuration update 2
-NGINX Declarative API ->>+ NGINX Declarative API: request added to the queue
+- **External Artifact Resolution:** Reference remote URLs (or inline base64 payloads) for OpenAPI specs, F5 WAF for NGINX policies, TLS certificates/keys/CA bundles, configuration snippets, and `njs` scripts.
+- **Continuous Autosync (`synctime`):** Periodically poll referenced external artifacts and automatically rebuild and republish NGINX configurations whenever an artifact changes.
+- **Concurrent CI/CD Pipelines (`synchronous: false`):** Non-blocking asynchronous `PATCH` queueing lets multiple teams update servers, upstreams, or WAF policies in parallel with live job tracking (`GET /v5.7/config/{configUid}/submission/{submissionUid}`).
+### Traffic Management, Security, and WAF
-loop Queue Manager Thread
-autonumber 1
+Configure HTTP and Layer 4 (`stream`) upstreams, active health checks, cookie-based stickiness, header rewrites, NGINX maps, custom access log formats, DNS resolver profiles, ACME TLS certificates, custom `njs` hooks, and F5 WAF for NGINX policies and log profiles. See [FEATURES.md](/FEATURES.md) for the complete capability matrix across `v5.5`, `v5.6`, and `v5.7`.
-NGINX Declarative API ->>+ NGINX Declarative API: get configuration update request from queue
+---
-NGINX Declarative API ->>+ NGINX Instance Manager / NGINX One Console: Publish staged config to instance group / config sync group
-NGINX Instance Manager / NGINX One Console ->> NGINX: Publish config to NGINX instances
-NGINX Instance Manager / NGINX One Console ->>- NGINX Declarative API: Return outcome
-NGINX Declarative API ->> NGINX Declarative API: Update configuration update request status
+## Supported Releases
-autonumber off
-end
+| API Version | F5 NGINX Instance Manager | F5 NGINX One Console | F5 NGINX Plus | F5 WAF for NGINX |
+| :---: | --- | --- | :---: | :---: |
+| **`v5.5`** | `2.20+` | January 2026 | `R33+` | `5.x` |
+| **`v5.6`** | `2.20+` | January 2026 | `R33+` | `5.x` |
+| **`v5.7`** | `2.22+` | August 2026 | `R35+` | `5.x` |
-CI/CD Pipeline ->> NGINX Declarative API: Check configuration request status
-NGINX Declarative API ->> CI/CD Pipeline: Response
+> **License Note:** F5 NGINX Plus `R33+` [requires a valid subscription license](https://docs.f5.com/solutions/about-subscription-licenses/), provided via `.output.license` in your declaration.
-end
-```
+---
-## 🌟 Supported features
+## Architecture and Ecosystem
-See the [features list](/FEATURES.md)
+- **Architecture Diagrams:** Control-plane flows, **GitOps Autosync Mode**, and **Concurrent Access / Queueing Mode** sequence diagrams are documented in [ARCHITECTURE.md](/ARCHITECTURE.md).
+- **Natural-Language Automation (MCP Server):** [contrib/mcp](/contrib/mcp) provides a Model Context Protocol server enabling LLM clients (such as Claude Desktop or Claude Code) to create, update, inspect, delete, and monitor NGINX declarations in plain language. See the [MCP Server README](/contrib/mcp/README.md).
+- **Web UI:** Included in [`webui/`](/webui) for visual declaration editing and management.
-### 🤖 MCP server (Model Context Protocol)
+---
-[contrib/mcp](/contrib/mcp) provides an MCP server that lets LLMs (Claude Desktop, Claude Code, or any MCP-compatible client) drive the NGINX Declarative API using
-natural language.
+## Documentation and Examples
-Creating, updating, retrieving, and deleting declarations, and checking asynchronous submission status, without the user hand-writing JSON or REST calls.
+| Resource | Purpose | Status |
+| --- | --- | --- |
+| [USAGE-v5.7.md](/USAGE-v5.7.md) | REST endpoints and full JSON schema reference (`v5.7`) | Latest |
+| [USAGE-v5.6.md](/USAGE-v5.6.md) | REST endpoints and JSON schema reference (`v5.6`) | Stable |
+| [USAGE-v5.5.md](/USAGE-v5.5.md) | REST endpoints and JSON schema reference (`v5.5`) | Deprecated |
+| [FEATURES.md](/FEATURES.md) | Full capability matrix, OpenAPI support, and config tables | Current |
+| [contrib/postman](/contrib/postman) | Ready-to-run Postman collections for API Gateway, WAF, and GitOps | Examples |
+| [contrib/gitops-examples](/contrib/gitops-examples) | Sample GitOps pipelines and external Source of Truth workflows | Examples |
-See the [MCP Server README](/contrib/mcp/README.md) for setup.
+---
-## 🔧 How to use
+## Deployment
-Usage details and JSON schema are available here:
+NGINX Declarative API can be built and deployed using any of the provided packaging options:
-- [API v5.7](/USAGE-v5.7.md) - latest
-- [API v5.6](/USAGE-v5.6.md) - stable
-- [API v5.5](/USAGE-v5.5.md) - deprecated
+- **Docker / Docker Compose:** [contrib/docker-compose](/contrib/docker-compose) (also builds local container images from [Dockerfile](/Dockerfile))
+- **Kubernetes Manifests:** [contrib/kubernetes](/contrib/kubernetes)
+- **Helm Chart:** [contrib/helm/nginx-declarative-api](/contrib/helm/nginx-declarative-api)
-A sample Postman collection and usage instructions can be found [here](/contrib/postman)
+Once the service is running, interactive REST API documentation is served automatically at:
-## 🏃 How to run
+- **Swagger UI:** `/docs`
+- **ReDoc UI:** `/redoc`
+- **OpenAPI JSON:** `/openapi.json`
-NGINX Declarative API can be deployed on:
+---
-* Linux virtual machine using [docker-compose](/contrib/docker-compose)
-* Kubernetes using [manifests](/contrib/kubernetes)
-* Kubernetes using a [Helm chart](contrib/helm/nginx-declarative-api)
+## Running Tests
-## 🧪 Running unit tests
+### Python Test Suite
-Python unit tests cover the core utility and configuration-patching modules. Run them from the repository root:
+Covers OpenAPI parsing, NGINX configuration & `njs` generation, declaration patching, and utility modules (runtime validation checks for generated `njs` body validators execute automatically when `node` is installed on `PATH`):
```bash
-pip3 install pytest pyyaml
+pip3 install -r src/requirements.txt pytest
python3 -m pytest tests/ -v
```
-WebUI tests use [Vitest](https://vitest.dev/) and can be run from the `webui/` directory:
+### Web UI Test Suite
+
+Runs [Vitest](https://vitest.dev/) unit tests for [`webui/`](/webui):
```bash
cd webui
@@ -248,36 +187,14 @@ npm install
npm test -- --run
```
-Both test suites run automatically in GitHub Actions on every pull request and release build.
-
-## 🐳 Building Docker images
+Both test suites run automatically in GitHub Actions on pull requests and release builds.
-Docker images can be built and run using the Docker compose [script](/contrib/docker-compose) provided
-
-## 📖 REST API documentation
-
-When NGINX Declarative API is running, REST API documentation can be accessed at:
-
-- Documentation and testing: `/docs`
-- Redoc documentation: `/redoc`
-- OpenAPI specification: `/openapi.json`
-
-## 🔒 Security
-
-To report a security vulnerability, please do **not** open a public GitHub issue. Instead, follow the responsible disclosure process outlined in [SECURITY.md](SECURITY.md).
-
-## ⚖️ License
-
-This repository is licensed under the Apache License, Version 2.0. You are free to use, modify, and distribute this codebase within the terms and conditions outlined in the license. For more details, please refer to the [LICENSE](/LICENSE.md) file.
-
-## 🆘 Support
-
-For support, please open a GitHub issue. Note that the code in this repository is community supported.
-
-## 💡 Contributing
-
-See [Contributing](/CONTRIBUTING.md)
+---
-## 🤝 Code of Conduct
+## Security, License, and Community
-See the [Code of Conduct](/code_of_conduct.md)
+- **Security:** Do **not** open public GitHub issues for suspected vulnerabilities—follow the disclosure process in [SECURITY.md](/SECURITY.md).
+- **License:** Apache License, Version 2.0 — see [LICENSE.md](/LICENSE.md).
+- **Contributing:** Guidelines and workflow details are in [CONTRIBUTING.md](/CONTRIBUTING.md).
+- **Support:** Open a GitHub issue (community supported).
+- **Code of Conduct:** See [code_of_conduct.md](/code_of_conduct.md).
diff --git a/SECURITY.md b/SECURITY.md
index aa2174e8..530d4b81 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -72,10 +72,10 @@ This security policy covers the **NGINX Declarative API application code** in th
The following are **not** in scope for this project's security policy and should be reported to their respective vendors:
-- [F5 NGINX Instance Manager](https://docs.nginx.com/nginx-instance-manager/) vulnerabilities → report to [F5 SIRT](https://www.f5.com/support/report-a-vulnerability)
-- [F5 NGINX One Console](https://docs.nginx.com/nginx-one/) vulnerabilities → report to [F5 SIRT](https://www.f5.com/support/report-a-vulnerability)
-- [F5 NGINX Plus](https://docs.nginx.com/nginx/) vulnerabilities → report to [F5 SIRT](https://www.f5.com/support/report-a-vulnerability)
-- [F5 WAF for NGINX](https://docs.nginx.com/waf/) vulnerabilities → report to [F5 SIRT](https://www.f5.com/support/report-a-vulnerability)
+- [F5 NGINX Instance Manager](https://docs.f5.com/nginx-instance-manager/) vulnerabilities → report to [F5 SIRT](https://www.f5.com/support/report-a-vulnerability)
+- [F5 NGINX One Console](https://docs.f5.com/nginx-one-console/) vulnerabilities → report to [F5 SIRT](https://www.f5.com/support/report-a-vulnerability)
+- [F5 NGINX Plus](https://docs.f5.com/nginx/) vulnerabilities → report to [F5 SIRT](https://www.f5.com/support/report-a-vulnerability)
+- [F5 WAF for NGINX](https://docs.f5.com/waf/) vulnerabilities → report to [F5 SIRT](https://www.f5.com/support/report-a-vulnerability)
- Third-party dependencies (Redis, Moesif, Redocly, Backstage) → report to respective maintainers
---
diff --git a/USAGE-v5.7.md b/USAGE-v5.7.md
index 045b846d..03d04a76 100644
--- a/USAGE-v5.7.md
+++ b/USAGE-v5.7.md
@@ -1,72 +1,236 @@
-# Usage for NGINX Declarative API v5.7
-
-Version 5.7 supports:
-
-- [NGINX Instance Manager](https://docs.nginx.com/nginx-instance-manager/) 2.22+
-- [NGINX One Console](https://docs.nginx.com/nginx-one-console/)
-- [NGINX Plus](https://docs.nginx.com/nginx/) R37+
-- [F5 WAF for NGINX](https://docs.nginx.com/waf/) with precompiled [policy bundles](https://docs.nginx.com/nginx-app-protect-waf/v5/admin-guide/compiler/)
-
-The JSON schema is self explanatory. See also the [sample Postman collection](/contrib/postman) for usage examples
-
-- `.output.license` defines the JWT license to use
- - `.output.license.endpoint` the usage reporting endpoint (defaults to `product.connect.nginx.com`). NGINX Instance Manager address or FQDN can be used here
- - `.output.license.token` the JWT license token. If this field is omitted, it is assumed that a `/etc/nginx/license.jwt` token already exists on the instance and it won't be replaced
- - `.output.license.ssl_verify` set to `false` to trust all SSL certificates (not recommended). Useful for reporting to NGINX Instance Manager without a local PKI.
- - `.output.license.grace_period` Set to 'true' to begin the 180-day reporting enforcement grace period. Reporting must begin or resume before the end of the grace period to ensure continued operation
- - `.output.license.proxy` The optional explicit forward proxy `IP_address:port` or `FQDN:port` for usage reporting
- - `.output.license.proxy_username` The optional explicit forward proxy authentication username for usage reporting
- - `.output.license.proxy_password` The optional explicit forward proxy authentication password for usage reporting
-- `.output.type` defines how NGINX configuration will be returned:
- - *nms* - NGINX configuration is published as a Staged Config to NGINX Instance Manager
- - `.output.nms.url` the NGINX Instance Manager URL
- - `.output.nms.username` the NGINX Instance Manager authentication username
- - `.output.nms.password` the NGINX Instance Manager authentication password
- - `.output.nms.instancegroup` the NGINX Instance Manager instance group to publish the configuration to
- - `.output.nms.synctime` **optional**, used for GitOps autosync. When specified and the declaration includes HTTP(S) references to NGINX App Protect policies, TLS certificates/keys/chains, the HTTP(S) endpoints will be checked every `synctime` seconds and if external contents have changed, the updated configuration will automatically be published to NGINX Instance Manager
- - `.output.nms.synchronous` **optional**, when set to `True` (default) the NGINX Declarative API waits for NGINX Instance Manager successful reply after publishing the NGINX configuration. Setting this to `False` enqueues the request, supporting multiple JSON declarations to be submitted at the same time/from multiple clients. Currently supported for `PATCH` operations only.
- - `.output.nms.modules` an optional array of NGINX module names (ie. 'ngx_http_app_protect_module', 'ngx_http_js_module','ngx_stream_js_module')
- - *nginxone* - NGINX configuration is published to a NGINX One Console config sync group
- - `.output.nginxone.url` the NGINX One Console URL
- - `.output.nginxone.namespace` the NGINX One Console namespace
- - `.output.nginxone.token` the authentication token
- - `.output.nginxone.configsyncgroup` the NGINX One Console config sync group name
- - `.output.nginxone.synctime` **optional**, used for GitOps autosync. When specified and the declaration includes HTTP(S) references to WAF policies, TLS certificates/keys/chains, the HTTP(S) endpoints will be checked every `synctime` seconds and if external contents have changed, the updated configuration will automatically be published to NGINX One Cloud Console
- - `.output.nms.synchronous` **optional**, when set to `True` (default) the NGINX Declarative API waits for NGINX One Console successful reply after publishing the NGINX configuration. Setting this to `False` enqueues the request, supporting multiple JSON declarations to be submitted at the same time/from multiple clients. Currently supported for `PATCH` operations only.
- - `.output.nginxone.modules` an optional array of NGINX module names (ie. 'ngx_http_app_protect_module', 'ngx_http_js_module','ngx_stream_js_module')
-- `.declaration` describes the NGINX configuration to be created
- - `.declaration.http` NGINX HTTP definitions
- - `.declaration.http.policies[]` an optional array of WAF security policies
- - `.declaration.http.policies[].type` the policy type ('app_protect')
- - `.declaration.http.policies[].name` the policy name (ie. 'prod-policy')
- - `.declaration.http.policies[].active_tag` the policy tag to enable among all available versions (ie. 'v1')
- - `.declaration.http.policies[].versions[]` array with all available policy versions
- - `.declaration.http.policies[].versions[].tag` the policy version's tag name
- - `.declaration.http.policies[].versions[].displayName` the policy version's display name
- - `.declaration.http.policies[].versions[].description` the policy version's description
- - `.declaration.http.policies[].versions[].contents` this can be either base64-encoded or be a HTTP(S) URL that will be fetched dynamically from a source of truth
- - `.declaration.http.log_profiles[]` an optional array of WAF log profiles
- - `.declaration.http.log_profiles[].type` the log profile type ('app-protect')
- - `.declaration.http.log_profiles[].app_protect` F5 WAF for NGINX log profile configuration
- - `.declaration.layer4` NGINX TCP/UDP definitions
- - `.declaration.resolvers` DNS resolvers definitions
- - `.declaration.certificates` an optional array of TLS certificates/keys/chains to be published
- - `.declaration.certificates[].type` the item type ('certificate', 'key', 'chain')
- - `.declaration.certificates[].name` the certificate/key/chain name with no path/extension (ie. 'test-application')
- - `.declaration.certificates[].contents` the content: this can be either base64-encoded or be a HTTP(S) URL that will be fetched dynamically from a source of truth
- - `.declaration.authentication` Client and server authentication profiles definitions
- - `.declaration.authorization` Client authorization profiles definitions
-
-### API endpoints
-
-- `GET /v5.7/schema` - Get Declarative API JSON schema
-- `POST /v5.7/config` - Publish a new declaration
-- `PATCH /v5.7/config/{config_uid}` - Update an existing declaration
- - Per-HTTP server CRUD
- - Per-HTTP upstream CRUD
- - Per-Stream server CRUD
- - Per-Stream upstream CRUD
- - Per-WAF policy CRUD
-- `GET /v5.7/config/{configUid}/submission/{submissionUid}` - Retrieve a submission (asynchronous `PATCH` request) status
-- `GET /v5.7/config/{config_uid}` - Retrieve an existing declaration
-- `DELETE /v5.7/config/{config_uid}` - Delete an existing declaration
+# NGINX Declarative API v5.7 Usage Guide
+
+API **v5.7** targets:
+
+- [F5 NGINX Instance Manager](https://docs.f5.com/nginx-instance-manager/) `2.22+`
+- [F5 NGINX One Console](https://docs.f5.com/nginx-one-console/)
+- [F5 NGINX Plus](https://docs.f5.com/nginx/) `R37+`
+- [F5 WAF for NGINX](https://docs.f5.com/waf/) with precompiled [policy bundles](https://docs.f5.com/nginx-app-protect-waf/configure/compiler/)
+
+The full JSON Schema is served live at `GET /v5.7/schema` (and `/docs` for Swagger UI). Ready-to-run API Gateway, WAF, and GitOps examples are available in the [Postman collection](/contrib/postman).
+
+## Table of Contents
+
+- [REST API Endpoints](#rest-api-endpoints)
+- [Declaration Schema Reference](#declaration-schema-reference)
+ - [Top-Level Output Settings](#top-level-output-settings)
+ - [NGINX Plus Licensing](#nginx-plus-licensing)
+ - [NGINX Instance Manager Output](#nginx-instance-manager-output)
+ - [NGINX One Console Output](#nginx-one-console-output)
+ - [Declaration Sections](#declaration-sections)
+ - [F5 WAF for NGINX Policies and Log Profiles](#f5-waf-for-nginx-policies-and-log-profiles)
+ - [TLS Certificates and Keys](#tls-certificates-and-keys)
+ - [API Gateway Locations](#api-gateway-locations)
+- [Quickstart Examples](#quickstart-examples)
+
+---
+
+## REST API Endpoints
+
+| Method | Endpoint | Purpose | Notes |
+| --- | --- | --- | --- |
+| `GET` | `/v5.7/schema` | Retrieve the v5.7 JSON Schema | Generated from `ConfigDeclaration` Pydantic models |
+| `POST` | `/v5.7/config` | Create and publish a new declaration | Returns a generated `configUid` and deployment outcome |
+| `PATCH` | `/v5.7/config/{configuid}` | Update an existing declaration incrementally | Supports per-item CRUD for HTTP servers, HTTP upstreams, Stream servers, Stream upstreams, WAF policies, and TLS certificates/keys. Set `.output.synchronous: false` to enqueue updates (`HTTP 202`) |
+| `GET` | `/v5.7/config/{configuid}` | Retrieve an existing stored declaration | Returns the current active declaration JSON |
+| `GET` | `/v5.7/config/{configuid}/status` | Retrieve the deployment status of a declaration | Returns latest publish status stored in Redis |
+| `GET` | `/v5.7/config/{configuid}/submission/{submissionuid}` | Poll an asynchronous `PATCH` submission status | Cleans up the completed Redis submission entry once processed details are returned |
+| `DELETE` | `/v5.7/config/{configuid}` | Delete an existing declaration | Stops associated autosync jobs and removes stored state |
+
+---
+
+## Declaration Schema Reference
+
+Every declaration contains two root objects: `.output` (control plane target, sync mode, licensing) and `.declaration` (NGINX Plus configuration model).
+
+### Top-Level Output Settings
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `.output.type` | `string` | *(required)* | Target control plane: `"nms"` (NGINX Instance Manager) or `"nginxone"` (NGINX One Console) |
+| `.output.synchronous` | `boolean` | `true` | Applies to `PATCH` requests. When `true`, waits for the control plane deployment response; when `false`, enqueues the update in Redis and returns `HTTP 202` with a `submissionUid` |
+| `.output.license` | `object` | `null` | NGINX Plus license reporting configuration |
+| `.output.nms` | `object` | `null` | Required when `.output.type` is `"nms"` |
+| `.output.nginxone` | `object` | `null` | Required when `.output.type` is `"nginxone"` |
+
+### NGINX Plus Licensing
+
+Configuration under `.output.license`:
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `.output.license.endpoint` | `string` | `"product.connect.nginx.com"` | Usage reporting endpoint (can point to NGINX Instance Manager FQDN/IP) |
+| `.output.license.token` | `string` | `""` | JWT license token. When omitted, an existing `/etc/nginx/license.jwt` on the instance is preserved untouched |
+| `.output.license.ssl_verify` | `boolean` | `true` | Set to `false` to skip TLS verification when reporting without a local PKI (not recommended for production) |
+| `.output.license.grace_period` | `boolean` | `false` | Set to `true` to enable the 180-day usage reporting grace period |
+| `.output.license.proxy` | `string` | `""` | Optional explicit forward proxy (`IP:port` or `FQDN:port`) for license reporting |
+| `.output.license.proxy_username` | `string` | `""` | Optional forward proxy authentication username |
+| `.output.license.proxy_password` | `string` | `""` | Optional forward proxy authentication password |
+
+### NGINX Instance Manager Output
+
+Configuration under `.output.nms`:
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `.output.nms.url` | `string` | *(required)* | NGINX Instance Manager base URL |
+| `.output.nms.username` | `string` | `""` | Authentication username |
+| `.output.nms.password` | `string` | `""` | Authentication password |
+| `.output.nms.instancegroup` | `string` | `""` | Target instance group name for staged config deployment |
+| `.output.nms.synctime` | `integer` | `0` | GitOps autosync poll interval in seconds. When `> 0`, external HTTP(S) Source of Truth references (OpenAPI schemas, WAF policies, TLS certs/keys, snippets, `njs`) are polled and automatically republished on change |
+| `.output.nms.modules` | `string[]` | `[]` | Dynamic NGINX modules to load (e.g., `"ngx_http_app_protect_module"`, `"ngx_http_js_module"`, `"ngx_stream_js_module"`). Note: `ngx_http_js_module` is added automatically if OpenAPI request body schema enforcement generates `njs` validators |
+
+### NGINX One Console Output
+
+Configuration under `.output.nginxone`:
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `.output.nginxone.url` | `string` | *(required)* | NGINX One Console base URL |
+| `.output.nginxone.namespace` | `string` | `""` | Target NGINX One namespace |
+| `.output.nginxone.token` | `string` | `""` | API authentication token |
+| `.output.nginxone.configsyncgroup` | `string` | `""` | Target config sync group name |
+| `.output.nginxone.synctime` | `integer` | `0` | GitOps autosync poll interval in seconds for external HTTP(S) Source of Truth references |
+| `.output.nginxone.modules` | `string[]` | `[]` | Dynamic NGINX modules to load (`ngx_http_js_module` is added automatically when OpenAPI body validators are generated) |
+
+### Declaration Sections
+
+Top-level keys under `.declaration`:
+
+| Field | Type | Description |
+| --- | --- | --- |
+| `.declaration.http` | `object` | HTTP servers, locations, API Gateways, upstreams, maps, caches, log formats, `njs` hooks/profiles, ACME issuers, WAF policies, and WAF log profiles |
+| `.declaration.layer4` | `object` | TCP/UDP (`stream`) servers and upstreams |
+| `.declaration.resolvers[]` | `object[]` | DNS resolver profiles referenced by HTTP servers/upstreams or Layer 4 upstreams |
+| `.declaration.certificates[]` | `object[]` | TLS certificates and private keys |
+| `.declaration.authentication` | `object` | Client (`.client[]`: JWT, mTLS, OIDC) and upstream/Source-of-Truth (`.server[]`: Bearer, Basic, header, mTLS) authentication profiles |
+| `.declaration.authorization[]` | `object[]` | JWT claims client authorization profiles |
+
+> For detailed profile JSON schemas and feature availability across `v5.5`–`v5.7`, see [FEATURES.md](/FEATURES.md).
+
+### F5 WAF for NGINX Policies and Log Profiles
+
+Configured under `.declaration.http.policies[]` and `.declaration.http.log_profiles[]`:
+
+| Field | Type | Default / Allowed | Description |
+| --- | --- | --- | --- |
+| `.policies[].type` | `string` | `"app_protect"` | Policy engine type |
+| `.policies[].name` | `string` | `""` | Policy name (must match the policy name inside the WAF policy JSON file) |
+| `.policies[].active_tag` | `string` | `""` | Version tag to activate (e.g., `"v1"`) |
+| `.policies[].versions[]` | `object[]` | `[]` | Available policy versions (`tag`, `displayName`, `description`, `contents` as base64 or HTTP(S) URL) |
+| `.log_profiles[].type` | `string` | `"app_protect"` | WAF log profile type |
+| `.log_profiles[].app_protect` | `object` | `null` | F5 WAF security log settings (`name`, `format`: `"default" \| "grpc" \| "arcsight" \| "splunk" \| "user-defined"`, `type`: `"all" \| "illegal" \| "blocked"`, `format_string`, size limits) |
+
+### TLS Certificates and Keys
+
+Configured under `.declaration.certificates[]`:
+
+| Field | Type | Allowed | Description |
+| --- | --- | --- | --- |
+| `.certificates[].type` | `string` | `"certificate"`, `"key"` | Asset type |
+| `.certificates[].name` | `string` | *(required)* | Asset name without directory path or extension (e.g., `"test-application"`) |
+| `.certificates[].contents` | `object` | `null` | Source of Truth reference (`content` as base64 or HTTP(S) URL, with optional authentication) |
+
+### API Gateway Locations
+
+Configured under `.declaration.http.servers[].locations[].apigateway`:
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `.openapi_schema` | `object` | `null` | Base64-encoded OpenAPI/Swagger specification or remote HTTP(S) URL (YAML or JSON; OAS `2.0`, `3.0.x`, `3.1.x`, `3.2.x`) |
+| `.api_gateway.enabled` | `boolean` | `false` | Enables API Gateway provisioning for the location |
+| `.api_gateway.strip_uri` | `boolean` | `false` | Strips the location `uri` prefix before forwarding upstream |
+| `.api_gateway.server_url` | `string` | `""` | Base destination URL of the upstream server (fallback when OpenAPI `servers` are absent or overridden) |
+| `.api_gateway.enforce_methods` | `boolean` | `true` | Restricts requests to documented HTTP methods |
+| `.api_gateway.enforce_bodies` | `boolean` | `true` | Enforces required request bodies, `Content-Type`, and OpenAPI/JSON Schema payload structure (via auto-generated `njs` validators) |
+| `.api_gateway.enforce_parameters` | `boolean` | `true` | Enforces required query parameters, header parameters, and allowed `enum` values |
+| `.api_gateway.enforce_response_codes` | `boolean` | `true` | Intercepts undocumented upstream HTTP status codes |
+| `.authentication` / `.authorization` / `.cache` / `.rate_limit` | `object` / `array` | — | Path-scoped policies controlled with `enforceOnPaths` and `paths` |
+| `.developer_portal` / `.visibility` | `object` / `array` | — | Redocly/Backstage developer portal and Moesif visibility integrations |
+
+---
+
+## Quickstart Examples
+
+
+Example: POST /v5.7/config publishing an OpenAPI-driven API Gateway with GitOps autosync
+
+```json
+{
+ "output": {
+ "type": "nms",
+ "nms": {
+ "url": "https://nim.example.com",
+ "username": "admin",
+ "password": "",
+ "instancegroup": "prod-apigw",
+ "synctime": 60
+ }
+ },
+ "declaration": {
+ "http": {
+ "servers": [
+ {
+ "name": "petstore_gw",
+ "names": ["api.example.com"],
+ "locations": [
+ {
+ "uri": "/v1",
+ "apigateway": {
+ "openapi_schema": {
+ "content": "https://gitops.example.com/specs/petstore-openapi.yaml"
+ },
+ "api_gateway": {
+ "enabled": true,
+ "strip_uri": true,
+ "enforce_methods": true,
+ "enforce_bodies": true,
+ "enforce_parameters": true,
+ "enforce_response_codes": true
+ }
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
+```
+
+
+
+
+Example: Asynchronous PATCH /v5.7/config/{configuid} adding/updating an HTTP upstream
+
+```json
+{
+ "output": {
+ "type": "nms",
+ "synchronous": false,
+ "nms": {
+ "url": "https://nim.example.com",
+ "username": "admin",
+ "password": "",
+ "instancegroup": "prod-apigw"
+ }
+ },
+ "declaration": {
+ "http": {
+ "upstreams": [
+ {
+ "name": "backend_pool",
+ "origin": [
+ { "server": "10.0.1.10:8080" },
+ { "server": "10.0.1.11:8080" }
+ ]
+ }
+ ]
+ }
+ }
+}
+```
+
+Poll completion via `GET /v5.7/config/{configuid}/submission/{submissionuid}` using the `submissionUid` returned in the `HTTP 202` payload.
+
+
diff --git a/contrib/helm/nginx-declarative-api/README.md b/contrib/helm/nginx-declarative-api/README.md
index 3859577d..cf8e0844 100644
--- a/contrib/helm/nginx-declarative-api/README.md
+++ b/contrib/helm/nginx-declarative-api/README.md
@@ -8,7 +8,7 @@ NGINX Declarative API is a declarative REST API and GitOps automation layer for
- Kubernetes 1.23+
- Helm 3.10+
-- A running [F5 NGINX Instance Manager](https://docs.nginx.com/nginx-instance-manager/) or [F5 NGINX One Console](https://docs.nginx.com/nginx-one/) reachable from the cluster
+- A running [F5 NGINX Instance Manager](https://docs.f5.com/nginx-instance-manager/) or [F5 NGINX One Console](https://docs.f5.com/nginx-one-console/) reachable from the cluster
## Installing the chart
@@ -425,5 +425,5 @@ service/nginx-dapi-nginx-declarative-api-webui ClusterIP 80/TCP
- [API usage guide v5.7](https://github.com/f5devcentral/NGINX-Declarative-API/blob/v5.7/USAGE-v5.7.md)
- [Docker Compose deployment](https://github.com/f5devcentral/NGINX-Declarative-API/tree/v5.7/contrib/docker-compose)
- [Postman collection](https://github.com/f5devcentral/NGINX-Declarative-API/tree/v5.7/contrib/postman)
-- [F5 NGINX Instance Manager docs](https://docs.nginx.com/nginx-instance-manager/)
-- [F5 NGINX One Console docs](https://docs.nginx.com/nginx-one/)
+- [F5 NGINX Instance Manager docs](https://docs.f5.com/nginx-instance-manager/)
+- [F5 NGINX One Console docs](https://docs.f5.com/nginx-one-console/)
diff --git a/contrib/kubernetes/README.md b/contrib/kubernetes/README.md
index 87cdcdc3..6396919b 100644
--- a/contrib/kubernetes/README.md
+++ b/contrib/kubernetes/README.md
@@ -1,74 +1,146 @@
# Running NGINX Declarative API on Kubernetes
-NGINX Declarative API can be deployed on Kubernetes using the manifest provided
+NGINX Declarative API can be deployed on Kubernetes using the plain manifests in this directory (`nginx-declarative-api.yaml`).
-## How to deploy
+> **Looking for configurable production options** (custom `values.yaml`, autoscaling, persistence, TLS, NetworkPolicies, or per-component toggles)? Use the [Helm chart](/contrib/helm/nginx-declarative-api) instead.
-1. Build the NGINX Declarative API docker images using the [Docker-compose script](/contrib/docker-compose)
+## Deployed Components
-2. Tag and push the docker images to a private registry
+`nginx-declarative-api.yaml` creates the `nginx-dapi` namespace and deploys:
- ```shell
- docker tag nginx-declarative-api:latest YOUR_REGISTRY_HERE/nginx-declarative-api:latest
- docker push YOUR_REGISTRY_HERE/nginx-declarative-api:latest
+| Component | Service | Port | Image | Purpose |
+| --- | --- | --- | --- | --- |
+| **nginx-dapi** | `nginx-dapi` | `5000` | `ghcr.io/f5devcentral/nginx-declarative-api:latest` | Core Declarative REST API service |
+| **devportal** | `devportal` | `5000` | `ghcr.io/f5devcentral/nginx-declarative-api-devportal:latest` | Redocly Developer Portal generator |
+| **webui** | `webui` | `80` → `8080` | `ghcr.io/f5devcentral/nginx-declarative-api-webui:latest` | Browser-based Web UI (`nginx-unprivileged` on port `8080`) |
+| **mcp** | `mcp` | `8800` | `ghcr.io/f5devcentral/nginx-declarative-api-mcp:latest` | Model Context Protocol (MCP) server (`streamable-http` on `/mcp`) |
+| **redis** | `redis` | `6379` | `redis:8.10` | Declaration state, GitOps sync metadata, and async queue |
- docker tag nginx-declarative-api-devportal:latest YOUR_REGISTRY_HERE/nginx-declarative-api-devportal:latest
- docker push YOUR_REGISTRY_HERE/nginx-declarative-api-devportal:latest
- ```
+## Prerequisites
-3. Edit `nginx-declarative-api.yaml` and update the following lines to match the docker images and to set the `Ingress` host DNS name
+- Kubernetes 1.23+
+- An Ingress controller matching `ingressClassName: nginx` (or update `spec.ingressClassName` in `nginx-declarative-api.yaml`), **or** a Kubernetes Gateway API `v1` controller (such as F5 NGINX Gateway Fabric) if enabling the commented-out `Gateway` + `HTTPRoute` option
+- Connectivity from the cluster to [F5 NGINX Instance Manager](https://docs.f5.com/nginx-instance-manager/) or [F5 NGINX One Console](https://docs.f5.com/nginx-one-console/)
- ```shell
- image: YOUR_REGISTRY_HERE/nginx-declarative-api:latest
- image: YOUR_REGISTRY_HERE/nginx-declarative-api-devportal:latest
- image: YOUR_REGISTRY_HERE/nginx-declarative-api-webui:latest
+## How to Deploy
+
+### Option A: Use pre-built GitHub Container Registry images (recommended)
+
+1. Edit `nginx-declarative-api.yaml` and update the `Ingress` hostnames to match your DNS environment:
+
+ ```yaml
+ rules:
+ - host: nginx-dapi.k8s.example.com
+ - host: nginx-dapi-webui.k8s.example.com
+ - host: nginx-dapi-mcp.k8s.example.com
```
+ > **Tip:** To pin release `5.7.2` explicitly instead of `:latest`, replace the `:latest` tags on the four `ghcr.io/f5devcentral/nginx-declarative-api*` images (or configure `NDAPI_VERSION` / `NDAPI_API_KEY` on the `mcp` Deployment if authentication is enabled).
+
+2. Apply the manifest:
+
```shell
- - host: nginx-dapi.k8s.f5.ff.lan
- - host: nginx-dapi-webui.k8s.f5.ff.lan
+ kubectl apply -f nginx-declarative-api.yaml
```
-4. Apply the manifest
+ Expected output:
- ```shell
- $ kubectl apply -f nginx-declarative-api.yaml
+ ```text
namespace/nginx-dapi created
deployment.apps/redis created
- deployment.apps/nginx-dapi created
- deployment.apps/devportal created
- deployment.apps/webui created
service/redis created
+ deployment.apps/nginx-dapi created
service/nginx-dapi created
+ deployment.apps/devportal created
service/devportal created
+ deployment.apps/webui created
service/webui created
+ deployment.apps/mcp created
+ service/mcp created
ingress.networking.k8s.io/nginx-dapi created
```
-5. Make sure all pods are up and running
+3. Verify all pods and services are running:
+
+ ```shell
+ kubectl get all -n nginx-dapi
+ ```
+
+ Expected output:
+
+ ```text
+ NAME READY STATUS RESTARTS AGE
+ pod/devportal-xxxxxxxxxx-xxxxx 1/1 Running 0 30s
+ pod/mcp-xxxxxxxxxx-xxxxx 1/1 Running 0 30s
+ pod/nginx-dapi-xxxxxxxxxx-xxxxx 1/1 Running 0 30s
+ pod/redis-xxxxxxxxxx-xxxxx 1/1 Running 0 30s
+ pod/webui-xxxxxxxxxx-xxxxx 1/1 Running 0 30s
+ ```
+
+4. Inspect the `Ingress` endpoints:
+
+ ```shell
+ kubectl get ingress -n nginx-dapi
+ ```
+
+ - **REST API & Swagger docs:** `http://nginx-dapi.k8s.example.com/docs` (plus `/redoc` and `/openapi.json`)
+ - **Web UI:** `http://nginx-dapi-webui.k8s.example.com/`
+ - **MCP Server (Streamable HTTP):** `http://nginx-dapi-mcp.k8s.example.com/mcp` (see [contrib/mcp/README.md](/contrib/mcp/README.md) for client setup)
+
+### Option B: Build and push custom images to a private registry
+
+1. Build all images locally using the [Docker Compose helper script](/contrib/docker-compose):
```shell
- $ kubectl get all -n nginx-dapi
- NAME READY STATUS RESTARTS AGE
- pod/devportal-74fc5c9ccb-5wjpr 1/1 Running 0 25s
- pod/nginx-dapi-848599b79b-ll2kg 1/1 Running 0 25s
- pod/redis-5cdb78b899-hjz9x 1/1 Running 0 25s
- pod/webui-2edc85a732-jrg8p 1/1 Running 0 25s
+ cd contrib/docker-compose
+ ./nginx-dapi.sh -c build
```
-6. The NGINX Declarative API can be accessed through its `Ingress` resource
+2. Tag and push the four built images to your registry:
```shell
- $ kubectl get ingress -n nginx-dapi
- NAME CLASS HOSTS ADDRESS PORTS AGE
- nginx-dapi nginx nginx-dapi.k8s.f5.ff.lan 80 34s
- nginx-dapi nginx nginx-dapi-webui.k8s.f5.ff.lan 80 34s
+ for img in \
+ nginx-declarative-api \
+ nginx-declarative-api-devportal \
+ nginx-declarative-api-webui \
+ nginx-declarative-api-mcp
+ do
+ docker tag ghcr.io/f5devcentral/${img}:latest YOUR_REGISTRY_HERE/${img}:latest
+ docker push YOUR_REGISTRY_HERE/${img}:latest
+ done
```
-## How to undeploy
+3. Replace the `ghcr.io/f5devcentral/...` image references in `nginx-declarative-api.yaml` with `YOUR_REGISTRY_HERE/...` and apply the manifest as shown in Option A.
+
+## Publishing via Kubernetes Gateway API (`Gateway` & `HTTPRoute`)
+
+`nginx-declarative-api.yaml` includes a commented-out **Kubernetes Gateway API (`gateway.networking.k8s.io/v1`)** configuration at the bottom of the file as an alternative to `Ingress` (for controllers such as F5 NGINX Gateway Fabric):
+
+| Resource | Kind | Hostname (`spec.hostnames`) | Target Service & Port |
+| --- | --- | --- | --- |
+| `nginx-dapi-gateway` | `Gateway` | HTTP listener on port `80` (`gatewayClassName: nginx`) | Accepts routes from the `nginx-dapi` namespace |
+| `nginx-dapi` | `HTTPRoute` | `nginx-dapi.k8s.example.com` | `nginx-dapi:5000` (`PathPrefix /`) |
+| `webui` | `HTTPRoute` | `nginx-dapi-webui.k8s.example.com` | `webui:80` (`PathPrefix /`) |
+| `mcp` | `HTTPRoute` | `nginx-dapi-mcp.k8s.example.com` | `mcp:8800` (`PathPrefix /`) |
+
+To switch from `Ingress` to `Gateway` and `HTTPRoute`:
-1. Delete the `nginx-declarative-api.yaml` manifest
+1. **Ensure Gateway API CRDs and a controller are installed** in your cluster (e.g., F5 NGINX Gateway Fabric with a `GatewayClass` named `nginx`, or update `gatewayClassName` to match your controller's `GatewayClass`).
+2. **Comment out or remove the `Ingress` resource** in `nginx-declarative-api.yaml` to avoid duplicate hostname/routing conflicts.
+3. **Uncomment the `Gateway` and `HTTPRoute` manifests** at the bottom of `nginx-declarative-api.yaml` and update `hostnames` for your DNS domain.
+4. **Apply and verify** the Gateway API resources:
```shell
- kubectl delete -f nginx-declarative-api.yaml
+ kubectl apply -f nginx-declarative-api.yaml
+ kubectl get gateway,httproute -n nginx-dapi
```
+
+ Verify that `gateway/nginx-dapi-gateway` reports `PROGRAMMED: True` with an external address assigned, and all three `HTTPRoute` resources are accepted by the `http` listener.
+
+## How to Undeploy
+
+Delete the resources created by `nginx-declarative-api.yaml`:
+
+```shell
+kubectl delete -f nginx-declarative-api.yaml
+```
diff --git a/contrib/kubernetes/nginx-declarative-api.yaml b/contrib/kubernetes/nginx-declarative-api.yaml
index 4223e991..a2c4f3e0 100644
--- a/contrib/kubernetes/nginx-declarative-api.yaml
+++ b/contrib/kubernetes/nginx-declarative-api.yaml
@@ -21,12 +21,74 @@ spec:
labels:
app: redis
spec:
+ securityContext:
+ runAsNonRoot: true
+ runAsUser: 999
+ fsGroup: 999
containers:
- name: redis
- image: redis
+ image: redis:8.10
+ imagePullPolicy: IfNotPresent
+ args:
+ - redis-server
+ - "--save"
+ - ""
+ - "--appendonly"
+ - "no"
ports:
- name: redis
containerPort: 6379
+ protocol: TCP
+ livenessProbe:
+ exec:
+ command:
+ - redis-cli
+ - ping
+ initialDelaySeconds: 10
+ periodSeconds: 15
+ failureThreshold: 3
+ timeoutSeconds: 3
+ readinessProbe:
+ exec:
+ command:
+ - redis-cli
+ - ping
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ failureThreshold: 3
+ timeoutSeconds: 3
+ resources:
+ requests:
+ cpu: 50m
+ memory: 64Mi
+ limits:
+ cpu: 200m
+ memory: 256Mi
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: true
+ capabilities:
+ drop:
+ - ALL
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ # Fixed name "redis" — etc/config.yaml connects to hostname "redis" by default
+ name: redis
+ namespace: nginx-dapi
+ labels:
+ app: redis
+spec:
+ ports:
+ - name: redis
+ port: 6379
+ targetPort: redis
+ protocol: TCP
+ selector:
+ app: redis
+ type: ClusterIP
---
apiVersion: apps/v1
@@ -48,10 +110,58 @@ spec:
spec:
containers:
- name: nginx-dapi
- image: YOUR_REGISTRY_HERE/nginx-declarative-api:latest
+ image: ghcr.io/f5devcentral/nginx-declarative-api:latest
+ imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 5000
+ protocol: TCP
+ livenessProbe:
+ httpGet:
+ path: /docs
+ port: http
+ initialDelaySeconds: 15
+ periodSeconds: 20
+ failureThreshold: 3
+ timeoutSeconds: 5
+ readinessProbe:
+ httpGet:
+ path: /docs
+ port: http
+ initialDelaySeconds: 10
+ periodSeconds: 10
+ failureThreshold: 3
+ timeoutSeconds: 5
+ resources:
+ requests:
+ cpu: 100m
+ memory: 128Mi
+ limits:
+ cpu: 500m
+ memory: 512Mi
+ securityContext:
+ allowPrivilegeEscalation: false
+ capabilities:
+ drop:
+ - ALL
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: nginx-dapi
+ namespace: nginx-dapi
+ labels:
+ app: nginx-dapi
+spec:
+ ports:
+ - name: http
+ port: 5000
+ targetPort: http
+ protocol: TCP
+ selector:
+ app: nginx-dapi
+ type: ClusterIP
---
apiVersion: apps/v1
@@ -73,101 +183,236 @@ spec:
spec:
containers:
- name: devportal
- image: YOUR_REGISTRY_HERE/nginx-declarative-api-devportal:latest
+ image: ghcr.io/f5devcentral/nginx-declarative-api-devportal:latest
+ imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 5000
+ protocol: TCP
+ livenessProbe:
+ tcpSocket:
+ port: http
+ initialDelaySeconds: 20
+ periodSeconds: 20
+ failureThreshold: 3
+ timeoutSeconds: 5
+ readinessProbe:
+ tcpSocket:
+ port: http
+ initialDelaySeconds: 15
+ periodSeconds: 10
+ failureThreshold: 3
+ timeoutSeconds: 5
+ resources:
+ requests:
+ cpu: 50m
+ memory: 64Mi
+ limits:
+ cpu: 200m
+ memory: 256Mi
+ securityContext:
+ allowPrivilegeEscalation: false
+ capabilities:
+ drop:
+ - ALL
---
apiVersion: v1
kind: Service
metadata:
- name: redis
+ # Fixed name "devportal" — etc/config.yaml connects to hostname "devportal" by default
+ name: devportal
namespace: nginx-dapi
labels:
- app: redis
+ app: devportal
spec:
ports:
- - name: redis
- port: 6379
+ - name: http
+ port: 5000
+ targetPort: http
+ protocol: TCP
selector:
- app: redis
+ app: devportal
type: ClusterIP
---
-apiVersion: v1
-kind: Service
+apiVersion: apps/v1
+kind: Deployment
metadata:
- name: nginx-dapi
+ name: webui
namespace: nginx-dapi
labels:
- app: nginx-dapi
+ app: webui
spec:
- ports:
- - name: http
- port: 5000
selector:
- app: nginx-dapi
- type: ClusterIP
+ matchLabels:
+ app: webui
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ app: webui
+ spec:
+ securityContext:
+ runAsNonRoot: true
+ # uid 101 matches nginx user in nginxinc/nginx-unprivileged
+ runAsUser: 101
+ fsGroup: 101
+ containers:
+ - name: webui
+ image: ghcr.io/f5devcentral/nginx-declarative-api-webui:latest
+ imagePullPolicy: IfNotPresent
+ ports:
+ - name: http
+ # nginx-unprivileged listens on 8080 by default
+ containerPort: 8080
+ protocol: TCP
+ env:
+ - name: DAPI_PORT
+ value: "5000"
+ livenessProbe:
+ httpGet:
+ path: /
+ port: http
+ initialDelaySeconds: 10
+ periodSeconds: 20
+ failureThreshold: 3
+ timeoutSeconds: 5
+ readinessProbe:
+ httpGet:
+ path: /
+ port: http
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ failureThreshold: 3
+ timeoutSeconds: 5
+ resources:
+ requests:
+ cpu: 50m
+ memory: 64Mi
+ limits:
+ cpu: 200m
+ memory: 128Mi
+ securityContext:
+ allowPrivilegeEscalation: false
+ capabilities:
+ drop:
+ - ALL
+ volumeMounts:
+ - name: nginx-cache
+ mountPath: /var/cache/nginx
+ - name: nginx-run
+ mountPath: /var/run
+ volumes:
+ - name: nginx-cache
+ emptyDir: {}
+ - name: nginx-run
+ emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
- name: devportal
+ name: webui
namespace: nginx-dapi
labels:
- app: devportal
+ app: webui
spec:
ports:
- name: http
- port: 5000
+ port: 80
+ targetPort: http
+ protocol: TCP
selector:
- app: devportal
+ app: webui
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
- name: webui
+ name: mcp
namespace: nginx-dapi
labels:
- app: webui
+ app: mcp
spec:
selector:
matchLabels:
- app: webui
+ app: mcp
replicas: 1
template:
metadata:
labels:
- app: webui
+ app: mcp
spec:
containers:
- - name: webui
- image: YOUR_REGISTRY_HERE/nginx-declarative-api-webui:latest
+ - name: mcp
+ image: ghcr.io/f5devcentral/nginx-declarative-api-mcp:latest
+ imagePullPolicy: IfNotPresent
ports:
- name: http
- containerPort: 80
+ containerPort: 8800
+ protocol: TCP
env:
+ - name: NDAPI_BASE_URL
+ value: "http://nginx-dapi:5000"
+ - name: NDAPI_VERSION
+ value: "v5.7"
+ - name: NDAPI_AUTH_MODE
+ value: "none"
+ - name: NDAPI_VERIFY_TLS
+ value: "true"
+ - name: MCP_TRANSPORT
+ value: "streamable-http"
+ - name: MCP_HTTP_HOST
+ value: "0.0.0.0"
+ - name: MCP_HTTP_PORT
+ value: "8800"
- name: DAPI_PORT
value: "5000"
+ livenessProbe:
+ tcpSocket:
+ port: http
+ initialDelaySeconds: 15
+ periodSeconds: 20
+ failureThreshold: 3
+ timeoutSeconds: 5
+ readinessProbe:
+ tcpSocket:
+ port: http
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ failureThreshold: 3
+ timeoutSeconds: 5
+ resources:
+ requests:
+ cpu: 50m
+ memory: 64Mi
+ limits:
+ cpu: 200m
+ memory: 256Mi
+ securityContext:
+ allowPrivilegeEscalation: false
+ capabilities:
+ drop:
+ - ALL
---
apiVersion: v1
kind: Service
metadata:
- name: webui
+ name: mcp
namespace: nginx-dapi
labels:
- app: webui
+ app: mcp
spec:
ports:
- name: http
- port: 80
+ port: 8800
+ targetPort: http
+ protocol: TCP
selector:
- app: webui
+ app: mcp
type: ClusterIP
---
@@ -181,7 +426,7 @@ metadata:
spec:
ingressClassName: nginx
rules:
- - host: nginx-dapi.k8s.f5.ff.lan
+ - host: nginx-dapi.k8s.example.com
http:
paths:
- path: /
@@ -191,7 +436,7 @@ spec:
name: nginx-dapi
port:
number: 5000
- - host: nginx-dapi-webui.k8s.f5.ff.lan
+ - host: nginx-dapi-webui.k8s.example.com
http:
paths:
- path: /
@@ -201,3 +446,109 @@ spec:
name: webui
port:
number: 80
+ - host: nginx-dapi-mcp.k8s.example.com
+ http:
+ paths:
+ - path: /
+ pathType: Prefix
+ backend:
+ service:
+ name: mcp
+ port:
+ number: 8800
+
+# ==============================================================================
+# Optional: Kubernetes Gateway API (gateway.networking.k8s.io/v1)
+# ------------------------------------------------------------------------------
+# To expose the services via a Gateway API controller (for example, F5 NGINX
+# Gateway Fabric) instead of the Ingress resource above:
+# 1. Remove or comment out the Ingress resource above.
+# 2. Uncomment the Gateway and HTTPRoute manifests below.
+# 3. Adjust gatewayClassName (default: nginx) and hostnames for your cluster.
+# ==============================================================================
+# ---
+# apiVersion: gateway.networking.k8s.io/v1
+# kind: Gateway
+# metadata:
+# name: nginx-dapi-gateway
+# namespace: nginx-dapi
+# labels:
+# app: nginx-dapi
+# spec:
+# gatewayClassName: nginx
+# listeners:
+# - name: http
+# protocol: HTTP
+# port: 80
+# allowedRoutes:
+# namespaces:
+# from: Same
+#
+# ---
+# apiVersion: gateway.networking.k8s.io/v1
+# kind: HTTPRoute
+# metadata:
+# name: nginx-dapi
+# namespace: nginx-dapi
+# labels:
+# app: nginx-dapi
+# spec:
+# parentRefs:
+# - name: nginx-dapi-gateway
+# sectionName: http
+# hostnames:
+# - "nginx-dapi.k8s.example.com"
+# rules:
+# - matches:
+# - path:
+# type: PathPrefix
+# value: /
+# backendRefs:
+# - name: nginx-dapi
+# port: 5000
+#
+# ---
+# apiVersion: gateway.networking.k8s.io/v1
+# kind: HTTPRoute
+# metadata:
+# name: webui
+# namespace: nginx-dapi
+# labels:
+# app: webui
+# spec:
+# parentRefs:
+# - name: nginx-dapi-gateway
+# sectionName: http
+# hostnames:
+# - "nginx-dapi-webui.k8s.example.com"
+# rules:
+# - matches:
+# - path:
+# type: PathPrefix
+# value: /
+# backendRefs:
+# - name: webui
+# port: 80
+#
+# ---
+# apiVersion: gateway.networking.k8s.io/v1
+# kind: HTTPRoute
+# metadata:
+# name: mcp
+# namespace: nginx-dapi
+# labels:
+# app: mcp
+# spec:
+# parentRefs:
+# - name: nginx-dapi-gateway
+# sectionName: http
+# hostnames:
+# - "nginx-dapi-mcp.k8s.example.com"
+# rules:
+# - matches:
+# - path:
+# type: PathPrefix
+# value: /
+# backendRefs:
+# - name: mcp
+# port: 8800
diff --git a/contrib/mcp/README.md b/contrib/mcp/README.md
index 75a3794d..b125ae84 100644
--- a/contrib/mcp/README.md
+++ b/contrib/mcp/README.md
@@ -1,151 +1,171 @@
-# NGINX Declarative API — MCP Server (contrib)
+# NGINX Declarative API — MCP Server
+
+This module provides a **Model Context Protocol (MCP) server** that enables LLMs and AI coding assistants (Claude Desktop, Claude Code, Google Antigravity, Gemini CLI, or any MCP-compatible client) to manage the [NGINX Declarative API](https://github.com/f5devcentral/NGINX-Declarative-API) using natural language instead of hand-authoring JSON declarations and REST requests.
+
+It is a thin, stateless MCP bridge that sits in front of an already-running NGINX Declarative API instance and communicates with it over HTTP/JSON:
+
+```mermaid
+flowchart LR
+ subgraph Clients["MCP Clients"]
+ CD["Claude Desktop / Claude Code"]
+ AGY["Antigravity / Gemini CLI"]
+ OTHER["Other MCP Clients"]
+ end
+
+ subgraph MCP["MCP Server (contrib/mcp)"]
+ TR["Transport Layer (stdio or Streamable HTTP)"]
+ TOOLS["Curated Lifecycle Tools & call_declarative_api"]
+ SCHEMA["Live OpenAPI Schema Cache & Prompt Primer"]
+ TR --> TOOLS --> SCHEMA
+ end
+
+ subgraph Core["NGINX Control Stack"]
+ NDAPI["NGINX Declarative API (v5.7)"]
+ NIM["NGINX Instance Manager"]
+ N1["NGINX One Console"]
+ NGINX["NGINX Plus Data Plane"]
+
+ NDAPI -->|"REST (HTTP/JSON)"| NIM --> NGINX
+ NDAPI -->|"REST (HTTP/JSON)"| N1 --> NGINX
+ end
+
+ CD -->|"MCP"| TR
+ AGY -->|"MCP"| TR
+ OTHER -->|"MCP"| TR
+ TOOLS -->|"REST (HTTP/JSON + Auth)"| NDAPI
+```
-This contrib module implements a **Model Context Protocol (MCP) server** that lets
-an LLM (Claude, or any other MCP-compatible client) drive the
-[NGINX Declarative API](https://github.com/f5devcentral/NGINX-Declarative-API)
-(branch `v5.7`) using natural language, instead of hand-writing JSON declarations
-and calling the REST endpoints directly.
+## Table of Contents
-It does **not** reimplement the Declarative API. It is a thin, stateless MCP
-process that sits in front of an already-running NGINX Declarative API instance and talks to it over HTTP.
+- [Architecture and Design Principles](#architecture-and-design-principles)
+- [Installation and Deployment](#installation-and-deployment)
+ - [Option A: Local Python Process (stdio)](#option-a-local-python-process-stdio)
+ - [Option B: Container Deployment (streamable-http)](#option-b-container-deployment-streamable-http)
+- [Client Configuration](#client-configuration)
+- [Configuration Reference](#configuration-reference)
+- [Exposed MCP Tools and Prompts](#exposed-mcp-tools-and-prompts)
+- [Example Natural-Language Prompts](#example-natural-language-prompts)
+- [MCP SDK Compatibility and Testing](#mcp-sdk-compatibility-and-testing)
+- [Security Notes](#security-notes)
-```
-LLM / MCP Client (Claude Desktop, Claude Code, claude.ai connector, etc.)
- │ MCP (stdio or streamable-HTTP)
- ▼
-contrib/mcp (this module)
- │ REST (HTTP/JSON, api-key or basic auth)
- ▼
-NGINX Declarative API (v5.7) ── publishes to ──▶ NGINX Instance Manager / NGINX One
-```
+---
+
+## Architecture and Design Principles
+
+Rather than hard-coding the full `v5.7` declaration JSON Schema inside the MCP server—which would drift whenever new capabilities are added—this bridge:
-## Why this design
-
-Rather than hard-coding the full v5.7 declaration JSON schema into the server
-(which would drift every time the Declarative API adds a feature), this module:
-
-1. Fetches the **live OpenAPI schema** from the running instance
- (`GET /openapi.json`) and exposes it to the LLM as an MCP resource/tool, so
- the model always grounds itself against the actual deployed version rather
- than a stale copy.
-2. Exposes a small set of **curated, high-level tools** for the common
- declarative-config lifecycle (create, update, retrieve, delete, check async
- submission status, list), which map to the documented `v5.7` REST surface:
- - `POST /v5.7/config`
- - `PATCH /v5.7/config/{configUid}`
- - `GET /v5.7/config/{configUid}`
- - `GET /v5.7/config`
- - `DELETE /v5.7/config/{configUid}`
- - `GET /v5.7/config/{configUid}/submission/{submissionUid}`
-3. Exposes one **generic escape-hatch tool** (`call_declarative_api`) that lets
- the LLM issue an arbitrary method/path/body call for anything not covered by
- the curated tools (new v5.7 features, NGINX App Protect policy endpoints,
- certificate endpoints, developer portal endpoints, etc.), always validated
- against the live schema first.
-
-This means the module keeps working even as the Declarative API evolves across
-`v5.x` releases — only `NDAPI_VERSION` needs to change.
-
-## Installation
-
-### Option A — local (stdio transport, for Claude Desktop / Claude Code)
+1. **Grounds against the live OpenAPI schema (`GET /openapi.json`):** `get_api_schema` fetches and caches the schema directly from your running Declarative API instance so the model always sees the exact fields supported by the target deployment.
+2. **Provides curated lifecycle tools:** High-level tools cover declaration creation (`POST /v5.7/config`), incremental patching (`PATCH /v5.7/config/{configUid}`), inspection (`GET /v5.7/config`, `GET /v5.7/config/{configUid}`), deletion (`DELETE /v5.7/config/{configUid}`), and async submission polling (`GET /v5.7/config/{configUid}/submission/{submissionUid}`).
+3. **Validates locally before submitting:** `validate_declaration_locally` performs fast JSON syntax and required-structure checks before sending requests upstream.
+4. **Includes a schema-aware escape hatch (`call_declarative_api`):** Supports any current or future REST path/method on the configured Declarative API instance (such as WAF policy, certificate, status, or developer portal operations).
+5. **Adapts across `v5.x` releases:** Switch target API versions simply by changing `NDAPI_VERSION`.
+
+---
+
+## Installation and Deployment
+
+### Option A: Local Python Process (`stdio`)
+
+Recommended for local desktop and CLI MCP clients (Claude Desktop, Claude Code, Antigravity, Gemini CLI):
```bash
cd contrib/mcp
-python3 -m venv .venv && source .venv/bin/activate
+python3 -m venv .venv
+source .venv/bin/activate
pip install -r requirements.txt
-cp .env.example .env # edit with your NDAPI endpoint + credentials
+cp .env.example .env # Configure NDAPI_BASE_URL and credentials
python -m nginx_declarative_api_mcp.server
```
-Register it with Claude Desktop by adding the `mcpServers` entry from
-[`examples/claude_desktop_config.stdio.json`](examples/claude_desktop_config.stdio.json)
-to your `claude_desktop_config.json`.
+Register the server by copying the snippet from [`examples/claude_desktop_config.stdio.json`](examples/claude_desktop_config.stdio.json) (or [`examples/antigravity_mcp_config.stdio.json`](examples/antigravity_mcp_config.stdio.json)) into your client configuration.
+
+### Option B: Container Deployment (`streamable-http`)
-### Option B — container (streamable-HTTP transport, shareable over the network)
+Recommended for shared team environments or remote MCP connectors:
-Use [docker compose](/contrib/docker-compose)
+- Deploy alongside the API stack using [`contrib/docker-compose`](/contrib/docker-compose) or build directly with [`Dockerfile`](Dockerfile).
+- By default, the HTTP server listens on `http://:8800/mcp` and accepts connections via the MCP Streamable HTTP transport.
-The server then listens by default on `http://:8800/mcp` and can be added as a remote MCP connector
+---
-## Using it from other MCP clients
+## Client Configuration
-See [`examples/README.md`](examples/README.md) for ready-to-edit config
-snippets and setup notes for both Claude Desktop and Google Antigravity /
-Gemini CLI, covering both stdio and Streamable HTTP transports:
+Ready-to-edit client snippets and setup walkthroughs are maintained in [`examples/README.md`](examples/README.md):
-| | stdio | Streamable HTTP |
-|---|---|---|
-| **Claude Desktop** | `examples/claude_desktop_config.stdio.json` | `examples/claude_desktop_config.http.json` (via `mcp-remote` bridge, or use Settings → Connectors) |
-| **Antigravity / Gemini CLI** | `examples/antigravity_mcp_config.stdio.json` | `examples/antigravity_mcp_config.http.json` (native `serverUrl`) |
+| Client | `stdio` Transport | `streamable-http` Transport |
+| --- | --- | --- |
+| **Claude Desktop / Claude Code** | [`claude_desktop_config.stdio.json`](examples/claude_desktop_config.stdio.json) | [`claude_desktop_config.http.json`](examples/claude_desktop_config.http.json) *(via `mcp-remote` bridge or Connectors)* |
+| **Antigravity / Gemini CLI** | [`antigravity_mcp_config.stdio.json`](examples/antigravity_mcp_config.stdio.json) | [`antigravity_mcp_config.http.json`](examples/antigravity_mcp_config.http.json) *(native `serverUrl`)* |
+---
-## MCP SDK compatibility
+## Configuration Reference
-The `mcp` Python SDK released a breaking `2.0.0` on 2026-07-28: `FastMCP` was
-renamed to `MCPServer` and moved from `mcp.server.fastmcp` to
-`mcp.server.mcpserver` (decorator API — `@mcp.tool()`, `@mcp.prompt()` —
-is unchanged). `server.py` and `tools.py` in this module detect which one is
-installed at import time and use the matching class, so `pip install -r
-requirements.txt` works whether it resolves to the current `2.x` line or an
-older pinned `1.x` environment. No action needed either way.
+All settings are loaded from environment variables (see [`.env.example`](.env.example)):
-## Configuration
+| Variable | Default | Description |
+| --- | --- | --- |
+| `NDAPI_BASE_URL` | `http://localhost:5000` | Base URL of the running NGINX Declarative API instance (no trailing slash) |
+| `NDAPI_VERSION` | `v5.7` | API version path segment (`/v5.7/...`) |
+| `NDAPI_AUTH_MODE` | `none` | Upstream authentication mode: `none`, `basic`, or `apikey` |
+| `NDAPI_USERNAME` / `NDAPI_PASSWORD` | — | Credentials used when `NDAPI_AUTH_MODE=basic` |
+| `NDAPI_API_KEY` | — | Bearer token used when `NDAPI_AUTH_MODE=apikey` (`Authorization: Bearer `) |
+| `NDAPI_TIMEOUT_SECONDS` | `30` | HTTP client request timeout in seconds |
+| `NDAPI_VERIFY_TLS` | `true` | Set to `false` to allow self-signed certificates in lab environments |
+| `MCP_TRANSPORT` | `stdio` | MCP transport mode: `stdio` or `streamable-http` |
+| `MCP_HTTP_HOST` | `0.0.0.0` | Bind address when `MCP_TRANSPORT=streamable-http` |
+| `MCP_HTTP_PORT` | `8800` | Listen port when `MCP_TRANSPORT=streamable-http` |
-All configuration is via environment variables (see `.env.example`):
+---
-| Variable | Default | Description |
-|----------------------------|--------------------------|--------------------------------------------------------------------------|
-| `NDAPI_BASE_URL` | `http://localhost:5000` | Base URL of the running NGINX Declarative API instance |
-| `NDAPI_VERSION` | `v5.7` | API version path segment (`/v5.7/...`) |
-| `NDAPI_AUTH_MODE` | `none` | `none`, `basic`, or `apikey` |
-| `NDAPI_USERNAME` / `NDAPI_PASSWORD` | — | Used when `NDAPI_AUTH_MODE=basic` |
-| `NDAPI_API_KEY` | — | Used when `NDAPI_AUTH_MODE=apikey` (sent as `Authorization: Bearer ...`) |
-| `NDAPI_TIMEOUT_SECONDS` | `30` | HTTP client timeout |
-| `NDAPI_VERIFY_TLS` | `true` | Set to `false` for self-signed lab certs |
-| `MCP_TRANSPORT` | `stdio` | `stdio` or `streamable-http` |
-| `MCP_HTTP_HOST` | `0.0.0.0` | Used when `MCP_TRANSPORT=streamable-http` |
-| `MCP_HTTP_PORT` | `8800` | Used when `MCP_TRANSPORT=streamable-http` |
+## Exposed MCP Tools and Prompts
-## Tools exposed to the LLM
+### Tools
-| Tool | Purpose |
-|--------------------------------|---------------------------------------------------------------------------------------|
-| `get_api_schema` | Fetch/refresh the live OpenAPI schema of the connected v5.7 instance |
-| `list_declarations` | List existing declaration UIDs known to the instance |
-| `get_declaration` | Retrieve an existing declaration by `configUid` |
-| `create_declaration` | Submit a brand-new JSON declaration (`POST /v5.7/config`) |
-| `update_declaration` | Patch/replace an existing declaration (`PATCH /v5.7/config/{configUid}`) |
-| `delete_declaration` | Remove a declaration |
-| `get_submission_status` | Poll the status of an asynchronous PATCH submission |
-| `validate_declaration_locally` | JSON-syntax + required-field sanity check before submitting (fast fail) |
-| `call_declarative_api` | Generic escape hatch: arbitrary method/path/body call against the v5.7 REST surface |
+| Tool | Parameters | Purpose |
+| --- | --- | --- |
+| `get_api_schema` | `force_refresh: bool = False` | Fetch or refresh the live OpenAPI schema from the connected Declarative API instance |
+| `list_declarations` | — | List active declaration `configUid` entries managed by the instance |
+| `get_declaration` | `config_uid: str` | Retrieve an existing declaration by `configUid` |
+| `validate_declaration_locally` | `declaration_json: dict` | Validate declaration structure and required top-level fields prior to submission |
+| `create_declaration` | `declaration_json: dict` | Submit a new declaration (`POST /v5.7/config`) |
+| `update_declaration` | `config_uid: str`, `declaration_json: dict` | Incrementally patch/update an existing declaration (`PATCH /v5.7/config/{configUid}`) |
+| `delete_declaration` | `config_uid: str` | Delete an existing declaration (`DELETE /v5.7/config/{configUid}`) |
+| `get_submission_status` | `config_uid: str`, `submission_uid: str` | Poll the status of an asynchronous queued `PATCH` submission |
+| `call_declarative_api` | `method`, `path`, `body`, ... | Schema-grounded escape hatch to invoke any REST path on `NDAPI_BASE_URL` |
-A `system prompt` primer describing how declarations are structured
-(`.declaration`, `.output.nms` / `.output.nginxone`, source-of-truth
-references, synctime, etc.) is exposed as an MCP prompt (`declarative-api-primer`)
-so the LLM can compose valid declarations from natural language without the
-user having to paste the schema themselves.
+### Prompts
-## Example natural-language usage
+- **`declarative-api-primer`:** Supplies a concise structural guide to `.output.nms` / `.output.nginxone`, `.declaration`, Source of Truth URLs, and GitOps `synctime` so the LLM composes valid declarations without requiring users to paste reference schemas manually.
-> "Create an NGINX One config called `petstore` that reverse-proxies to
-> `https://api.petstore.internal:8443`, rate-limits clients to 10 req/s, and
-> publish it synchronously."
+---
+
+## Example Natural-Language Prompts
+
+> "Create an NGINX One config called `petstore` that reverse-proxies to `https://api.petstore.internal:8443`, rate-limits clients to 10 req/s, and publishes synchronously."
> "What's the status of submission `3f9a...` for config `petstore`?"
-> "Update `petstore` to add a WAF policy fetched from
-> `https://git.example.com/policies/petstore-waf.json` and re-check it every
-> 300 seconds."
+> "Update `petstore` to attach a WAF policy from `https://git.example.com/policies/petstore-waf.json` and re-check it every 300 seconds."
+
+See [`examples/example_prompts.md`](examples/example_prompts.md) for additional multi-step prompt workflows.
+
+---
+
+## MCP SDK Compatibility and Testing
+
+- **MCP Python SDK Compatibility:** In `mcp` `2.0.0` (released `2026-07-28`), `FastMCP` was renamed to `MCPServer` and moved from `mcp.server.fastmcp` to `mcp.server.mcpserver` while retaining the decorator API (`@mcp.tool()`, `@mcp.prompt()`). Both `server.py` and `tools.py` auto-detect the installed SDK class at import time, supporting both `2.x` and `1.x` environments transparently.
+- **Unit Tests:** Run the MCP server test suite from `contrib/mcp`:
+
+```bash
+cd contrib/mcp
+pytest tests/ -v
+```
-See [`examples/example_prompts.md`](examples/example_prompts.md) for more.
+---
-## Security notes
+## Security Notes
-- This module only ever talks to the Declarative API endpoint you configure —
- it has no other network access.
-- Credentials (`NDAPI_API_KEY` / `NDAPI_USERNAME` / `NDAPI_PASSWORD`) are read
- from the environment only; they are never logged or echoed back to the LLM.
-- `call_declarative_api` is restricted to the configured `NDAPI_BASE_URL` and
- will refuse absolute URLs pointing elsewhere.
+- **Scoped Network Egress:** The MCP server only communicates with the configured `NDAPI_BASE_URL` endpoint.
+- **SSRF Protection:** `call_declarative_api` rejects absolute external URLs pointing outside `NDAPI_BASE_URL`.
+- **Credential Isolation:** Secrets (`NDAPI_API_KEY`, `NDAPI_USERNAME`, `NDAPI_PASSWORD`) are read strictly from environment variables and are never logged or returned in LLM responses.
diff --git a/contrib/postman/NGINX Declarative API.postman_collection.json b/contrib/postman/NGINX Declarative API.postman_collection.json
index c0bdf195..dd5e705c 100644
--- a/contrib/postman/NGINX Declarative API.postman_collection.json
+++ b/contrib/postman/NGINX Declarative API.postman_collection.json
@@ -1,11 +1,11 @@
{
"info": {
- "_postman_id": "ebf44a67-3c6b-48b8-9b0e-d7d0466bc2fd",
+ "_postman_id": "4fabbf80-71d9-468c-87d6-85a78319d72e",
"name": "NGINX Declarative API",
"description": "# NGINX Declarative API (v5.7) — Postman Collection\n\nComprehensive Postman collection and built-in environment variables demonstrating all capabilities and use cases of the **NGINX Declarative API v5.7** across both supported control planes:\n\n1. **NGINX Instance Manager (**`output.type: \"nms\"`**)**\n \n2. **F5 Distributed Cloud / NGINX One Console (**`output.type: \"nginxone\"`**)**\n \n\n## Supported Endpoints (`v5.7`)\n\n- `GET /v5.7/schema` — Retrieve the OpenAPI / JSON Schema for v5.7 configuration declarations\n \n- `POST /v5.7/config` — Create and deploy a full NGINX configuration declaration\n \n- `PATCH /v5.7/config/{configUid}` — Apply incremental CRUD updates to an active declaration\n \n- `GET /v5.7/config/{configUid}` — Retrieve the stored configuration declaration\n \n- `GET /v5.7/config/{configUid}/status` — Retrieve the latest deployment status of a declaration\n \n- `GET /v5.7/config/{configUid}/submission/{submissionUid}` — Retrieve the status of a specific asynchronous submission\n \n- `DELETE /v5.7/config/{configUid}` — Delete a stored declaration and stop any background GitOps autosync worker",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "1667416",
- "_collection_link": "https://orange-rocket-1353.postman.co/workspace/NGINX-Declarative-API~8ba6e9c1-a04b-4484-8193-bbb142560553/collection/1667416-ebf44a67-3c6b-48b8-9b0e-d7d0466bc2fd?action=share&source=collection_link&creator=1667416"
+ "_collection_link": "https://orange-rocket-1353.postman.co/workspace/NGINX-Declarative-API~8ba6e9c1-a04b-4484-8193-bbb142560553/collection/1667416-4fabbf80-71d9-468c-87d6-85a78319d72e?action=share&source=collection_link&creator=1667416"
},
"item": [
{
@@ -12530,6 +12530,165 @@
"description": "Submits a v5.7 NGINX configuration declaration (`POST /v5.7/config`) for **Open-Meteo API Gateway RateLimit + JWT AuthN/AuthZ + redocly + moesif** and stores the returned `configUid` in collection variables."
},
"response": []
+ },
+ {
+ "name": "OpenAPI Servers - Root Multiple Servers (.servers[])",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.test(\"Status code is 200 OK\", function () {",
+ " pm.response.to.have.status(200);",
+ "});",
+ "const respData = pm.response.json();",
+ "pm.test(\"Response contains status and configUid\", function () {",
+ " pm.expect(respData).to.be.an(\"object\");",
+ " pm.expect(respData).to.have.property(\"configUid\").that.is.a(\"string\").and.is.not.empty;",
+ "});",
+ "if (respData && respData.configUid) {",
+ " pm.collectionVariables.set(\"configUid\", respData.configUid);",
+ "}"
+ ],
+ "type": "text/javascript",
+ "packages": {},
+ "requests": {}
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"output\": {\n \"type\": \"nms\",\n \"nms\": {\n \"url\": \"{{nim_host}}\",\n \"username\": \"{{nim_username}}\",\n \"password\": \"{{nim_password}}\",\n \"instancegroup\": \"{{nim_instancegroup}}\",\n \"synctime\": 0,\n \"modules\": []\n },\n \"license\": {\n \"endpoint\": \"{{nginx_reporting_server}}\",\n \"token\": \"{{nginx_license_token}}\",\n \"ssl_verify\": false,\n \"grace_period\": false\n }\n },\n \"declaration\": {\n \"http\": {\n \"servers\": [\n {\n \"name\": \"Open Meteo\",\n \"names\": [\n \"apigw.nginx.lab\"\n ],\n \"resolver\": \"Google\",\n \"listen\": {\n \"address\": \"0.0.0.0:443\",\n \"http2\": true,\n \"tls\": {\n \"certificate\": \"test_cert\",\n \"key\": \"test_key\",\n \"ciphers\": \"DEFAULT\",\n \"protocols\": [\n \"TLSv1.2\",\n \"TLSv1.3\"\n ]\n }\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/server-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/server-error.log\"\n }\n },\n \"locations\": [\n {\n \"uri\": \"/open-meteo\",\n \"urimatch\": \"prefix\",\n \"apigateway\": {\n \"openapi_schema\": {\n \"content\": \"ewogICJvcGVuYXBpIjogIjMuMC4wIiwKICAiaW5mbyI6IHsKICAgICJ0aXRsZSI6ICJPcGVuLU1ldGVvIE11bHRpLVNlcnZlciBBUEkiLAogICAgInZlcnNpb24iOiAiMS4wLjAiLAogICAgImRlc2NyaXB0aW9uIjogIkRlbW9uc3RyYXRlcyBtdWx0aXBsZSByb290IC5zZXJ2ZXJzW10udXJsIGVudHJpZXMgZ2VuZXJhdGluZyBtdWx0aXBsZSBzZXJ2ZXIgZGlyZWN0aXZlcyBpbiB0aGUgTkdJTlggQVBJIEdhdGV3YXkgdXBzdHJlYW0uIgogIH0sCiAgInNlcnZlcnMiOiBbCiAgICB7CiAgICAgICJ1cmwiOiAiaHR0cHM6Ly9hcGkub3Blbi1tZXRlby5jb20iLAogICAgICAiZGVzY3JpcHRpb24iOiAiUHJpbWFyeSBwcm9kdWN0aW9uIE9wZW4tTWV0ZW8gc2VydmVyIgogICAgfSwKICAgIHsKICAgICAgInVybCI6ICJodHRwczovL2N1c3RvbWVyLWFwaS5vcGVuLW1ldGVvLmNvbSIsCiAgICAgICJkZXNjcmlwdGlvbiI6ICJTZWNvbmRhcnkgY29tbWVyY2lhbCBPcGVuLU1ldGVvIHNlcnZlciIKICAgIH0KICBdLAogICJwYXRocyI6IHsKICAgICIvdjEvZm9yZWNhc3QiOiB7CiAgICAgICJnZXQiOiB7CiAgICAgICAgInN1bW1hcnkiOiAiNyBkYXkgd2VhdGhlciBmb3JlY2FzdCBmb3IgY29vcmRpbmF0ZXMiLAogICAgICAgICJvcGVyYXRpb25JZCI6ICJnZXRGb3JlY2FzdCIsCiAgICAgICAgInBhcmFtZXRlcnMiOiBbCiAgICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIjogImxhdGl0dWRlIiwKICAgICAgICAgICAgImluIjogInF1ZXJ5IiwKICAgICAgICAgICAgInJlcXVpcmVkIjogdHJ1ZSwKICAgICAgICAgICAgImRlc2NyaXB0aW9uIjogIkdlb2dyYXBoaWNhbCBXR1M4NCBjb29yZGluYXRlIG9mIHRoZSBsb2NhdGlvbiIsCiAgICAgICAgICAgICJzY2hlbWEiOiB7CiAgICAgICAgICAgICAgInR5cGUiOiAibnVtYmVyIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgewogICAgICAgICAgICAibmFtZSI6ICJsb25naXR1ZGUiLAogICAgICAgICAgICAiaW4iOiAicXVlcnkiLAogICAgICAgICAgICAicmVxdWlyZWQiOiB0cnVlLAogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiR2VvZ3JhcGhpY2FsIFdHUzg0IGNvb3JkaW5hdGUgb2YgdGhlIGxvY2F0aW9uIiwKICAgICAgICAgICAgInNjaGVtYSI6IHsKICAgICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICBdLAogICAgICAgICJyZXNwb25zZXMiOiB7CiAgICAgICAgICAiMjAwIjogewogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiT0siCiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgfQp9\"\n },\n \"api_gateway\": {\n \"enabled\": true,\n \"strip_uri\": true,\n \"server_url\": \"https://api.open-meteo.com\",\n \"enforce_methods\": true,\n \"enforce_bodies\": true,\n \"enforce_parameters\": true,\n \"enforce_response_codes\": true\n },\n \"developer_portal\": {\n \"enabled\": true,\n \"type\": \"redocly\",\n \"redocly\": {\n \"uri\": \"/open-meteo-devportal.html\"\n }\n },\n \"authentication\": {\n \"client\": [\n {\n \"profile\": \"JWT Authentication\"\n }\n ],\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n },\n \"authorization\": [\n {\n \"profile\": \"JWT role based authorization\",\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"profile\": \"apigw_ratelimit\",\n \"httpcode\": 429,\n \"burst\": 0,\n \"delay\": 0,\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ]\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/apigw-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/apigw-error.log\"\n }\n }\n }\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"name\": \"apigw_ratelimit\",\n \"key\": \"$binary_remote_addr\",\n \"size\": \"10m\",\n \"rate\": \"2r/s\"\n }\n ],\n \"nginx_plus_api\": {\n \"write\": false,\n \"listen\": \"127.0.0.1:8080\",\n \"allow_acl\": \"0.0.0.0/0\"\n }\n },\n \"resolvers\": [\n {\n \"name\": \"Google\",\n \"address\": \"8.8.8.8\",\n \"ipv4\": true,\n \"ipv6\": false,\n \"timeout\": \"30s\"\n }\n ],\n \"certificates\": [\n {\n \"type\": \"certificate\",\n \"name\": \"test_cert\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.crt\"\n }\n },\n {\n \"type\": \"key\",\n \"name\": \"test_key\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.key\"\n }\n }\n ],\n \"authentication\": {\n \"client\": [\n {\n \"name\": \"JWT Authentication\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"realm\": \"API Authentication\",\n \"key\": \"{\\\"keys\\\": [{\\\"k\\\":\\\"ZmFudGFzdGljand0\\\",\\\"kty\\\":\\\"oct\\\",\\\"kid\\\":\\\"0001\\\"}]}\",\n \"cachetime\": 5\n }\n }\n ]\n },\n \"authorization\": [\n {\n \"name\": \"JWT role based authorization\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"claims\": [\n {\n \"name\": \"roles\",\n \"value\": [\n \"~(devops)\"\n ],\n \"errorcode\": 403\n }\n ]\n }\n }\n ]\n }\n}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "http://{{ncg_host}}:{{ncg_port}}/{{ngc_api_version}}/config",
+ "protocol": "http",
+ "host": [
+ "{{ncg_host}}"
+ ],
+ "port": "{{ncg_port}}",
+ "path": [
+ "{{ngc_api_version}}",
+ "config"
+ ]
+ },
+ "description": "Deploys an API Gateway from an OpenAPI 3.0 schema defining multiple upstream servers under `.servers[].url`. Generates an NGINX upstream with `zone` statistics collection enabled and one `server` directive for each entry in `.servers[].url`."
+ },
+ "response": []
+ },
+ {
+ "name": "OpenAPI Servers - Per-Path Upstream Servers (.paths..servers[])",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.test(\"Status code is 200 OK\", function () {",
+ " pm.response.to.have.status(200);",
+ "});",
+ "const respData = pm.response.json();",
+ "pm.test(\"Response contains status and configUid\", function () {",
+ " pm.expect(respData).to.be.an(\"object\");",
+ " pm.expect(respData).to.have.property(\"configUid\").that.is.a(\"string\").and.is.not.empty;",
+ "});",
+ "if (respData && respData.configUid) {",
+ " pm.collectionVariables.set(\"configUid\", respData.configUid);",
+ "}"
+ ],
+ "type": "text/javascript",
+ "packages": {},
+ "requests": {}
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"output\": {\n \"type\": \"nms\",\n \"nms\": {\n \"url\": \"{{nim_host}}\",\n \"username\": \"{{nim_username}}\",\n \"password\": \"{{nim_password}}\",\n \"instancegroup\": \"{{nim_instancegroup}}\",\n \"synctime\": 0,\n \"modules\": []\n },\n \"license\": {\n \"endpoint\": \"{{nginx_reporting_server}}\",\n \"token\": \"{{nginx_license_token}}\",\n \"ssl_verify\": false,\n \"grace_period\": false\n }\n },\n \"declaration\": {\n \"http\": {\n \"servers\": [\n {\n \"name\": \"Open Meteo\",\n \"names\": [\n \"apigw.nginx.lab\"\n ],\n \"resolver\": \"Google\",\n \"listen\": {\n \"address\": \"0.0.0.0:443\",\n \"http2\": true,\n \"tls\": {\n \"certificate\": \"test_cert\",\n \"key\": \"test_key\",\n \"ciphers\": \"DEFAULT\",\n \"protocols\": [\n \"TLSv1.2\",\n \"TLSv1.3\"\n ]\n }\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/server-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/server-error.log\"\n }\n },\n \"locations\": [\n {\n \"uri\": \"/open-meteo\",\n \"urimatch\": \"prefix\",\n \"apigateway\": {\n \"openapi_schema\": {\n \"content\": \"ewogICJvcGVuYXBpIjogIjMuMC4wIiwKICAiaW5mbyI6IHsKICAgICJ0aXRsZSI6ICJPcGVuLU1ldGVvIFBlci1QYXRoIFNlcnZlcnMgQVBJIiwKICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKICAgICJkZXNjcmlwdGlvbiI6ICJEZW1vbnN0cmF0ZXMgZGVkaWNhdGVkIHBlci1wYXRobmFtZSBOR0lOWCB1cHN0cmVhbXMgd2hlbiAucGF0aHMuPE5BTUU+LnNlcnZlcnNbXSBpcyBkZWZpbmVkLiIKICB9LAogICJwYXRocyI6IHsKICAgICIvdjEvc3RhdHVzIjogewogICAgICAiZ2V0IjogewogICAgICAgICJzdW1tYXJ5IjogIkhlYWx0aCBhbmQgc3RhdHVzIGNoZWNrICh1c2VzIGRlZmF1bHQgYXBpX2dhdGV3YXkuc2VydmVyX3VybCB1cHN0cmVhbSkiLAogICAgICAgICJvcGVyYXRpb25JZCI6ICJnZXRTdGF0dXMiLAogICAgICAgICJyZXNwb25zZXMiOiB7CiAgICAgICAgICAiMjAwIjogewogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiT0siCiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9LAogICAgIi92MS9mb3JlY2FzdCI6IHsKICAgICAgInNlcnZlcnMiOiBbCiAgICAgICAgewogICAgICAgICAgInVybCI6ICJodHRwczovL2FwaS5vcGVuLW1ldGVvLmNvbSIsCiAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiRGVkaWNhdGVkIEZvcmVjYXN0IHVwc3RyZWFtIHNlcnZlciAxIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgInVybCI6ICJodHRwczovL2N1c3RvbWVyLWFwaS5vcGVuLW1ldGVvLmNvbSIsCiAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiRGVkaWNhdGVkIEZvcmVjYXN0IHVwc3RyZWFtIHNlcnZlciAyIgogICAgICAgIH0KICAgICAgXSwKICAgICAgImdldCI6IHsKICAgICAgICAic3VtbWFyeSI6ICJXZWF0aGVyIEZvcmVjYXN0ICh1c2VzIGRlZGljYXRlZCBwZXItcGF0aG5hbWUgdXBzdHJlYW0gd2l0aCBtdWx0aXBsZSBzZXJ2ZXJzKSIsCiAgICAgICAgIm9wZXJhdGlvbklkIjogImdldEZvcmVjYXN0IiwKICAgICAgICAicGFyYW1ldGVycyI6IFsKICAgICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiOiAibGF0aXR1ZGUiLAogICAgICAgICAgICAiaW4iOiAicXVlcnkiLAogICAgICAgICAgICAicmVxdWlyZWQiOiB0cnVlLAogICAgICAgICAgICAic2NoZW1hIjogewogICAgICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICAgICAgfQogICAgICAgICAgfSwKICAgICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiOiAibG9uZ2l0dWRlIiwKICAgICAgICAgICAgImluIjogInF1ZXJ5IiwKICAgICAgICAgICAgInJlcXVpcmVkIjogdHJ1ZSwKICAgICAgICAgICAgInNjaGVtYSI6IHsKICAgICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICBdLAogICAgICAgICJyZXNwb25zZXMiOiB7CiAgICAgICAgICAiMjAwIjogewogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiT0siCiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgfQp9\"\n },\n \"api_gateway\": {\n \"enabled\": true,\n \"strip_uri\": true,\n \"server_url\": \"https://api.open-meteo.com\",\n \"enforce_methods\": true,\n \"enforce_bodies\": true,\n \"enforce_parameters\": true,\n \"enforce_response_codes\": true\n },\n \"developer_portal\": {\n \"enabled\": true,\n \"type\": \"redocly\",\n \"redocly\": {\n \"uri\": \"/open-meteo-devportal.html\"\n }\n },\n \"authentication\": {\n \"client\": [\n {\n \"profile\": \"JWT Authentication\"\n }\n ],\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n },\n \"authorization\": [\n {\n \"profile\": \"JWT role based authorization\",\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"profile\": \"apigw_ratelimit\",\n \"httpcode\": 429,\n \"burst\": 0,\n \"delay\": 0,\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ]\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/apigw-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/apigw-error.log\"\n }\n }\n }\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"name\": \"apigw_ratelimit\",\n \"key\": \"$binary_remote_addr\",\n \"size\": \"10m\",\n \"rate\": \"2r/s\"\n }\n ],\n \"nginx_plus_api\": {\n \"write\": false,\n \"listen\": \"127.0.0.1:8080\",\n \"allow_acl\": \"0.0.0.0/0\"\n }\n },\n \"resolvers\": [\n {\n \"name\": \"Google\",\n \"address\": \"8.8.8.8\",\n \"ipv4\": true,\n \"ipv6\": false,\n \"timeout\": \"30s\"\n }\n ],\n \"certificates\": [\n {\n \"type\": \"certificate\",\n \"name\": \"test_cert\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.crt\"\n }\n },\n {\n \"type\": \"key\",\n \"name\": \"test_key\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.key\"\n }\n }\n ],\n \"authentication\": {\n \"client\": [\n {\n \"name\": \"JWT Authentication\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"realm\": \"API Authentication\",\n \"key\": \"{\\\"keys\\\": [{\\\"k\\\":\\\"ZmFudGFzdGljand0\\\",\\\"kty\\\":\\\"oct\\\",\\\"kid\\\":\\\"0001\\\"}]}\",\n \"cachetime\": 5\n }\n }\n ]\n },\n \"authorization\": [\n {\n \"name\": \"JWT role based authorization\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"claims\": [\n {\n \"name\": \"roles\",\n \"value\": [\n \"~(devops)\"\n ],\n \"errorcode\": 403\n }\n ]\n }\n }\n ]\n }\n}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "http://{{ncg_host}}:{{ncg_port}}/{{ngc_api_version}}/config",
+ "protocol": "http",
+ "host": [
+ "{{ncg_host}}"
+ ],
+ "port": "{{ncg_port}}",
+ "path": [
+ "{{ngc_api_version}}",
+ "config"
+ ]
+ },
+ "description": "Deploys an API Gateway from an OpenAPI 3.0 schema where `/v1/status` uses the default `api_gateway.server_url` upstream and `/v1/forecast` defines `.paths./v1/forecast.servers[]`, creating a dedicated per-pathname NGINX upstream with statistics collection enabled and multiple `server` directives."
+ },
+ "response": []
+ },
+ {
+ "name": "OpenAPI Servers - Server Variables (.servers[].variables & .paths..servers[].variables)",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.test(\"Status code is 200 OK\", function () {",
+ " pm.response.to.have.status(200);",
+ "});",
+ "const respData = pm.response.json();",
+ "pm.test(\"Response contains status and configUid\", function () {",
+ " pm.expect(respData).to.be.an(\"object\");",
+ " pm.expect(respData).to.have.property(\"configUid\").that.is.a(\"string\").and.is.not.empty;",
+ "});",
+ "if (respData && respData.configUid) {",
+ " pm.collectionVariables.set(\"configUid\", respData.configUid);",
+ "}"
+ ],
+ "type": "text/javascript",
+ "packages": {},
+ "requests": {}
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"output\": {\n \"type\": \"nms\",\n \"nms\": {\n \"url\": \"{{nim_host}}\",\n \"username\": \"{{nim_username}}\",\n \"password\": \"{{nim_password}}\",\n \"instancegroup\": \"{{nim_instancegroup}}\",\n \"synctime\": 0,\n \"modules\": []\n },\n \"license\": {\n \"endpoint\": \"{{nginx_reporting_server}}\",\n \"token\": \"{{nginx_license_token}}\",\n \"ssl_verify\": false,\n \"grace_period\": false\n }\n },\n \"declaration\": {\n \"http\": {\n \"servers\": [\n {\n \"name\": \"Open Meteo\",\n \"names\": [\n \"apigw.nginx.lab\"\n ],\n \"resolver\": \"Google\",\n \"listen\": {\n \"address\": \"0.0.0.0:443\",\n \"http2\": true,\n \"tls\": {\n \"certificate\": \"test_cert\",\n \"key\": \"test_key\",\n \"ciphers\": \"DEFAULT\",\n \"protocols\": [\n \"TLSv1.2\",\n \"TLSv1.3\"\n ]\n }\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/server-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/server-error.log\"\n }\n },\n \"locations\": [\n {\n \"uri\": \"/open-meteo\",\n \"urimatch\": \"prefix\",\n \"apigateway\": {\n \"openapi_schema\": {\n \"content\": \"ewogICJvcGVuYXBpIjogIjMuMC4wIiwKICAiaW5mbyI6IHsKICAgICJ0aXRsZSI6ICJPcGVuLU1ldGVvIFNlcnZlciBWYXJpYWJsZXMgQVBJIiwKICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKICAgICJkZXNjcmlwdGlvbiI6ICJEZW1vbnN0cmF0ZXMgT3BlbkFQSSBTZXJ2ZXIgVmFyaWFibGVzIHJlc29sdXRpb24gaW4gYm90aCByb290IC5zZXJ2ZXJzW10gYW5kIHBlci1wYXRoIC5wYXRocy48TkFNRT4uc2VydmVyc1tdLiIKICB9LAogICJzZXJ2ZXJzIjogWwogICAgewogICAgICAidXJsIjogImh0dHBzOi8ve3VzZXJuYW1lfS5naWdhbnRpYy1zZXJ2ZXIuY29tOntwb3J0fS97YmFzZVBhdGh9IiwKICAgICAgImRlc2NyaXB0aW9uIjogIlRoZSBwcm9kdWN0aW9uIEFQSSBzZXJ2ZXIgd2l0aCB0ZW1wbGF0ZSB2YXJpYWJsZXMiLAogICAgICAidmFyaWFibGVzIjogewogICAgICAgICJ1c2VybmFtZSI6IHsKICAgICAgICAgICJkZWZhdWx0IjogImRlbW8iLAogICAgICAgICAgImRlc2NyaXB0aW9uIjogInRoaXMgdmFsdWUgaXMgYXNzaWduZWQgYnkgdGhlIHNlcnZpY2UgcHJvdmlkZXIsIGluIHRoaXMgZXhhbXBsZSBnaWdhbnRpYy1zZXJ2ZXIuY29tIgogICAgICAgIH0sCiAgICAgICAgInBvcnQiOiB7CiAgICAgICAgICAiZW51bSI6IFsKICAgICAgICAgICAgIjg0NDMiLAogICAgICAgICAgICAiNDQzIgogICAgICAgICAgXSwKICAgICAgICAgICJkZWZhdWx0IjogIjg0NDMiCiAgICAgICAgfSwKICAgICAgICAiYmFzZVBhdGgiOiB7CiAgICAgICAgICAiZGVmYXVsdCI6ICJ2MiIKICAgICAgICB9CiAgICAgIH0KICAgIH0KICBdLAogICJwYXRocyI6IHsKICAgICIvdjEvc3RhdHVzIjogewogICAgICAiZ2V0IjogewogICAgICAgICJzdW1tYXJ5IjogIlN0YXR1cyBlbmRwb2ludCByb3V0ZWQgdG8gcmVzb2x2ZWQgcm9vdCBzZXJ2ZXIgKGh0dHBzOi8vZGVtby5naWdhbnRpYy1zZXJ2ZXIuY29tOjg0NDMvdjIpIiwKICAgICAgICAib3BlcmF0aW9uSWQiOiAiZ2V0U3RhdHVzIiwKICAgICAgICAicmVzcG9uc2VzIjogewogICAgICAgICAgIjIwMCI6IHsKICAgICAgICAgICAgImRlc2NyaXB0aW9uIjogIk9LIgogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfSwKICAgICIvdjEvZm9yZWNhc3QiOiB7CiAgICAgICJzZXJ2ZXJzIjogWwogICAgICAgIHsKICAgICAgICAgICJ1cmwiOiAiaHR0cHM6Ly97c3VifS5vcGVuLW1ldGVvLmNvbTp7cG9ydH0iLAogICAgICAgICAgImRlc2NyaXB0aW9uIjogIlJlZ2lvbmFsIGZvcmVjYXN0IHNlcnZlciB3aXRoIHZhcmlhYmxlcyIsCiAgICAgICAgICAidmFyaWFibGVzIjogewogICAgICAgICAgICAic3ViIjogewogICAgICAgICAgICAgICJlbnVtIjogWwogICAgICAgICAgICAgICAgImFwaSIsCiAgICAgICAgICAgICAgICAiY3VzdG9tZXItYXBpIgogICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgImRlZmF1bHQiOiAiYXBpIiwKICAgICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiT3Blbi1NZXRlbyBBUEkgdGllciBzdWJkb21haW4iCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICJwb3J0IjogewogICAgICAgICAgICAgICJlbnVtIjogWwogICAgICAgICAgICAgICAgIjQ0MyIsCiAgICAgICAgICAgICAgICAiODQ0MyIKICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICJkZWZhdWx0IjogIjQ0MyIKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgInVybCI6ICJodHRwczovL3tiYWNrdXBfc3VifS5vcGVuLW1ldGVvLmNvbTp7cG9ydH0iLAogICAgICAgICAgImRlc2NyaXB0aW9uIjogIkJhY2t1cCBmb3JlY2FzdCBzZXJ2ZXIgd2l0aCB2YXJpYWJsZXMiLAogICAgICAgICAgInZhcmlhYmxlcyI6IHsKICAgICAgICAgICAgImJhY2t1cF9zdWIiOiB7CiAgICAgICAgICAgICAgImRlZmF1bHQiOiAiY3VzdG9tZXItYXBpIgogICAgICAgICAgICB9LAogICAgICAgICAgICAicG9ydCI6IHsKICAgICAgICAgICAgICAiZGVmYXVsdCI6ICI0NDMiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIF0sCiAgICAgICJnZXQiOiB7CiAgICAgICAgInN1bW1hcnkiOiAiV2VhdGhlciBGb3JlY2FzdCByb3V0ZWQgdG8gZGVkaWNhdGVkIHBlci1wYXRoIHVwc3RyZWFtIHdpdGggcmVzb2x2ZWQgdmFyaWFibGVzIiwKICAgICAgICAib3BlcmF0aW9uSWQiOiAiZ2V0Rm9yZWNhc3QiLAogICAgICAgICJwYXJhbWV0ZXJzIjogWwogICAgICAgICAgewogICAgICAgICAgICAibmFtZSI6ICJsYXRpdHVkZSIsCiAgICAgICAgICAgICJpbiI6ICJxdWVyeSIsCiAgICAgICAgICAgICJyZXF1aXJlZCI6IHRydWUsCiAgICAgICAgICAgICJzY2hlbWEiOiB7CiAgICAgICAgICAgICAgInR5cGUiOiAibnVtYmVyIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgewogICAgICAgICAgICAibmFtZSI6ICJsb25naXR1ZGUiLAogICAgICAgICAgICAiaW4iOiAicXVlcnkiLAogICAgICAgICAgICAicmVxdWlyZWQiOiB0cnVlLAogICAgICAgICAgICAic2NoZW1hIjogewogICAgICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgInJlc3BvbnNlcyI6IHsKICAgICAgICAgICIyMDAiOiB7CiAgICAgICAgICAgICJkZXNjcmlwdGlvbiI6ICJPSyIKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9Cn0=\"\n },\n \"api_gateway\": {\n \"enabled\": true,\n \"strip_uri\": true,\n \"server_url\": \"https://api.open-meteo.com\",\n \"enforce_methods\": true,\n \"enforce_bodies\": true,\n \"enforce_parameters\": true,\n \"enforce_response_codes\": true\n },\n \"developer_portal\": {\n \"enabled\": true,\n \"type\": \"redocly\",\n \"redocly\": {\n \"uri\": \"/open-meteo-devportal.html\"\n }\n },\n \"authentication\": {\n \"client\": [\n {\n \"profile\": \"JWT Authentication\"\n }\n ],\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n },\n \"authorization\": [\n {\n \"profile\": \"JWT role based authorization\",\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"profile\": \"apigw_ratelimit\",\n \"httpcode\": 429,\n \"burst\": 0,\n \"delay\": 0,\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ]\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/apigw-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/apigw-error.log\"\n }\n }\n }\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"name\": \"apigw_ratelimit\",\n \"key\": \"$binary_remote_addr\",\n \"size\": \"10m\",\n \"rate\": \"2r/s\"\n }\n ],\n \"nginx_plus_api\": {\n \"write\": false,\n \"listen\": \"127.0.0.1:8080\",\n \"allow_acl\": \"0.0.0.0/0\"\n }\n },\n \"resolvers\": [\n {\n \"name\": \"Google\",\n \"address\": \"8.8.8.8\",\n \"ipv4\": true,\n \"ipv6\": false,\n \"timeout\": \"30s\"\n }\n ],\n \"certificates\": [\n {\n \"type\": \"certificate\",\n \"name\": \"test_cert\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.crt\"\n }\n },\n {\n \"type\": \"key\",\n \"name\": \"test_key\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.key\"\n }\n }\n ],\n \"authentication\": {\n \"client\": [\n {\n \"name\": \"JWT Authentication\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"realm\": \"API Authentication\",\n \"key\": \"{\\\"keys\\\": [{\\\"k\\\":\\\"ZmFudGFzdGljand0\\\",\\\"kty\\\":\\\"oct\\\",\\\"kid\\\":\\\"0001\\\"}]}\",\n \"cachetime\": 5\n }\n }\n ]\n },\n \"authorization\": [\n {\n \"name\": \"JWT role based authorization\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"claims\": [\n {\n \"name\": \"roles\",\n \"value\": [\n \"~(devops)\"\n ],\n \"errorcode\": 403\n }\n ]\n }\n }\n ]\n }\n}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "http://{{ncg_host}}:{{ncg_port}}/{{ngc_api_version}}/config",
+ "protocol": "http",
+ "host": [
+ "{{ncg_host}}"
+ ],
+ "port": "{{ncg_port}}",
+ "path": [
+ "{{ngc_api_version}}",
+ "config"
+ ]
+ },
+ "description": "Deploys an API Gateway from an OpenAPI 3.0 schema using OpenAPI Server Variables (`default`, `enum`, `description`) in both root `.servers[]` and path-specific `.paths..servers[]` as specified in https://learn.openapis.org/specification/servers.html."
+ },
+ "response": []
}
],
"description": "Deploys an API Gateway fronting the Open-Meteo Forecast API using an external YAML OpenAPI specification with rate limiting, JWT AuthN/AuthZ, Redocly developer portal, Moesif analytics, and F5 WAF protection."
@@ -17289,6 +17448,165 @@
"description": "Submits a v5.7 NGINX configuration declaration (`POST /v5.7/config`) for **Open-Meteo API Gateway RateLimit + JWT AuthN/AuthZ + redocly + moesif** and stores the returned `configUid` in collection variables."
},
"response": []
+ },
+ {
+ "name": "OpenAPI Servers - Root Multiple Servers (.servers[])",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.test(\"Status code is 200 OK\", function () {",
+ " pm.response.to.have.status(200);",
+ "});",
+ "const respData = pm.response.json();",
+ "pm.test(\"Response contains status and configUid\", function () {",
+ " pm.expect(respData).to.be.an(\"object\");",
+ " pm.expect(respData).to.have.property(\"configUid\").that.is.a(\"string\").and.is.not.empty;",
+ "});",
+ "if (respData && respData.configUid) {",
+ " pm.collectionVariables.set(\"configUid\", respData.configUid);",
+ "}"
+ ],
+ "type": "text/javascript",
+ "packages": {},
+ "requests": {}
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"output\": {\n \"type\": \"nginxone\",\n \"nginxone\": {\n \"url\": \"{{nginxone_url}}\",\n \"namespace\": \"{{nginxone_namespace}}\",\n \"token\": \"{{nginxone_token}}\",\n \"configsyncgroup\": \"{{nginxone_configsyncgroup}}\",\n \"synctime\": 0,\n \"modules\": []\n },\n \"license\": {\n \"endpoint\": \"{{nginx_reporting_server}}\",\n \"token\": \"{{nginx_license_token}}\",\n \"ssl_verify\": false,\n \"grace_period\": false\n }\n },\n \"declaration\": {\n \"http\": {\n \"servers\": [\n {\n \"name\": \"Open Meteo\",\n \"names\": [\n \"apigw.nginx.lab\"\n ],\n \"resolver\": \"Google\",\n \"listen\": {\n \"address\": \"0.0.0.0:443\",\n \"http2\": true,\n \"tls\": {\n \"certificate\": \"test_cert\",\n \"key\": \"test_key\",\n \"ciphers\": \"DEFAULT\",\n \"protocols\": [\n \"TLSv1.2\",\n \"TLSv1.3\"\n ]\n }\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/server-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/server-error.log\"\n }\n },\n \"locations\": [\n {\n \"uri\": \"/open-meteo\",\n \"urimatch\": \"prefix\",\n \"apigateway\": {\n \"openapi_schema\": {\n \"content\": \"ewogICJvcGVuYXBpIjogIjMuMC4wIiwKICAiaW5mbyI6IHsKICAgICJ0aXRsZSI6ICJPcGVuLU1ldGVvIE11bHRpLVNlcnZlciBBUEkiLAogICAgInZlcnNpb24iOiAiMS4wLjAiLAogICAgImRlc2NyaXB0aW9uIjogIkRlbW9uc3RyYXRlcyBtdWx0aXBsZSByb290IC5zZXJ2ZXJzW10udXJsIGVudHJpZXMgZ2VuZXJhdGluZyBtdWx0aXBsZSBzZXJ2ZXIgZGlyZWN0aXZlcyBpbiB0aGUgTkdJTlggQVBJIEdhdGV3YXkgdXBzdHJlYW0uIgogIH0sCiAgInNlcnZlcnMiOiBbCiAgICB7CiAgICAgICJ1cmwiOiAiaHR0cHM6Ly9hcGkub3Blbi1tZXRlby5jb20iLAogICAgICAiZGVzY3JpcHRpb24iOiAiUHJpbWFyeSBwcm9kdWN0aW9uIE9wZW4tTWV0ZW8gc2VydmVyIgogICAgfSwKICAgIHsKICAgICAgInVybCI6ICJodHRwczovL2N1c3RvbWVyLWFwaS5vcGVuLW1ldGVvLmNvbSIsCiAgICAgICJkZXNjcmlwdGlvbiI6ICJTZWNvbmRhcnkgY29tbWVyY2lhbCBPcGVuLU1ldGVvIHNlcnZlciIKICAgIH0KICBdLAogICJwYXRocyI6IHsKICAgICIvdjEvZm9yZWNhc3QiOiB7CiAgICAgICJnZXQiOiB7CiAgICAgICAgInN1bW1hcnkiOiAiNyBkYXkgd2VhdGhlciBmb3JlY2FzdCBmb3IgY29vcmRpbmF0ZXMiLAogICAgICAgICJvcGVyYXRpb25JZCI6ICJnZXRGb3JlY2FzdCIsCiAgICAgICAgInBhcmFtZXRlcnMiOiBbCiAgICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIjogImxhdGl0dWRlIiwKICAgICAgICAgICAgImluIjogInF1ZXJ5IiwKICAgICAgICAgICAgInJlcXVpcmVkIjogdHJ1ZSwKICAgICAgICAgICAgImRlc2NyaXB0aW9uIjogIkdlb2dyYXBoaWNhbCBXR1M4NCBjb29yZGluYXRlIG9mIHRoZSBsb2NhdGlvbiIsCiAgICAgICAgICAgICJzY2hlbWEiOiB7CiAgICAgICAgICAgICAgInR5cGUiOiAibnVtYmVyIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgewogICAgICAgICAgICAibmFtZSI6ICJsb25naXR1ZGUiLAogICAgICAgICAgICAiaW4iOiAicXVlcnkiLAogICAgICAgICAgICAicmVxdWlyZWQiOiB0cnVlLAogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiR2VvZ3JhcGhpY2FsIFdHUzg0IGNvb3JkaW5hdGUgb2YgdGhlIGxvY2F0aW9uIiwKICAgICAgICAgICAgInNjaGVtYSI6IHsKICAgICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICBdLAogICAgICAgICJyZXNwb25zZXMiOiB7CiAgICAgICAgICAiMjAwIjogewogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiT0siCiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgfQp9\"\n },\n \"api_gateway\": {\n \"enabled\": true,\n \"strip_uri\": true,\n \"server_url\": \"https://api.open-meteo.com\",\n \"enforce_methods\": true,\n \"enforce_bodies\": true,\n \"enforce_parameters\": true,\n \"enforce_response_codes\": true\n },\n \"developer_portal\": {\n \"enabled\": true,\n \"type\": \"redocly\",\n \"redocly\": {\n \"uri\": \"/open-meteo-devportal.html\"\n }\n },\n \"authentication\": {\n \"client\": [\n {\n \"profile\": \"JWT Authentication\"\n }\n ],\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n },\n \"authorization\": [\n {\n \"profile\": \"JWT role based authorization\",\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"profile\": \"apigw_ratelimit\",\n \"httpcode\": 429,\n \"burst\": 0,\n \"delay\": 0,\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ]\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/apigw-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/apigw-error.log\"\n }\n }\n }\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"name\": \"apigw_ratelimit\",\n \"key\": \"$binary_remote_addr\",\n \"size\": \"10m\",\n \"rate\": \"2r/s\"\n }\n ],\n \"nginx_plus_api\": {\n \"write\": false,\n \"listen\": \"127.0.0.1:8080\",\n \"allow_acl\": \"0.0.0.0/0\"\n }\n },\n \"resolvers\": [\n {\n \"name\": \"Google\",\n \"address\": \"8.8.8.8\",\n \"ipv4\": true,\n \"ipv6\": false,\n \"timeout\": \"30s\"\n }\n ],\n \"certificates\": [\n {\n \"type\": \"certificate\",\n \"name\": \"test_cert\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.crt\"\n }\n },\n {\n \"type\": \"key\",\n \"name\": \"test_key\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.key\"\n }\n }\n ],\n \"authentication\": {\n \"client\": [\n {\n \"name\": \"JWT Authentication\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"realm\": \"API Authentication\",\n \"key\": \"{\\\"keys\\\": [{\\\"k\\\":\\\"ZmFudGFzdGljand0\\\",\\\"kty\\\":\\\"oct\\\",\\\"kid\\\":\\\"0001\\\"}]}\",\n \"cachetime\": 5\n }\n }\n ]\n },\n \"authorization\": [\n {\n \"name\": \"JWT role based authorization\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"claims\": [\n {\n \"name\": \"roles\",\n \"value\": [\n \"~(devops)\"\n ],\n \"errorcode\": 403\n }\n ]\n }\n }\n ]\n }\n}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "http://{{ncg_host}}:{{ncg_port}}/{{ngc_api_version}}/config",
+ "protocol": "http",
+ "host": [
+ "{{ncg_host}}"
+ ],
+ "port": "{{ncg_port}}",
+ "path": [
+ "{{ngc_api_version}}",
+ "config"
+ ]
+ },
+ "description": "Deploys an API Gateway from an OpenAPI 3.0 schema defining multiple upstream servers under `.servers[].url`. Generates an NGINX upstream with `zone` statistics collection enabled and one `server` directive for each entry in `.servers[].url`."
+ },
+ "response": []
+ },
+ {
+ "name": "OpenAPI Servers - Per-Path Upstream Servers (.paths..servers[])",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.test(\"Status code is 200 OK\", function () {",
+ " pm.response.to.have.status(200);",
+ "});",
+ "const respData = pm.response.json();",
+ "pm.test(\"Response contains status and configUid\", function () {",
+ " pm.expect(respData).to.be.an(\"object\");",
+ " pm.expect(respData).to.have.property(\"configUid\").that.is.a(\"string\").and.is.not.empty;",
+ "});",
+ "if (respData && respData.configUid) {",
+ " pm.collectionVariables.set(\"configUid\", respData.configUid);",
+ "}"
+ ],
+ "type": "text/javascript",
+ "packages": {},
+ "requests": {}
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"output\": {\n \"type\": \"nginxone\",\n \"nginxone\": {\n \"url\": \"{{nginxone_url}}\",\n \"namespace\": \"{{nginxone_namespace}}\",\n \"token\": \"{{nginxone_token}}\",\n \"configsyncgroup\": \"{{nginxone_configsyncgroup}}\",\n \"synctime\": 0,\n \"modules\": []\n },\n \"license\": {\n \"endpoint\": \"{{nginx_reporting_server}}\",\n \"token\": \"{{nginx_license_token}}\",\n \"ssl_verify\": false,\n \"grace_period\": false\n }\n },\n \"declaration\": {\n \"http\": {\n \"servers\": [\n {\n \"name\": \"Open Meteo\",\n \"names\": [\n \"apigw.nginx.lab\"\n ],\n \"resolver\": \"Google\",\n \"listen\": {\n \"address\": \"0.0.0.0:443\",\n \"http2\": true,\n \"tls\": {\n \"certificate\": \"test_cert\",\n \"key\": \"test_key\",\n \"ciphers\": \"DEFAULT\",\n \"protocols\": [\n \"TLSv1.2\",\n \"TLSv1.3\"\n ]\n }\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/server-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/server-error.log\"\n }\n },\n \"locations\": [\n {\n \"uri\": \"/open-meteo\",\n \"urimatch\": \"prefix\",\n \"apigateway\": {\n \"openapi_schema\": {\n \"content\": \"ewogICJvcGVuYXBpIjogIjMuMC4wIiwKICAiaW5mbyI6IHsKICAgICJ0aXRsZSI6ICJPcGVuLU1ldGVvIFBlci1QYXRoIFNlcnZlcnMgQVBJIiwKICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKICAgICJkZXNjcmlwdGlvbiI6ICJEZW1vbnN0cmF0ZXMgZGVkaWNhdGVkIHBlci1wYXRobmFtZSBOR0lOWCB1cHN0cmVhbXMgd2hlbiAucGF0aHMuPE5BTUU+LnNlcnZlcnNbXSBpcyBkZWZpbmVkLiIKICB9LAogICJwYXRocyI6IHsKICAgICIvdjEvc3RhdHVzIjogewogICAgICAiZ2V0IjogewogICAgICAgICJzdW1tYXJ5IjogIkhlYWx0aCBhbmQgc3RhdHVzIGNoZWNrICh1c2VzIGRlZmF1bHQgYXBpX2dhdGV3YXkuc2VydmVyX3VybCB1cHN0cmVhbSkiLAogICAgICAgICJvcGVyYXRpb25JZCI6ICJnZXRTdGF0dXMiLAogICAgICAgICJyZXNwb25zZXMiOiB7CiAgICAgICAgICAiMjAwIjogewogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiT0siCiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9LAogICAgIi92MS9mb3JlY2FzdCI6IHsKICAgICAgInNlcnZlcnMiOiBbCiAgICAgICAgewogICAgICAgICAgInVybCI6ICJodHRwczovL2FwaS5vcGVuLW1ldGVvLmNvbSIsCiAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiRGVkaWNhdGVkIEZvcmVjYXN0IHVwc3RyZWFtIHNlcnZlciAxIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgInVybCI6ICJodHRwczovL2N1c3RvbWVyLWFwaS5vcGVuLW1ldGVvLmNvbSIsCiAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiRGVkaWNhdGVkIEZvcmVjYXN0IHVwc3RyZWFtIHNlcnZlciAyIgogICAgICAgIH0KICAgICAgXSwKICAgICAgImdldCI6IHsKICAgICAgICAic3VtbWFyeSI6ICJXZWF0aGVyIEZvcmVjYXN0ICh1c2VzIGRlZGljYXRlZCBwZXItcGF0aG5hbWUgdXBzdHJlYW0gd2l0aCBtdWx0aXBsZSBzZXJ2ZXJzKSIsCiAgICAgICAgIm9wZXJhdGlvbklkIjogImdldEZvcmVjYXN0IiwKICAgICAgICAicGFyYW1ldGVycyI6IFsKICAgICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiOiAibGF0aXR1ZGUiLAogICAgICAgICAgICAiaW4iOiAicXVlcnkiLAogICAgICAgICAgICAicmVxdWlyZWQiOiB0cnVlLAogICAgICAgICAgICAic2NoZW1hIjogewogICAgICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICAgICAgfQogICAgICAgICAgfSwKICAgICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiOiAibG9uZ2l0dWRlIiwKICAgICAgICAgICAgImluIjogInF1ZXJ5IiwKICAgICAgICAgICAgInJlcXVpcmVkIjogdHJ1ZSwKICAgICAgICAgICAgInNjaGVtYSI6IHsKICAgICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICBdLAogICAgICAgICJyZXNwb25zZXMiOiB7CiAgICAgICAgICAiMjAwIjogewogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiT0siCiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgfQp9\"\n },\n \"api_gateway\": {\n \"enabled\": true,\n \"strip_uri\": true,\n \"server_url\": \"https://api.open-meteo.com\",\n \"enforce_methods\": true,\n \"enforce_bodies\": true,\n \"enforce_parameters\": true,\n \"enforce_response_codes\": true\n },\n \"developer_portal\": {\n \"enabled\": true,\n \"type\": \"redocly\",\n \"redocly\": {\n \"uri\": \"/open-meteo-devportal.html\"\n }\n },\n \"authentication\": {\n \"client\": [\n {\n \"profile\": \"JWT Authentication\"\n }\n ],\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n },\n \"authorization\": [\n {\n \"profile\": \"JWT role based authorization\",\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"profile\": \"apigw_ratelimit\",\n \"httpcode\": 429,\n \"burst\": 0,\n \"delay\": 0,\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ]\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/apigw-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/apigw-error.log\"\n }\n }\n }\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"name\": \"apigw_ratelimit\",\n \"key\": \"$binary_remote_addr\",\n \"size\": \"10m\",\n \"rate\": \"2r/s\"\n }\n ],\n \"nginx_plus_api\": {\n \"write\": false,\n \"listen\": \"127.0.0.1:8080\",\n \"allow_acl\": \"0.0.0.0/0\"\n }\n },\n \"resolvers\": [\n {\n \"name\": \"Google\",\n \"address\": \"8.8.8.8\",\n \"ipv4\": true,\n \"ipv6\": false,\n \"timeout\": \"30s\"\n }\n ],\n \"certificates\": [\n {\n \"type\": \"certificate\",\n \"name\": \"test_cert\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.crt\"\n }\n },\n {\n \"type\": \"key\",\n \"name\": \"test_key\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.key\"\n }\n }\n ],\n \"authentication\": {\n \"client\": [\n {\n \"name\": \"JWT Authentication\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"realm\": \"API Authentication\",\n \"key\": \"{\\\"keys\\\": [{\\\"k\\\":\\\"ZmFudGFzdGljand0\\\",\\\"kty\\\":\\\"oct\\\",\\\"kid\\\":\\\"0001\\\"}]}\",\n \"cachetime\": 5\n }\n }\n ]\n },\n \"authorization\": [\n {\n \"name\": \"JWT role based authorization\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"claims\": [\n {\n \"name\": \"roles\",\n \"value\": [\n \"~(devops)\"\n ],\n \"errorcode\": 403\n }\n ]\n }\n }\n ]\n }\n}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "http://{{ncg_host}}:{{ncg_port}}/{{ngc_api_version}}/config",
+ "protocol": "http",
+ "host": [
+ "{{ncg_host}}"
+ ],
+ "port": "{{ncg_port}}",
+ "path": [
+ "{{ngc_api_version}}",
+ "config"
+ ]
+ },
+ "description": "Deploys an API Gateway from an OpenAPI 3.0 schema where `/v1/status` uses the default `api_gateway.server_url` upstream and `/v1/forecast` defines `.paths./v1/forecast.servers[]`, creating a dedicated per-pathname NGINX upstream with statistics collection enabled and multiple `server` directives."
+ },
+ "response": []
+ },
+ {
+ "name": "OpenAPI Servers - Server Variables (.servers[].variables & .paths..servers[].variables)",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.test(\"Status code is 200 OK\", function () {",
+ " pm.response.to.have.status(200);",
+ "});",
+ "const respData = pm.response.json();",
+ "pm.test(\"Response contains status and configUid\", function () {",
+ " pm.expect(respData).to.be.an(\"object\");",
+ " pm.expect(respData).to.have.property(\"configUid\").that.is.a(\"string\").and.is.not.empty;",
+ "});",
+ "if (respData && respData.configUid) {",
+ " pm.collectionVariables.set(\"configUid\", respData.configUid);",
+ "}"
+ ],
+ "type": "text/javascript",
+ "packages": {},
+ "requests": {}
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [],
+ "body": {
+ "mode": "raw",
+ "raw": "{\n \"output\": {\n \"type\": \"nginxone\",\n \"nginxone\": {\n \"url\": \"{{nginxone_url}}\",\n \"namespace\": \"{{nginxone_namespace}}\",\n \"token\": \"{{nginxone_token}}\",\n \"configsyncgroup\": \"{{nginxone_configsyncgroup}}\",\n \"synctime\": 0,\n \"modules\": []\n },\n \"license\": {\n \"endpoint\": \"{{nginx_reporting_server}}\",\n \"token\": \"{{nginx_license_token}}\",\n \"ssl_verify\": false,\n \"grace_period\": false\n }\n },\n \"declaration\": {\n \"http\": {\n \"servers\": [\n {\n \"name\": \"Open Meteo\",\n \"names\": [\n \"apigw.nginx.lab\"\n ],\n \"resolver\": \"Google\",\n \"listen\": {\n \"address\": \"0.0.0.0:443\",\n \"http2\": true,\n \"tls\": {\n \"certificate\": \"test_cert\",\n \"key\": \"test_key\",\n \"ciphers\": \"DEFAULT\",\n \"protocols\": [\n \"TLSv1.2\",\n \"TLSv1.3\"\n ]\n }\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/server-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/server-error.log\"\n }\n },\n \"locations\": [\n {\n \"uri\": \"/open-meteo\",\n \"urimatch\": \"prefix\",\n \"apigateway\": {\n \"openapi_schema\": {\n \"content\": \"ewogICJvcGVuYXBpIjogIjMuMC4wIiwKICAiaW5mbyI6IHsKICAgICJ0aXRsZSI6ICJPcGVuLU1ldGVvIFNlcnZlciBWYXJpYWJsZXMgQVBJIiwKICAgICJ2ZXJzaW9uIjogIjEuMC4wIiwKICAgICJkZXNjcmlwdGlvbiI6ICJEZW1vbnN0cmF0ZXMgT3BlbkFQSSBTZXJ2ZXIgVmFyaWFibGVzIHJlc29sdXRpb24gaW4gYm90aCByb290IC5zZXJ2ZXJzW10gYW5kIHBlci1wYXRoIC5wYXRocy48TkFNRT4uc2VydmVyc1tdLiIKICB9LAogICJzZXJ2ZXJzIjogWwogICAgewogICAgICAidXJsIjogImh0dHBzOi8ve3VzZXJuYW1lfS5naWdhbnRpYy1zZXJ2ZXIuY29tOntwb3J0fS97YmFzZVBhdGh9IiwKICAgICAgImRlc2NyaXB0aW9uIjogIlRoZSBwcm9kdWN0aW9uIEFQSSBzZXJ2ZXIgd2l0aCB0ZW1wbGF0ZSB2YXJpYWJsZXMiLAogICAgICAidmFyaWFibGVzIjogewogICAgICAgICJ1c2VybmFtZSI6IHsKICAgICAgICAgICJkZWZhdWx0IjogImRlbW8iLAogICAgICAgICAgImRlc2NyaXB0aW9uIjogInRoaXMgdmFsdWUgaXMgYXNzaWduZWQgYnkgdGhlIHNlcnZpY2UgcHJvdmlkZXIsIGluIHRoaXMgZXhhbXBsZSBnaWdhbnRpYy1zZXJ2ZXIuY29tIgogICAgICAgIH0sCiAgICAgICAgInBvcnQiOiB7CiAgICAgICAgICAiZW51bSI6IFsKICAgICAgICAgICAgIjg0NDMiLAogICAgICAgICAgICAiNDQzIgogICAgICAgICAgXSwKICAgICAgICAgICJkZWZhdWx0IjogIjg0NDMiCiAgICAgICAgfSwKICAgICAgICAiYmFzZVBhdGgiOiB7CiAgICAgICAgICAiZGVmYXVsdCI6ICJ2MiIKICAgICAgICB9CiAgICAgIH0KICAgIH0KICBdLAogICJwYXRocyI6IHsKICAgICIvdjEvc3RhdHVzIjogewogICAgICAiZ2V0IjogewogICAgICAgICJzdW1tYXJ5IjogIlN0YXR1cyBlbmRwb2ludCByb3V0ZWQgdG8gcmVzb2x2ZWQgcm9vdCBzZXJ2ZXIgKGh0dHBzOi8vZGVtby5naWdhbnRpYy1zZXJ2ZXIuY29tOjg0NDMvdjIpIiwKICAgICAgICAib3BlcmF0aW9uSWQiOiAiZ2V0U3RhdHVzIiwKICAgICAgICAicmVzcG9uc2VzIjogewogICAgICAgICAgIjIwMCI6IHsKICAgICAgICAgICAgImRlc2NyaXB0aW9uIjogIk9LIgogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfSwKICAgICIvdjEvZm9yZWNhc3QiOiB7CiAgICAgICJzZXJ2ZXJzIjogWwogICAgICAgIHsKICAgICAgICAgICJ1cmwiOiAiaHR0cHM6Ly97c3VifS5vcGVuLW1ldGVvLmNvbTp7cG9ydH0iLAogICAgICAgICAgImRlc2NyaXB0aW9uIjogIlJlZ2lvbmFsIGZvcmVjYXN0IHNlcnZlciB3aXRoIHZhcmlhYmxlcyIsCiAgICAgICAgICAidmFyaWFibGVzIjogewogICAgICAgICAgICAic3ViIjogewogICAgICAgICAgICAgICJlbnVtIjogWwogICAgICAgICAgICAgICAgImFwaSIsCiAgICAgICAgICAgICAgICAiY3VzdG9tZXItYXBpIgogICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgImRlZmF1bHQiOiAiYXBpIiwKICAgICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiT3Blbi1NZXRlbyBBUEkgdGllciBzdWJkb21haW4iCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICJwb3J0IjogewogICAgICAgICAgICAgICJlbnVtIjogWwogICAgICAgICAgICAgICAgIjQ0MyIsCiAgICAgICAgICAgICAgICAiODQ0MyIKICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICJkZWZhdWx0IjogIjQ0MyIKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgInVybCI6ICJodHRwczovL3tiYWNrdXBfc3VifS5vcGVuLW1ldGVvLmNvbTp7cG9ydH0iLAogICAgICAgICAgImRlc2NyaXB0aW9uIjogIkJhY2t1cCBmb3JlY2FzdCBzZXJ2ZXIgd2l0aCB2YXJpYWJsZXMiLAogICAgICAgICAgInZhcmlhYmxlcyI6IHsKICAgICAgICAgICAgImJhY2t1cF9zdWIiOiB7CiAgICAgICAgICAgICAgImRlZmF1bHQiOiAiY3VzdG9tZXItYXBpIgogICAgICAgICAgICB9LAogICAgICAgICAgICAicG9ydCI6IHsKICAgICAgICAgICAgICAiZGVmYXVsdCI6ICI0NDMiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIF0sCiAgICAgICJnZXQiOiB7CiAgICAgICAgInN1bW1hcnkiOiAiV2VhdGhlciBGb3JlY2FzdCByb3V0ZWQgdG8gZGVkaWNhdGVkIHBlci1wYXRoIHVwc3RyZWFtIHdpdGggcmVzb2x2ZWQgdmFyaWFibGVzIiwKICAgICAgICAib3BlcmF0aW9uSWQiOiAiZ2V0Rm9yZWNhc3QiLAogICAgICAgICJwYXJhbWV0ZXJzIjogWwogICAgICAgICAgewogICAgICAgICAgICAibmFtZSI6ICJsYXRpdHVkZSIsCiAgICAgICAgICAgICJpbiI6ICJxdWVyeSIsCiAgICAgICAgICAgICJyZXF1aXJlZCI6IHRydWUsCiAgICAgICAgICAgICJzY2hlbWEiOiB7CiAgICAgICAgICAgICAgInR5cGUiOiAibnVtYmVyIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgewogICAgICAgICAgICAibmFtZSI6ICJsb25naXR1ZGUiLAogICAgICAgICAgICAiaW4iOiAicXVlcnkiLAogICAgICAgICAgICAicmVxdWlyZWQiOiB0cnVlLAogICAgICAgICAgICAic2NoZW1hIjogewogICAgICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgInJlc3BvbnNlcyI6IHsKICAgICAgICAgICIyMDAiOiB7CiAgICAgICAgICAgICJkZXNjcmlwdGlvbiI6ICJPSyIKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9Cn0=\"\n },\n \"api_gateway\": {\n \"enabled\": true,\n \"strip_uri\": true,\n \"server_url\": \"https://api.open-meteo.com\",\n \"enforce_methods\": true,\n \"enforce_bodies\": true,\n \"enforce_parameters\": true,\n \"enforce_response_codes\": true\n },\n \"developer_portal\": {\n \"enabled\": true,\n \"type\": \"redocly\",\n \"redocly\": {\n \"uri\": \"/open-meteo-devportal.html\"\n }\n },\n \"authentication\": {\n \"client\": [\n {\n \"profile\": \"JWT Authentication\"\n }\n ],\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n },\n \"authorization\": [\n {\n \"profile\": \"JWT role based authorization\",\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"profile\": \"apigw_ratelimit\",\n \"httpcode\": 429,\n \"burst\": 0,\n \"delay\": 0,\n \"enforceOnPaths\": true,\n \"paths\": [\n \"/v1/forecast\"\n ]\n }\n ]\n },\n \"log\": {\n \"access\": {\n \"destination\": \"/var/log/nginx/apigw-access.log\"\n },\n \"error\": {\n \"destination\": \"/var/log/nginx/apigw-error.log\"\n }\n }\n }\n ]\n }\n ],\n \"rate_limit\": [\n {\n \"name\": \"apigw_ratelimit\",\n \"key\": \"$binary_remote_addr\",\n \"size\": \"10m\",\n \"rate\": \"2r/s\"\n }\n ],\n \"nginx_plus_api\": {\n \"write\": false,\n \"listen\": \"127.0.0.1:8080\",\n \"allow_acl\": \"0.0.0.0/0\"\n }\n },\n \"resolvers\": [\n {\n \"name\": \"Google\",\n \"address\": \"8.8.8.8\",\n \"ipv4\": true,\n \"ipv6\": false,\n \"timeout\": \"30s\"\n }\n ],\n \"certificates\": [\n {\n \"type\": \"certificate\",\n \"name\": \"test_cert\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.crt\"\n }\n },\n {\n \"type\": \"key\",\n \"name\": \"test_key\",\n \"contents\": {\n \"content\": \"{{github_gitops_root}}/{{ngc_api_version}}/testcert.key\"\n }\n }\n ],\n \"authentication\": {\n \"client\": [\n {\n \"name\": \"JWT Authentication\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"realm\": \"API Authentication\",\n \"key\": \"{\\\"keys\\\": [{\\\"k\\\":\\\"ZmFudGFzdGljand0\\\",\\\"kty\\\":\\\"oct\\\",\\\"kid\\\":\\\"0001\\\"}]}\",\n \"cachetime\": 5\n }\n }\n ]\n },\n \"authorization\": [\n {\n \"name\": \"JWT role based authorization\",\n \"type\": \"jwt\",\n \"jwt\": {\n \"claims\": [\n {\n \"name\": \"roles\",\n \"value\": [\n \"~(devops)\"\n ],\n \"errorcode\": 403\n }\n ]\n }\n }\n ]\n }\n}",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ }
+ },
+ "url": {
+ "raw": "http://{{ncg_host}}:{{ncg_port}}/{{ngc_api_version}}/config",
+ "protocol": "http",
+ "host": [
+ "{{ncg_host}}"
+ ],
+ "port": "{{ncg_port}}",
+ "path": [
+ "{{ngc_api_version}}",
+ "config"
+ ]
+ },
+ "description": "Deploys an API Gateway from an OpenAPI 3.0 schema using OpenAPI Server Variables (`default`, `enum`, `description`) in both root `.servers[]` and path-specific `.paths..servers[]` as specified in https://learn.openapis.org/specification/servers.html."
+ },
+ "response": []
}
],
"description": "Deploys an API Gateway fronting the Open-Meteo Forecast API using an external YAML OpenAPI specification with rate limiting, JWT AuthN/AuthZ, Redocly developer portal, Moesif analytics, and F5 WAF protection."
@@ -21200,4 +21518,4 @@
"description": "Sample HS256 JWT Bearer token with dual roles=['devops', 'guest'] claims."
}
]
-}
+}
\ No newline at end of file
diff --git a/contrib/postman/README.md b/contrib/postman/README.md
index 3cc43d1b..b8e47cb3 100644
--- a/contrib/postman/README.md
+++ b/contrib/postman/README.md
@@ -1,46 +1,46 @@
-# NGINX Declarative API (v5.7) — Postman Collection & Environment Guide
+# NGINX Declarative API — Postman Collection & Environment Guide
-This directory contains the comprehensive **Postman Collection v2.1** (`NGINX Declarative API.postman_collection.json`) and its built-in **Collection / Environment Variables** for demonstrating, testing, and automating every capability of the **[NGINX Declarative API v5.7](https://github.com/f5devcentral/NGINX-Declarative-API)**.
+This directory contains the **Postman Collection v2.1** (`NGINX Declarative API.postman_collection.json`) with built-in **Collection Variables** for demonstrating, testing, and automating every capability of the **[NGINX Declarative API](https://github.com/f5devcentral/NGINX-Declarative-API)** across **`v5.5`**, **`v5.6`**, and **`v5.7`**.
---
## Table of Contents
-1. [Overview & v5.7 Architecture](#1-overview--v57-architecture)
-2. [Summary of Collection Enhancements & Fixes](#2-summary-of-collection-enhancements--fixes)
+1. [Overview & Architecture](#1-overview--architecture)
+2. [Collection Layout & Version Summary](#2-collection-layout--version-summary)
3. [Quickstart Guide](#3-quickstart-guide)
-4. [Collection & Environment Variables Reference](#4-collection--environment-variables-reference)
+4. [Collection Variables Reference](#4-collection-variables-reference)
5. [API v5.7 Endpoints Reference](#5-api-v57-endpoints-reference)
-6. [Use-Case Catalog & Folder Walkthroughs](#6-use-case-catalog--folder-walkthroughs)
+6. [v5.7 Use-Case Catalog & Folder Walkthroughs](#6-v57-use-case-catalog--folder-walkthroughs)
- [6.1 Housekeeping - common endpoints](#61-housekeeping---common-endpoints)
- - [6.2 HTTPS server (TLS Offload, WAF, Maps, Caching, Health Checks)](#62-https-server-tls-offload-waf-maps-caching-health-checks)
- - [6.3 ACME Protocol (Automated TLS Certificates)](#63-acme-protocol-automated-tls-certificates)
+ - [6.2 HTTPS server](#62-https-server)
+ - [6.3 ACME Protocol](#63-acme-protocol)
- [6.4 HTTP Headers Manipulation](#64-http-headers-manipulation)
- [6.5 JWT Client Authentication](#65-jwt-client-authentication)
- - [6.6 JWT Client Authentication and Authorization (RBAC)](#66-jwt-client-authentication-and-authorization-rbac)
- - [6.7 mTLS Client Authentication (PKI, CRL, OCSP, Stapling)](#67-mtls-client-authentication-pki-crl-ocsp-stapling)
- - [6.8 OIDC Client Authentication (Per-Location & Per-Server)](#68-oidc-client-authentication-per-location--per-server)
- - [6.9 Server-side and Source of Truth Authentication](#69-server-side-and-source-of-truth-authentication)
- - [6.10 NGINX Javascript (njs)](#610-nginx-javascript-njs)
- - [6.11 Stream server (Layer 4 UDP/TCP & TLS Termination)](#611-stream-server-layer-4-udptcp--tls-termination)
- - [6.12 F5 WAF for NGINX (Policies, Tags & Custom Log Profiles)](#612-f5-waf-for-nginx-policies-tags--custom-log-profiles)
- - [6.13 API Gateway (APIs.guru, Open-Meteo, Petstore v3)](#613-api-gateway-apisguru-open-meteo-petstore-v3)
- - [6.14 CRUD automation (Granular `PATCH` Operations)](#614-crud-automation-granular-patch-operations)
- - [6.15 Asynchronous configuration publish (`?async=true`)](#615-asynchronous-configuration-publish-asynctrue)
- - [6.16 GitOps autosync (`synctime > 0`)](#616-gitops-autosync-synctime--0)
+ - [6.6 JWT Client Authentication and Authorization](#66-jwt-client-authentication-and-authorization)
+ - [6.7 mTLS Client Authentication](#67-mtls-client-authentication)
+ - [6.8 OIDC Client Authentication](#68-oidc-client-authentication)
+ - [6.9 Server-side and source of truth authentication](#69-server-side-and-source-of-truth-authentication)
+ - [6.10 NGINX Javascript](#610-nginx-javascript)
+ - [6.11 Stream server](#611-stream-server)
+ - [6.12 F5 WAF for NGINX](#612-f5-waf-for-nginx)
+ - [6.13 API Gateway](#613-api-gateway)
+ - [6.14 CRUD automation](#614-crud-automation)
+ - [6.15 Asynchronous configuration publish](#615-asynchronous-configuration-publish)
+ - [6.16 GitOps autosync](#616-gitops-autosync)
7. [Automated Test Scripts, Variable Chaining & Newman CLI](#7-automated-test-scripts-variable-chaining--newman-cli)
8. [Troubleshooting](#8-troubleshooting)
---
-## 1. Overview & v5.7 Architecture
+## 1. Overview & Architecture
-The **NGINX Declarative API v5.7** translates a single high-level JSON declaration (`ConfigDeclaration`) into validated, production-ready NGINX Plus configurations, auxiliary assets (TLS certificates/keys, JWKS, njs scripts, F5 WAF policies, Redocly developer portals, Backstage catalog manifests), and deploys them to your choice of control plane:
+The **NGINX Declarative API** translates a single high-level JSON declaration (`output` + `declaration`) into validated NGINX Plus configurations and auxiliary assets (TLS certificates/keys, JWKS, njs scripts, F5 WAF policies, Redocly developer portals, Backstage catalog manifests), and deploys them to your chosen control plane:
```
+-------------------------------------------------------------------+
| Postman / CI-CD / GitOps Client |
-| POST / PATCH / GET / DELETE http://{{ncg_host}}:5000/v5.7 |
+| POST / PATCH / GET / DELETE http://{{ncg_host}}:5000/v5.7 |
+---------------------------------+---------------------------------+
|
v
@@ -49,7 +49,7 @@ The **NGINX Declarative API v5.7** translates a single high-level JSON declarati
| - Pydantic v5.7 Schema Validation & JSON Schema Introspection |
| - Incremental Declaration Patcher (CRUD by object name) |
| - OpenAPI 3.0 -> NGINX API Gateway & Redocly/Backstage Builder |
-| - Background GitOps Autosync Worker & Redis Async Queue |
+| - Background GitOps Autosync Worker & Async Submission Queue |
+-----------------+-------------------------------+-----------------+
| |
output.type: "nms" output.type: "nginxone"
@@ -61,77 +61,76 @@ The **NGINX Declarative API v5.7** translates a single high-level JSON declarati
+---------------------------------+ +-------------------------------+
```
-The collection is organized under `v5.7` into two mirrored top-level control-plane folders with **100% feature parity**:
-- **`v5.7 / NGINX Instance Manager`** (`output.type: "nms"`)
-- **`v5.7 / NGINX One Console`** (`output.type: "nginxone"`)
-
---
-## 2. Summary of Collection Enhancements & Fixes
-
-Compared to the upstream `contrib/postman/NGINX Declarative API.postman_collection.json`, this v5.7 collection introduces the following fixes and improvements:
-
-1. **Fixed Upstream v5.7 Schema Validation Failures**:
- - Upgraded `NGINX One Console / API Gateway / APIs.guru / ... local OpenAPI schema` and `... + moesif` from legacy v5.6 schema paths (`declaration.http.authentication` / `declaration.http.authorization`) to v5.7 top-level `declaration.authentication` and `declaration.authorization` with location-scoped `apigateway.authentication.enforceOnPaths`.
- - Fixed `NGINX One Console / API Gateway / Petstore API / ... + WAF no log` where `log.access` and `log.error` were raw strings instead of `{"destination": "..."}` objects.
- - Fixed `NGINX One Console / API Gateway / Petstore API / ... + moesif + cache` where `output.type` was mistakenly set to `"nms"` instead of `"nginxone"`.
- - Fixed `Petstore 3 API Gateway RateLimit + JWT AuthN/AuthZ + backstage` in both control planes so `developer_portal` actually configures `"type": "backstage"` with `BackstageOptions` (`name`, `lifecycle`, `owner`, `system`) instead of duplicating `"type": "redocly"`.
- - Added `"log_profiles": []` to all `POST` declarations that define `declaration.http.policies` without custom log profiles, preventing a `TypeError: 'NoneType' object is not iterable` in `NIMNAPUtils.checkDeclarationPolicies` and `NGINXOneNAPUtils.checkDeclarationPolicies`.
-2. **Full Feature Parity Between Control Planes**:
- - Added all missing folders and requests to `NGINX One Console`: `API Gateway / Open-Meteo` (3 gateway deployments + 5 client test requests), `APIs.guru` YAML + WAF deployment and XSS test, `Petstore API` Moesif + WAF + Cache deployment, `GitOps autosync / F5 WAF for NGINX and GitOps`, and `HTTPS server / TLS Offload and F5 WAF for NGINX`.
-3. **Complete Coverage of v5.7 Schema Capabilities**:
- - Added **`Get v5.7 JSON Schema`** (`GET /v5.7/schema`) to `Housekeeping - common endpoints`.
- - Added **`Advanced HTTPS Reverse Proxy - Maps, Caching, JSON LogFormat & Active Health Checks`** demonstrating `.declaration.http.maps[]` (`exact`, `regex`, `iregex`), `.declaration.http.logformats[]` (`escape: "json"`), conditional access logging (`condition`), `.declaration.http.cache[]` + `.declaration.http.caching[]`, `.declaration.http.rate_limit[]`, `.declaration.http.snippet`, active `health_check`, `sticky` cookie affinity, and weighted/backup origins with `slow_start`.
- - Added **`Update F5 WAF custom security log profile`** (`PATCH`) demonstrating `.declaration.http.log_profiles[]` (`type: "app_protect"`, `format: "user-defined"`).
- - Added **`Create TLS-terminated TCP & UDP stream servers with custom log format`** demonstrating Layer 4 TCP TLS offload (`listen.tls`), `.declaration.layer4.logformats[]`, stream logging, and weighted/sticky Layer 4 upstreams.
- - Added **Steps 12, 13, and 14** to `CRUD automation` demonstrating v5.7 `DeclarationPatcher` upsert and delete-by-name operations on shared profiles (`resolvers`, `http.rate_limit`, `http.maps`, `http.logformats`, `http.cache`) followed by final state verification.
-4. **Modern Postman Test Scripts & Built-In Environment Variables**:
- - Replaced deprecated `tests[...]` scripts with modern `pm.test()` / `pm.expect()` assertions across **all 180 requests** (90 per control plane: 34 `POST`, 20 `PATCH`, 11 `GET`, 2 `DELETE`, and 23 data-plane client requests).
- - Embedded **24 documented Collection Variables** (including parameterized JWT tokens and data-plane URLs) so the collection works out-of-the-box without requiring a separate environment file.
+## 2. Collection Layout & Version Summary
+
+The collection (`NGINX Declarative API.postman_collection.json`) contains **127 folders** and **449 requests** (`195 POST`, `140 GET`, `102 PATCH`, `12 DELETE`) organized into three top-level API version folders:
+
+| Version Folder | Subfolders | Requests | Control-Plane Branches & Coverage |
+| :--- | :---: | :---: | :--- |
+| **`v5.5`** | 37 | 124 | `NGINX Instance Manager` (65 requests across 16 feature folders, including `NGINX App Protect WAF` and WAF variants) and `NGINX One Console` (59 requests across 15 feature folders). |
+| **`v5.6`** | 41 | 141 | `NGINX Instance Manager` (74 requests across 16 feature folders, adding `F5 WAF for NGINX` and `API Gateway / APIs.guru`) and `NGINX One Console` (67 requests across 15 feature folders). |
+| **`v5.7`** *(default)* | 46 | 184 | **100% feature parity** between `NGINX Instance Manager` (`output.type: "nms"`) and `NGINX One Console` (`output.type: "nginxone"`): **92 requests per control plane** (**71** control-plane API calls: `38 POST`, `11 GET`, `20 PATCH`, `2 DELETE`; plus **21** data-plane client test requests: `18 GET`, `3 POST`), all with `pm.test()` scripts. |
+
+### Key Highlights in `v5.7`
+
+- **100% Control-Plane Parity**: Every feature folder and request in `v5.7 / NGINX Instance Manager` is mirrored identically in `v5.7 / NGINX One Console`.
+- **Full OpenAPI 3.0 `servers` Support (`API Gateway / Open-Meteo`)**: Showcases root `.servers[]` multiple upstreams, per-path `.paths..servers[]` upstreams, and OpenAPI server template `variables` (`default`, `enum`, `description`) in both root and path-level server definitions.
+- **Complete `v5.7` Feature Coverage**:
+ - `GET /{{ngc_api_version}}/schema` introspection in `Housekeeping - common endpoints`.
+ - **Advanced HTTPS Reverse Proxy**: `.declaration.http.maps[]`, JSON `.declaration.http.logformats[]`, conditional access logging, `.declaration.http.cache[]` + `.declaration.http.caching[]`, `.declaration.http.rate_limit[]`, `.declaration.http.snippet`, active `health_check`, `sticky` cookie affinity, and weighted/backup origins with `slow_start`.
+ - **F5 WAF Custom Security Log Profiles**: `PATCH` support for `.declaration.http.log_profiles[]` (`type: "app_protect"`, `format: "user-defined"`).
+ - **Layer 4 Stream TLS & Telemetry**: `listen.tls` on TCP stream servers, `.declaration.layer4.logformats[]`, weighted primary origins, and backup failover origins.
+ - **Extended CRUD Automation**: Incremental `PATCH` create/update/delete-by-name across HTTP, Layer 4, `resolvers`, `http.rate_limit`, `http.cache`, `http.maps`, and `http.logformats`.
+- **24 Built-In Collection Variables**: Parameterized endpoints, control-plane credentials, GitOps URLs, and sample JWT tokens work out-of-the-box without requiring a separate environment file.
+
+> [!NOTE]
+> All control-plane URLs across `v5.5`, `v5.6`, and `v5.7` use `{{ngc_api_version}}` (default: `v5.7`). Update `ngc_api_version` in Collection Variables if you run requests under `v5.5` or `v5.6`.
---
## 3. Quickstart Guide
### Prerequisites
-- **Postman Desktop or Web** (v10+ or v11+) or **Newman CLI**.
-- Running instance of the **NGINX Declarative API v5.7** container (`http://127.0.0.1:5000` by default) and Redis (for asynchronous mode).
-- Access to either **NGINX Instance Manager (NIM)** or **F5 Distributed Cloud / NGINX One Console**.
+- **Postman Desktop or Web** (or **Newman CLI**).
+- Running instance of the **NGINX Declarative API** (`http://127.0.0.1:5000` by default) and Redis (required for asynchronous submissions).
+- Access to **NGINX Instance Manager (NIM)** or **F5 Distributed Cloud / NGINX One Console**.
### Step 1: Import the Collection
1. Open Postman and click **Import**.
2. Select `NGINX Declarative API.postman_collection.json`.
-3. The collection **`NGINX Declarative API`** will appear in your workspace with all **24 Collection Variables** pre-configured.
+3. The collection **`NGINX Declarative API`** appears with all **24 Collection Variables** pre-configured.
### Step 2: Configure Your Control Plane Variables
-1. Click the top-level **`NGINX Declarative API`** collection in Postman and open the **Variables** tab.
+1. Select the top-level **`NGINX Declarative API`** collection and open the **Variables** tab.
2. Update the **Current Value** column for your environment:
- - **Declarative API endpoint**: `ncg_host` (default `127.0.0.1`), `ncg_port` (default `5000`).
+ - **Declarative API endpoint**: `ncg_host` (default `127.0.0.1`), `ncg_port` (default `5000`), `ngc_api_version` (default `v5.7`).
- **NGINX Plus R33+ License**: `nginx_license_token` and `nginx_reporting_server`.
- **For NGINX Instance Manager**: `nim_host`, `nim_username`, `nim_password`, `nim_instancegroup`.
- **For NGINX One Console**: `nginxone_url`, `nginxone_token`, `nginxone_namespace`, `nginxone_configsyncgroup`.
-3. Click **Save** (`Ctrl+S` / `Cmd+S`).
+3. Save the collection (`Ctrl+S` / `Cmd+S`).
### Step 3: Run Your First Use Case
1. Expand `v5.7 -> NGINX Instance Manager` (or `NGINX One Console`) -> `Housekeeping - common endpoints`.
-2. Send **`Get v5.7 JSON Schema`** (`GET /v5.7/schema`) to verify connectivity to the NGINX Declarative API service.
-3. Open any use-case folder (e.g., `HTTPS server -> TLS Offload`) and click **Send**.
-4. The post-response test script automatically validates `status.code === 0` and stores `status.configUid` into the `{{configUid}}` collection variable for subsequent `GET`, `PATCH`, and `DELETE` requests.
+2. Send **`Get v5.7 JSON Schema`** (`GET /{{ngc_api_version}}/schema`) to verify connectivity.
+3. Open any use-case folder (for example, `HTTPS server -> TLS Offload`) and click **Send**.
+4. The post-response test script validates the `200 OK` response and saves the returned `configUid` into `{{configUid}}` for subsequent `GET`, `PATCH`, and `DELETE` requests.
---
-## 4. Collection & Environment Variables Reference
+## 4. Collection Variables Reference
-All variables are embedded directly in the collection's `variable` array and can also be overridden by a Postman Environment if desired.
+All 24 variables are embedded in the collection's `variable` array and can also be overridden by a Postman Environment or Newman `--env-var` flags.
-| Variable | Default Value | Scope / Purpose |
+| Variable | Default Value | Description / Usage |
| :--- | :--- | :--- |
| `ncg_host` | `127.0.0.1` | Hostname or IP address of the NGINX Declarative API service. |
| `ncg_port` | `5000` | TCP port exposed by the NGINX Declarative API service. |
| `ngc_api_version` | `v5.7` | Target NGINX Declarative API version prefix (`v5.7`). |
-| `configUid` | *(auto-populated)* | Active configuration declaration UID captured automatically from `POST /v5.7/config` responses. |
-| `submissionUid1` | *(auto-populated)* | First asynchronous submission UID captured from `POST /v5.7/config?async=true`. |
-| `submissionUid2` | *(auto-populated)* | Second asynchronous submission UID captured from `PATCH /v5.7/config/{{configUid}}?async=true`. |
+| `configUid` | *(auto-populated)* | Active configuration declaration UID, captured automatically by synchronous `POST` / `PATCH` test scripts. |
+| `submissionUid1` | *(auto-populated)* | First asynchronous submission UID, captured by `2a. Publish application - echo test`. |
+| `submissionUid2` | *(auto-populated)* | Second asynchronous submission UID, captured by `3a. Publish application - random joke`. |
| `nim_host` | `https://nim.nginx.lab` | Base URL of the NGINX Instance Manager control plane (`output.nms.url`). |
| `nim_username` | `admin` | Username for NGINX Instance Manager Basic authentication (`output.nms.username`). |
| `nim_password` | `admin` | Password for NGINX Instance Manager Basic authentication (`output.nms.password`). |
@@ -142,170 +141,196 @@ All variables are embedded directly in the collection's `variable` array and can
| `nginxone_configsyncgroup` | `lab` | Target NGINX One Console Config Sync Group name (`output.nginxone.configsyncgroup`). |
| `nginx_license_token` | `your-nginx-plus-jwt-license` | NGINX Plus R33+ JWT license token (`output.license.token`). |
| `nginx_reporting_server` | `product.connect.nginx.com` | NGINX Plus usage reporting server hostname or IP (`output.license.endpoint`). |
-| `github_gitops_root` | `https://raw.githubusercontent.com/f5devcentral/NGINX-Declarative-API/refs/heads/main/contrib/examples` | Base URL for external GitOps Sources of Truth (OpenAPI specs, TLS certs/keys, WAF policies). |
-| `moesif_application_id` | `your-moesif-application-id` | Moesif Application ID for API analytics (`developer_portal.moesif.application_id`). |
-| `apigw_url` | `https://apigw.nginx.lab` | Data-plane base URL for API Gateway client test requests. |
-| `echo_app_url` | `http://echo.vm-blank.ie.ff.lan` | Data-plane base URL for the Echo test application. |
-| `randomjoke_app_url` | `http://randomjoke.vm-blank.ie.ff.lan` | Data-plane base URL for the Random Joke test application. |
-| `jwt_token_devops` | `eyJ0eXAiOiJKV1Qi...` | Sample HS256 JWT Bearer token with `roles: ["devops"]` claim (signed with `kid: "0001"`). |
-| `jwt_token_guest` | `eyJ0eXAiOiJKV1Qi...` | Sample HS256 JWT Bearer token with `roles: ["guest"]` claim (signed with `kid: "0001"`). |
-| `jwt_token_devops_guest` | `eyJ0eXAiOiJKV1Qi...` | Sample HS256 JWT Bearer token with `roles: ["devops", "guest"]` claims (signed with `kid: "0001"`). |
+| `github_gitops_root` | `https://raw.githubusercontent.com/f5devcentral/NGINX-Declarative-API/refs/heads/main/contrib/gitops-examples` | Base HTTP(S) URL for external GitOps Sources of Truth (OpenAPI specs, TLS certs/keys, WAF policies, JWKS). |
+| `moesif_application_id` | `your-moesif-application-id` | Moesif Application ID for API analytics (`apigateway.visibility[].moesif.application_id`). |
+| `apigw_url` | `https://apigw.nginx.lab` | Defined for API Gateway data-plane base URL reference (existing API Gateway test requests target `https://apigw.nginx.lab/...` directly). |
+| `echo_app_url` | `http://echo.vm-blank.ie.ff.lan` | Defined for Echo app data-plane reference (`v5.5`/`v5.6` async test requests target `http://echo.vm-blank.ie.ff.lan` directly). |
+| `randomjoke_app_url` | `http://randomjoke.vm-blank.ie.ff.lan` | Defined for Random Joke data-plane reference (`v5.5`/`v5.6` async test requests target `http://randomjoke.vm-blank.ie.ff.lan/random_joke` directly). |
+| `jwt_token_devops` | `eyJ0eXAiOiJKV1Qi...` | Sample HS256 JWT Bearer token with `roles: ["devops"]` claim (`kid: "0001"`). |
+| `jwt_token_guest` | `eyJ0eXAiOiJKV1Qi...` | Sample HS256 JWT Bearer token with `roles: ["guest"]` claim (`kid: "0001"`). |
+| `jwt_token_devops_guest` | `eyJ0eXAiOiJKV1Qi...` | Sample HS256 JWT Bearer token with dual `roles: ["devops", "guest"]` claims (`kid: "0001"`). |
---
## 5. API v5.7 Endpoints Reference
-| Method | Endpoint | Query Params | Success Code | Description |
+| Method | Endpoint | Asynchronous Mode | Success Code | Description |
| :--- | :--- | :--- | :--- | :--- |
-| `GET` | `/{{ngc_api_version}}/schema` | None | `200 OK` | Returns the full Pydantic / OpenAPI JSON Schema for v5.7 `ConfigDeclaration`. |
-| `POST` | `/{{ngc_api_version}}/config` | `async=true\|false` (default `false`) | `200 OK` (sync)
`202 Accepted` (async) | Validates, renders, and deploys a complete NGINX configuration declaration. Returns `status.configUid` (and `status.submissionUid` when asynchronous). |
-| `PATCH` | `/{{ngc_api_version}}/config/{{configUid}}` | `async=true\|false` (default `false`) | `200 OK` (sync)
`202 Accepted` (async) | Applies an incremental CRUD patch to an existing declaration identified by `configUid`. |
-| `GET` | `/{{ngc_api_version}}/config/{{configUid}}` | None | `200 OK` | Retrieves the full JSON declaration (`output` + `declaration`) currently stored for `configUid`. |
-| `GET` | `/{{ngc_api_version}}/config/{{configUid}}/status` | None | `200 OK` | Retrieves the latest deployment status (`code`, `message`, `details`, `configUid`, `submissionUid`). |
-| `GET` | `/{{ngc_api_version}}/config/{{configUid}}/submission/{{submissionUid}}` | None | `200 OK` | Retrieves the execution status of a specific asynchronous submission (`queued`, `running`, `succeeded`, or `failed`). |
-| `DELETE` | `/{{ngc_api_version}}/config/{{configUid}}` | None | `200 OK` | Deletes the stored declaration and stops any background GitOps autosync worker bound to `configUid`. |
+| `GET` | `/{{ngc_api_version}}/schema` | N/A | `200 OK` | Retrieves the OpenAPI / Pydantic JSON Schema for configuration declarations. |
+| `POST` | `/{{ngc_api_version}}/config` | `output.synchronous: true\|false` | `200 OK` (sync)
`202 Accepted` (async) | Validates, renders, and deploys a full NGINX configuration declaration, returning `configUid`. |
+| `PATCH` | `/{{ngc_api_version}}/config/{{configUid}}` | `output.synchronous: true\|false` | `200 OK` (sync)
`202 Accepted` (async) | Applies incremental CRUD updates to an active declaration identified by `configUid`. Returns `submissionUid` when `output.synchronous` is `false`. |
+| `GET` | `/{{ngc_api_version}}/config/{{configUid}}` | N/A | `200 OK` | Retrieves the stored JSON declaration (`output` and `declaration`) for `configUid`. |
+| `GET` | `/{{ngc_api_version}}/config/{{configUid}}/status` | N/A | `200 OK` | Retrieves the latest deployment status of a declaration. |
+| `GET` | `/{{ngc_api_version}}/config/{{configUid}}/submission/{{submissionUid}}` | N/A | `200 OK` | Retrieves the status of a specific asynchronous submission (`{{submissionUid1}}` / `{{submissionUid2}}`). |
+| `DELETE` | `/{{ngc_api_version}}/config/{{configUid}}` | N/A | `200 OK` | Deletes the stored declaration and stops any background GitOps autosync worker. |
---
-## 6. Use-Case Catalog & Folder Walkthroughs
+## 6. v5.7 Use-Case Catalog & Folder Walkthroughs
-Every folder below exists under **both** `v5.7 / NGINX Instance Manager` and `v5.7 / NGINX One Console`.
+All 16 folders below exist identically under both **`v5.7 / NGINX Instance Manager`** and **`v5.7 / NGINX One Console`** (listed in folder order as organized in the collection).
### 6.1 `Housekeeping - common endpoints`
-Core lifecycle management and schema introspection requests:
-1. **`Get v5.7 JSON Schema`** (`GET /v5.7/schema`) — Inspects the v5.7 JSON Schema definition.
-2. **`Clean NGINX configuration`** (`POST /v5.7/config`) — Pushes an empty declaration (containing only the `output` block) to wipe all active HTTP/Stream servers from the target Instance Group or Config Sync Group.
-3. **`Get declaration status`** (`GET /v5.7/config/{{configUid}}/status`) — Inspects the deployment status of the active `configUid`.
-4. **`Get declaration`** (`GET /v5.7/config/{{configUid}}`) — Retrieves the stored JSON declaration for `configUid`.
-5. **`Delete declaration`** (`DELETE /v5.7/config/{{configUid}}`) — Removes `configUid` from the state store and stops GitOps autosync threads.
-
-### 6.2 `HTTPS server` (TLS Offload, WAF, Maps, Caching, Health Checks)
-Demonstrates HTTPS reverse proxy deployments and advanced v5.7 HTTP traffic management:
-1. **`TLS Offload`** (`POST /v5.7/config`) — Deploys an HTTP/2 TLS 1.2/1.3 reverse proxy (`www.online-boutique.lan`) fetching its TLS certificate and private key from external GitOps URLs (`{{github_gitops_root}}/{{ngc_api_version}}/testcert.crt` and `testcert.key`).
-2. **`TLS Offload and F5 WAF for NGINX`** (`POST /v5.7/config`) — Extends the HTTPS reverse proxy with F5 WAF for NGINX (`ngx_http_app_protect_module`) enforcing the `production-policy` (`active_tag: "xss-blocked"`).
-3. **`Advanced HTTPS Reverse Proxy - Maps, Caching, JSON LogFormat & Active Health Checks`** (`POST /v5.7/config`) — Showcases all advanced v5.7 HTTP directives:
- - **Variable Mapping (`.declaration.http.maps[]`)**: Evaluates `$http_x_env` against `exact`, `regex`, and `iregex` rules to populate `$backend_pool_tier`.
- - **Custom JSON Log Format (`.declaration.http.logformats[]`)**: Defines `json_analytics` with `escape: "json"` and conditional access logging (`condition: "$status ~ ^[2345]"`).
- - **Response Caching (`.declaration.http.cache[]` & `.declaration.http.caching[]`)**: Configures a 1 GB disk cache (`catalog_disk_cache`) and caches `GET`/`HEAD` responses on `/catalog` (`200`/`301`/`302` for `10m`, `404` for `1m`).
+Core lifecycle management and schema introspection (**6 requests**):
+1. **`Get v5.7 JSON Schema`** (`GET /{{ngc_api_version}}/schema`) — Retrieves the v5.7 JSON Schema (`properties.output`, `properties.declaration`).
+2. **`Clean NGINX configuration`** (`POST /{{ngc_api_version}}/config`) — Pushes an empty declaration (only the `output` block) to clear active configurations.
+3. **`TLS Offload and F5 WAF for NGINX`** (`POST /{{ngc_api_version}}/config`) — Deploys a baseline HTTPS server protected by F5 WAF (`production-policy` with `"log_profiles": []`) for quick status/retrieval testing.
+4. **`Get declaration status`** (`GET /{{ngc_api_version}}/config/{{configUid}}/status`) — Queries the deployment status of `{{configUid}}`.
+5. **`Get declaration`** (`GET /{{ngc_api_version}}/config/{{configUid}}`) — Retrieves the stored declaration JSON (`output` and `declaration`).
+6. **`Delete declaration`** (`DELETE /{{ngc_api_version}}/config/{{configUid}}`) — Deletes `{{configUid}}` and stops any background GitOps autosync thread.
+
+### 6.2 `HTTPS server`
+HTTPS reverse proxy deployments with TLS offload, WAF, and advanced traffic management (**3 requests**):
+1. **`TLS Offload and F5 WAF for NGINX`** (`POST`) — Deploys an HTTP/2 TLS 1.2/1.3 reverse proxy (`www.online-boutique.lan`) fetching certificates from `{{github_gitops_root}}/{{ngc_api_version}}/` and enabling F5 WAF (`ngx_http_app_protect_module`, `production-policy`).
+2. **`TLS Offload`** (`POST`) — Minimal HTTP/2 TLS 1.2/1.3 reverse proxy fetching `testcert.crt` and `testcert.key` from GitOps URLs.
+3. **`Advanced HTTPS Reverse Proxy - Maps, Caching, JSON LogFormat & Active Health Checks`** (`POST`) — Combines advanced HTTP directives for `www.online-boutique.lan` and `shop.online-boutique.lan`:
+ - **Maps (`.declaration.http.maps[]`)**: Evaluates `$http_x_env` (`exact`, `regex`, `iregex`) into `$backend_pool_tier` and injects `X-Routed-Tier` and `X-Cache-Status` response headers.
+ - **JSON Log Format (`.declaration.http.logformats[]`)**: Defines `json_analytics` (`escape: "json"`) with conditional logging (`condition: "$status"`).
+ - **Caching (`.declaration.http.cache[]` & `.declaration.http.caching[]`)**: Configures disk cache zone `catalog_disk_cache` (`1g` max size) and caches `/catalog` (`200`/`301`/`302` for `10m`, `404` for `1m`).
- **Rate Limiting (`.declaration.http.rate_limit[]`)**: Enforces `50r/s` (`burst: 20`, HTTP `429`) on `/checkout`.
- - **Active Health Checks & Sticky Upstreams**: Enables NGINX Plus active health checks (`/healthz` every `5s`), `sticky` cookie session affinity (`boutique_srv_id`), weighted origins with `slow_start: "15s"`, and a `backup: true` failover node.
+ - **Active Health Checks & Sticky Upstreams**: Configures `health_check` (`/healthz` every `5s`), `sticky` cookie affinity (`boutique_srv_id`), weighted origins with `slow_start: "15s"`, and a `backup: true` node on `upstream_boutique_ha`.
-### 6.3 `ACME Protocol` (Automated TLS Certificates)
-- **`TLS Offload with ACME protocol`** (`POST /v5.7/config`) — Loads `ngx_http_acme_module`, defines an ACMEv2 issuer profile in `.declaration.http.acme_issuers[]` (pointing to a Pebble/Let's Encrypt directory URL with state path and account key), and binds `listen.tls.acme_issuer` on the HTTPS server for zero-touch certificate issuance and renewal.
+### 6.3 `ACME Protocol`
+- **`TLS Offload with ACME protocol`** (`POST`) — Loads `ngx_http_acme_module`, configures `.declaration.http.acme_issuers[]` (`ACME example issuer` with RSA-2048 key and trusted CA certificate), and references `listen.tls.acme_issuer` on `www.online-boutique.lan`.
### 6.4 `HTTP Headers Manipulation`
-Demonstrates progressive `POST` -> `PATCH` manipulation of request and response headers:
-1. **`Create test echo service`** (`POST /v5.7/config`) — Deploys a baseline HTTP reverse proxy fronting `echo.free.beeceptor.com`.
-2. **`Manipulate headers - server level`** (`PATCH /v5.7/config/{{configUid}}`) — Injects `X-Injected-Client-IP: $remote_addr` and `Host` toward the upstream (`headers.to_server.set`) and adds/deletes client response headers (`headers.to_client.add`, `headers.to_client.delete`) at the server level.
-3. **`Manipulate headers - location level`** (`PATCH /v5.7/config/{{configUid}}`) — Moves the header manipulation rules to the `/` location scope.
+Progressive `POST` -> `PATCH` HTTP header rewriting (**3 requests**):
+1. **`Create test echo service`** (`POST`) — Deploys baseline HTTP server `Test echo app` (`echo.vm-test.ie.ff.lan`).
+2. **`Manipulate headers - server level`** (`PATCH`) — Sets upstream request headers (`X-Injected-Client-IP`, `X-Injected-Echo-Test-Version`, `Host`), removes `User-Agent`, and adds/deletes/replaces client response headers (`X-Injected-Response-Status`, `vary`, `Server`) at the server level.
+3. **`Manipulate headers - location level`** (`PATCH`) — Moves the `to_server` and `to_client` header rules down to the `/` location scope.
### 6.5 `JWT Client Authentication`
-Demonstrates client JWT validation (`declaration.authentication.client` with `type: "jwt"`) and token extraction sources:
-1. **`JWT Client Authentication - local JWT key and Bearer token`** (`POST /v5.7/config`) — Defines 4 client JWT profiles and activates inline JWKS validation using standard `Authorization: Bearer` tokens.
-2. **`JWT secret fetched from URL`** (`PATCH /v5.7/config/{{configUid}}`) — Switches the location to a JWT profile that fetches its JWKS remotely (`http://192.168.2.5:20080/jwks.json`, `cachetime: 5`).
-3. **`JWT token in auth_token query string parameter`** (`PATCH /v5.7/config/{{configUid}}`) — Extracts the JWT from `?auth_token=...` (`token_location: "$arg_auth_token"`).
-4. **`JWT token in HTTP X-Auth-Token header`** (`PATCH /v5.7/config/{{configUid}}`) — Extracts the JWT from a custom request header (`token_location: "$http_x_auth_token"`).
+Client-side JWT verification (`.declaration.authentication.client[]` with `type: "jwt"`) across token extraction mechanisms (**4 requests**):
+1. **`JWT Client Authentication - local JWT key and Bearer token`** (`POST`) — Defines 4 JWT client profiles and activates inline JWKS validation using standard `Authorization: Bearer` tokens.
+2. **`JWT secret fetched from URL`** (`PATCH`) — Switches the location profile to fetch its JWKS remotely (`http://192.168.2.5:20080/jwks.json`, `cachetime: 5`).
+3. **`JWT token in auth_token query string parameter`** (`PATCH`) — Switches to query-parameter token extraction (`token_location: "$arg_auth_token"`).
+4. **`JWT token in HTTP X-Auth-Token header`** (`PATCH`) — Switches to custom header extraction (`token_location: "$http_x_auth_token"`).
-### 6.6 `JWT Client Authentication and Authorization` (RBAC)
-- **`JWT Client Authentication and Authorization`** (`POST /v5.7/config`) — Combines `.declaration.authentication.client[]` (`type: "jwt"`, `jwt_type: "signed"`) with `.declaration.authorization[]` (`type: "jwt"`) enforcing that the JWT `roles` claim matches the regex `~(devops)`, and injects `X-Injected-JWT-Group: $jwt_claim_roles` into the client response.
+### 6.6 `JWT Client Authentication and Authorization`
+- **`JWT Client Authentication and Authorization`** (`POST`) — Combines `.declaration.authentication.client[]` (`type: "jwt"`) with `.declaration.authorization[]` (`type: "jwt"`) requiring the `roles` claim to match `~(devops)` on `JWT AuthN and AuthZ test server` (`test.nginx.lab`).
-### 6.7 `mTLS Client Authentication` (PKI, CRL, OCSP, Stapling)
-- **`HTTPS server with mTLS, OCSP, SSL Stapling`** (`POST /v5.7/config`) — Configures mutual TLS client authentication (`listen.tls.authentication.client`) referencing `.declaration.authentication.client[]` (`type: "mtls"`) with inline Base64 PKI CA (`type: "pkica"`), Certificate Revocation List (`type: "crl"`), OCSP responder validation (`ocsp`), and OCSP stapling (`stapling`).
+### 6.7 `mTLS Client Authentication`
+- **`HTTPS server with mTLS, OCSP, SSL Stapling`** (`POST`) — Enables mutual TLS (`listen.tls.authentication.client`) on `vm-blank.ff.lan` using inline Base64 client certificates, trusted CA certificates, OCSP validation (`ocsp`), and SSL stapling (`stapling`).
-### 6.8 `OIDC Client Authentication` (Per-Location & Per-Server)
-1. **`OIDC Client Authentication - Per Location`** (`POST /v5.7/config`) — Configures OpenID Connect authentication (`type: "oidc"` against Keycloak) on a specific location (`locations[].authentication.client`).
-2. **`OIDC Client Authentication - Per Server`** (`POST /v5.7/config`) — Enforces OpenID Connect authentication across the entire virtual server (`servers[].authentication.client`).
+### 6.8 `OIDC Client Authentication`
+OpenID Connect Relying Party authentication (`type: "oidc"` against Keycloak) (**2 requests**):
+1. **`OIDC Client Authentication - Per Location`** (`POST`) — Attaches the `Keycloak authentication` profile to `locations[].authentication.client`.
+2. **`OIDC Client Authentication - Per Server`** (`POST`) — Enforces `Keycloak authentication` across the entire server (`servers[].authentication.client`).
### 6.9 `Server-side and source of truth authentication`
-Demonstrates `.declaration.authentication.server[]` profiles used both when NGINX proxies to protected upstreams and when the Declarative API fetches assets from private GitOps repositories:
-1. **`Bearer Token, Basic and HTTP header upstream authentication`** (`POST /v5.7/config`) — Defines `token` (`bearer` and custom `header: X-AUTH-TOKEN`) and `basic` server authentication profiles; uses `Bearer token-based authentication profile` for upstream requests and `Basic authentication profile` to authenticate the GitOps fetch of `testcert.crt`.
-2. **`mTLS upstream authentication`** (`POST /v5.7/config`) — Configures NGINX to authenticate itself to the backend upstream using a client TLS certificate and key (`type: "mtls"` in `.declaration.authentication.server[]`).
-
-### 6.10 `NGINX Javascript` (`njs`)
-- **`NGINX Javascript test`** (`POST /v5.7/config`) — Loads `ngx_http_js_module` and `ngx_stream_js_module`, defines Base64-encoded `.declaration.http.njs_profiles[]` (`njs_set_variable` and `njs_set_content`), evaluates `js_set` hooks at both `http` (`$httpVarSetByNjs`) and `server` (`$serverVarSetByNjs`) contexts, and serves synthetic content on `/generatecontent` via `js_content`.
-
-### 6.11 `Stream server` (Layer 4 UDP/TCP & TLS Termination)
-1. **`Create stream server`** (`POST /v5.7/config`) — Configures a Layer 4 UDP DNS load balancer (`listen.protocol: "udp"` on port `10053`) fronting `ns1.google.com:53` and `ns2.google.com:53`.
-2. **`Create TLS-terminated TCP & UDP stream servers with custom log format`** (`POST /v5.7/config`) — Configures both UDP DNS load balancing and a TLS-terminated TCP LDAPS load balancer (`listen.protocol: "tcp"`, `listen.tls` on port `10636`) with a custom stream log format (`.declaration.layer4.logformats[]`), stream access/error logs, `sticky` cookie affinity, weighted primary origins, and a backup origin.
-
-### 6.12 `F5 WAF for NGINX` (Policies, Tags & Custom Log Profiles)
-End-to-end lifecycle of F5 WAF for NGINX (`ngx_http_app_protect_module`) policies:
-1. **`Create initial NGINX configuration with F5 WAF for NGINX`** (`POST /v5.7/config`) — Deploys an HTTPS server protected by `production-policy` containing two version tags (`xss-blocked` and `xss-allowed`), initially activating `active_tag: "xss-blocked"`.
-2. **`Change active F5 WAF for NGINX policy`** (`PATCH /v5.7/config/{{configUid}}`) — Zero-downtime switch of `active_tag` from `"xss-blocked"` to `"xss-allowed"` via `PATCH`.
-3. **`Update F5 WAF custom security log profile`** (`PATCH /v5.7/config/{{configUid}}`) — Adds a custom `user-defined` JSON security log profile (`custom_json_sec_log`) to `.declaration.http.log_profiles[]` and binds it to the location's `app_protect.log` syslog target.
-4. **`Update TLS certificates`** (`PATCH /v5.7/config/{{configUid}}`) — Rotates `test_cert` and `test_key` in `.declaration.certificates[]` using inline Base64 PEM strings without touching the HTTP/WAF configuration.
-5. **`Disable F5 WAF for NGINX`** (`PATCH /v5.7/config/{{configUid}}`) — Disables `app_protect` on the `/` location via `PATCH`.
-
-### 6.13 `API Gateway` (`APIs.guru`, `Open-Meteo`, `Petstore API`)
-Automatically builds complete NGINX API Gateway configurations from OpenAPI 3.0 specifications (`loc.apigateway.openapi`):
-- **`APIs.guru`**:
- - Deploys the APIs.guru v2 OpenAPI specification from **inline JSON**, **external JSON URL**, **external JSON URL + Moesif analytics**, or **external YAML URL + F5 WAF (`owasp-top10`)**, complete with rate limiting, JWT AuthN/AuthZ, and Redocly developer portal.
- - Includes **`API Client test requests`** (`Metrics`, `Metrics - XSS Attack`, `Providers - no authentication`, `Providers - auth with "DevOps" token`, `Providers - auth with "Guest" token`, `Providers - auth with "DevOps" and "Guest" token`).
-- **`Open-Meteo`**:
- - Deploys the Open-Meteo YAML OpenAPI specification with **Redocly**, **Redocly + Moesif**, and **Redocly + F5 WAF (`owasp-top10`)**.
- - Includes **`Open-Meteo test requests`** testing unauthenticated, XSS, DevOps-authorized, Guest-forbidden, and dual-role requests.
-- **`Petstore API`**:
- - Deploys Swagger Petstore v3 across 7 progressive combinations:
- 1. `RateLimit + JWT AuthN/AuthZ + redocly`
- 2. `RateLimit + JWT AuthN/AuthZ + backstage` (returns generated Backstage `catalog-info.yaml` in `status.manifests[]`)
- 3. `RateLimit + JWT AuthN/AuthZ + redocly + moesif`
- 4. `RateLimit + JWT AuthN/AuthZ + redocly + moesif + cache`
- 5. `RateLimit + JWT AuthN/AuthZ + redocly + WAF`
- 6. `RateLimit + JWT AuthN/AuthZ + redocly + WAF + syslog`
- 7. `RateLimit + JWT AuthN/AuthZ + redocly + moesif + WAF + cache`
- - Includes 10 **`API Client test requests`** covering legitimate requests, LFI/XSS attacks, login RBAC checks, and `POST /pet/1/uploadImage` RBAC checks.
-
-### 6.14 `CRUD automation` (Granular `PATCH` Operations)
-Demonstrates a 14-step incremental infrastructure-as-code pipeline using `PATCH /v5.7/config/{{configUid}}`:
-1. **`1. Initialize configuration`** (`POST`) — Initializes an empty declaration and captures `{{configUid}}`.
-2. **`2. Create upstream for echo service`** (`PATCH`) — Adds `echo_upstream` to `http.upstreams`.
-3. **`3. Create server for echo service`** (`PATCH`) — Adds `Echo service` to `http.servers`.
-4. **`4. Create upstream for randomjoke service`** (`PATCH`) — Adds `randomjoke_upstream` to `http.upstreams`.
-5. **`5. Create server for randomjoke service`** (`PATCH`) — Adds `Random Joke service` to `http.servers`.
-6. **`6. Update server for randomjoke service`** (`PATCH`) — Updates `Random Joke service` by adding `/random_joke` location and custom headers.
-7. **`7. Add stream service and upstream - DNS load balancer`** (`PATCH`) — Adds `DNS Load Balancer` and `google_DNS_upstream` to `.declaration.layer4`.
-8. **`8. Delete echo server`** (`PATCH`) — Deletes `Echo service` from `http.servers` by passing `{"name": "Echo service"}` only.
-9. **`9. Delete echo upstream`** (`PATCH`) — Deletes `echo_upstream` from `http.upstreams` by name.
-10. **`10. Delete randomjoke service`** (`PATCH`) — Deletes both `Random Joke service` and `randomjoke_upstream` in one `PATCH`.
-11. **`11. Delete DNS load balancer`** (`PATCH`) — Deletes `DNS Load Balancer` and `google_DNS_upstream` from `.declaration.layer4` by name.
-12. **`12. Patch shared profiles (resolvers, rate_limit, maps, logformats)`** (`PATCH`) — Upserts named objects into `resolvers`, `http.rate_limit`, `http.maps`, `http.logformats`, and `http.cache`.
-13. **`13. Update resolvers & rate_limit and delete cache profile`** (`PATCH`) — Updates `Cloudflare_DNS` and `crud_dynamic_ratelimit` in place and deletes `crud_temp_cache` from `http.cache` by passing `{"name": "crud_temp_cache"}`.
-14. **`14. Get final declaration`** (`GET`) — Verifies the merged declaration state.
-
-### 6.15 `Asynchronous configuration publish` (`?async=true`)
-Demonstrates non-blocking Redis-backed queued deployments:
-1. **`1. Initialize configuration`** (`POST /v5.7/config`) — Synchronous initialization capturing `{{configUid}}`.
-2. **`2. Asynchronously create echo and randomjoke services`** (`POST /v5.7/config?async=true`) — Returns `202 Accepted` immediately and saves `{{submissionUid1}}`.
-3. **`3. Asynchronously update randomjoke service`** (`PATCH /v5.7/config/{{configUid}}?async=true`) — Queues an update on the same `{{configUid}}` and saves `{{submissionUid2}}`.
-4. **`4. Get first submission status`** (`GET /v5.7/config/{{configUid}}/submission/{{submissionUid1}}`) — Polls completion of the first submission.
-5. **`5. Get second submission status`** (`GET /v5.7/config/{{configUid}}/submission/{{submissionUid2}}`) — Polls completion of the second submission.
-6. **`6. Test application - echo test`** & **`7. Test application - random joke`** — Data-plane verification requests.
-
-### 6.16 `GitOps autosync` (`synctime > 0`)
-Demonstrates autonomous drift detection and reconciliation (`synctime: 5` seconds):
-1. **`NGINX Plus and GitOps`** (`POST /v5.7/config`) — Deploys an HTTPS reverse proxy whose certificates are fetched from `{{github_gitops_root}}` and checked for changes every 5 seconds.
-2. **`F5 WAF for NGINX and GitOps`** (`POST /v5.7/config`) — Adds continuous GitOps synchronization of F5 WAF policy definitions (`nap-policy-xss-blocked.json` and `nap-policy-xss-allowed.json`).
-3. **`Get declaration status`**, **`Get declaration`**, and **`Delete declaration`** — Monitors background sync status and terminates the autosync thread when finished.
+Upstream and GitOps Source-of-Truth authentication using `.declaration.authentication.server[]` (**2 requests**):
+1. **`Bearer Token, Basic and HTTP header upstream authentication`** (`POST`) — Defines three `type: "token"` profiles (`bearer`, custom `header` `X-AUTH-TOKEN`, and `basic`), authenticating upstream requests with Bearer token and fetching `testcert.crt` from GitOps using the Basic auth profile.
+2. **`mTLS upstream authentication`** (`POST`) — Defines a `type: "mtls"` server profile with `client_cert` / `client_key` to authenticate NGINX Plus toward the upstream backend.
+
+### 6.10 `NGINX Javascript`
+- **`NGINX Javascript test`** (`POST`) — Loads `ngx_http_js_module` and `ngx_stream_js_module`, defines `.declaration.http.njs_profiles[]` (`njs_set_variable` and `njs_set_content`), evaluates `js_set` (`$httpVarSetByNjs`) at the HTTP level, and binds `js_content` (`njsSetContent`) to a location on `njs-test.vm-test.ie.ff.lan`.
+
+### 6.11 `Stream server`
+Layer 4 TCP and UDP load balancing (`.declaration.layer4`) (**2 requests**):
+1. **`Create stream server`** (`POST`) — Configures a UDP DNS load balancer (`DNS Load Balancer` listening on port `10053`, `protocol: "udp"`) fronting `ns1.google.com:53` and `ns2.google.com:53`.
+2. **`Create TLS-terminated TCP & UDP stream servers with custom log format`** (`POST`) — Defines a stream log format (`stream_telemetry` in `.declaration.layer4.logformats[]`), a weighted UDP DNS load balancer (`0.0.0.0:10053`), and a TLS-terminated TCP LDAPS load balancer (`0.0.0.0:10636`, `listen.tls`) with weighted primary and `backup: true` origins.
+
+### 6.12 `F5 WAF for NGINX`
+End-to-end F5 WAF for NGINX (`ngx_http_app_protect_module`) policy and logging lifecycle (**5 requests**):
+1. **`Create initial NGINX configuration with F5 WAF for NGINX`** (`POST`) — Deploys `production-policy` (with tags `xss-blocked` and `xss-allowed`, `active_tag: "xss-blocked"`) alongside `custom_waf_log_profile`.
+2. **`Change active F5 WAF for NGINX policy`** (`PATCH`) — Switches `active_tag` from `"xss-blocked"` to `"xss-allowed"`.
+3. **`Update F5 WAF custom security log profile`** (`PATCH`) — Defines `custom_json_sec_log` (`format: "user-defined"`, JSON format string) in `.declaration.http.log_profiles[]` and binds it to the `/` location's `app_protect.log` syslog target.
+4. **`Update TLS certificates`** (`PATCH`) — Updates `test_cert` and `test_key` in `.declaration.certificates[]` using inline Base64 PEM strings.
+5. **`Disable F5 WAF for NGINX`** (`PATCH`) — Disables `app_protect` (`enabled: false`) on the `/` location.
+
+### 6.13 `API Gateway`
+Generates complete NGINX API Gateway configurations from OpenAPI 3.0 specifications (`apigateway.openapi_schema.content`) across three API catalogs (**16 deployment `POST` requests + 21 data-plane client test requests per control plane**):
+
+- **`APIs.guru`** (`4` deployment requests + `6` test requests in `API Client test requests`):
+ - Deployment variants using `https://api.apis.guru/v2/openapi.yaml` (or an inline Base64-encoded schema in **`local OpenAPI schema`**):
+ 1. `APIGuru API Gateway RateLimit + JWT AuthN/AuthZ + redocly - YAML OpenAPI schema`
+ 2. `APIGuru API Gateway RateLimit + JWT AuthN/AuthZ + redocly + WAF - YAML OpenAPI schema`
+ 3. `APIGuru API Gateway RateLimit + JWT AuthN/AuthZ + redocly - local OpenAPI schema`
+ 4. `APIGuru API Gateway RateLimit + JWT AuthN/AuthZ + redocly + moesif`
+ - Client tests (`GET`): `Metrics`, `Metrics - XSS Attack`, and `Providers` (no auth -> `401`, DevOps token -> `200`/`429`, Guest token -> `403`, DevOps + Guest token -> `200`/`429`).
+
+- **`Open-Meteo`** (`6` deployment requests + `5` test requests in `Open-Meteo test requests`):
+ - Baseline Open-Meteo YAML (`https://raw.githubusercontent.com/open-meteo/open-meteo/refs/heads/main/openapi/forecast.yml`) variants:
+ 1. `Open-Meteo API Gateway RateLimit + JWT AuthN/AuthZ + redocly - YAML OpenAPI schema`
+ 2. `Open-Meteo API Gateway RateLimit + JWT AuthN/AuthZ + redocly + WAF - YAML OpenAPI schema`
+ 3. `Open-Meteo API Gateway RateLimit + JWT AuthN/AuthZ + redocly + moesif`
+ - **OpenAPI 3.0 `servers` Specification Showcase** (inline Base64 YAML schemas):
+ 4. `OpenAPI Servers - Root Multiple Servers (.servers[])` — Defines multiple root `.servers[].url` targets (`https://api.open-meteo.com`, `https://customer-api.open-meteo.com`) to build a multi-server NGINX upstream.
+ 5. `OpenAPI Servers - Per-Path Upstream Servers (.paths..servers[])` — Routes `/v1/status` via the default `api_gateway.server_url` upstream while `/v1/forecast` defines its own `.paths./v1/forecast.servers[]` upstream group.
+ 6. `OpenAPI Servers - Server Variables (.servers[].variables & .paths..servers[].variables)` — Demonstrates OpenAPI template variables (`{username}`, `{port}`, `{basePath}`, `{sub}`, `{backup_sub}`) with `default`, `enum`, and `description` in both root `.servers[]` and path `.paths./v1/forecast.servers[]`.
+ - Client tests (`GET`): Forecast no-auth (`401`), XSS attack (`200`/`400`/`403`), DevOps token (`200`/`429`), Guest token (`403`), and DevOps + Guest token (`200`/`429`).
+
+- **`Petstore API`** (`6` deployment requests + `10` test requests in `API Client test requests`):
+ - Swagger Petstore v3 (`https://petstore3.swagger.io/api/v3/openapi.json`) deployment combinations:
+ 1. `Petstore 3 API Gateway RateLimit + JWT AuthN/AuthZ + redocly`
+ 2. `Petstore 3 API Gateway RateLimit + JWT AuthN/AuthZ + backstage` *(configures `developer_portal.type: "backstage"` with `name`, `lifecycle`, `owner`, and `system`)*
+ 3. `Petstore 3 API Gateway RateLimit + JWT AuthN/AuthZ + redocly + moesif`
+ 4. `Petstore 3 API Gateway RateLimit + JWT AuthN/AuthZ + redocly + WAF`
+ 5. `Petstore 3 API Gateway RateLimit + JWT AuthN/AuthZ + redocly + WAF + syslog` *(binds `secops_dashboard` log profile and syslog targets)*
+ 6. `Petstore 3 API Gateway RateLimit + JWT AuthN/AuthZ + redocly + moesif + WAF + cache` *(adds `.declaration.http.cache[]` `"10m cache"`)*
+ - Client tests (`7 GET`, `3 POST`): Store inventory (legitimate, `/etc/passwd` query injection, XSS attack), `/user/login` RBAC matrix (no auth, DevOps, Guest, DevOps+Guest), and `POST /pet/1/uploadImage` binary upload RBAC checks.
+
+### 6.14 `CRUD automation`
+Incremental create, update, and delete-by-name workflow via `PATCH /{{ngc_api_version}}/config/{{configUid}}` (**11 requests**):
+1. **`Create initial NGINX configuration`** (`POST`) — Creates `HTTP test application` and `test_upstream`.
+2. **`Update HTTP upstream`** (`PATCH`) — Scales `test_upstream` to 5 origin servers (`10.0.0.1`–`10.0.0.5`).
+3. **`Modify and add HTTP upstream`** (`PATCH`) — Modifies `test_upstream` and adds `test_upstream_added`.
+4. **`Add stream server and upstream`** (`PATCH`) — Adds Layer 4 `TCP_15432_service` and `TCP_15432_upstream`.
+5. **`Remove HTTP server and upstream`** (`PATCH`) — Deletes `HTTP test application` and `test_upstream_added` by name.
+6. **`Add Stream server and upstream`** (`PATCH`) — Adds Layer 4 `TCP_10053_service` and `TCP_10053_upstream`.
+7. **`Remove stream server and upstream #1`** (`PATCH`) — Deletes `TCP_10053_service` and `TCP_10053_upstream` by name.
+8. **`Remove stream server and upstream #2`** (`PATCH`) — Deletes `TCP_15432_service` and `TCP_15432_upstream` by name.
+9. **`Patch shared profiles (resolvers, rate_limit, cache, maps, logformats)`** (`PATCH`) — Upserts `Cloudflare_DNS` (`resolvers`), `crud_dynamic_ratelimit` (`http.rate_limit`), `crud_disk_cache` (`http.cache`), a map rule (`http.maps`), and `crud_compact_log` (`http.logformats`).
+10. **`Update resolvers & rate_limit and delete cache profile`** (`PATCH`) — Updates `Cloudflare_DNS` and `crud_dynamic_ratelimit` in place and deletes `crud_disk_cache` by passing `{"name": "crud_disk_cache"}`.
+11. **`Get final declaration`** (`GET`) — Retrieves and verifies the merged declaration (`output` + `declaration`).
+
+### 6.15 `Asynchronous configuration publish`
+Non-blocking deployments using `output.synchronous: false` and submission polling (**8 requests**):
+1. **`1. Initialize configuration`** (`POST /{{ngc_api_version}}/config`) — Synchronous baseline initialization, capturing `{{configUid}}`.
+2. **`1a. Get declaration status`** (`GET /{{ngc_api_version}}/config/{{configUid}}/status`) — Checks initial status.
+3. **`1b. Get declaration`** (`GET /{{ngc_api_version}}/config/{{configUid}}`) — Reads the initial declaration.
+4. **`2a. Publish application - echo test`** (`PATCH /{{ngc_api_version}}/config/{{configUid}}` with `output.synchronous: false`) — Queues `Test echo app`, asserts `202 Accepted`, and stores `submissionUid` in `{{submissionUid1}}`.
+5. **`2b. Get asynchronous submission status - echo test`** (`GET /{{ngc_api_version}}/config/{{configUid}}/submission/{{submissionUid1}}`) — Checks status of the first submission.
+6. **`3a. Publish application - random joke`** (`PATCH /{{ngc_api_version}}/config/{{configUid}}` with `output.synchronous: false`) — Queues `Random joke application`, asserts `202 Accepted`, and stores `submissionUid` in `{{submissionUid2}}`.
+7. **`3b. Get asynchronous submission status - random joke`** (`GET /{{ngc_api_version}}/config/{{configUid}}/submission/{{submissionUid2}}`) — Checks status of the second submission.
+8. **`4. Get declaration`** (`GET /{{ngc_api_version}}/config/{{configUid}}`) — Retrieves the final merged declaration.
+
+### 6.16 `GitOps autosync`
+Continuous polling of external Sources of Truth (`output.nms.synctime: 5` / `output.nginxone.synctime: 5`) (**5 requests**):
+1. **`NGINX Plus and GitOps`** (`POST`) — Deploys `Online boutique HTTPS` with certificates polled from `{{github_gitops_root}}` every 5 seconds.
+2. **`F5 WAF for NGINX and GitOps`** (`POST`) — Enables continuous GitOps polling for both TLS certificates and `production-policy` F5 WAF JSON policies.
+3. **`Get declaration status`** (`GET /{{ngc_api_version}}/config/{{configUid}}/status`) — Inspects sync status.
+4. **`Get declaration`** (`GET /{{ngc_api_version}}/config/{{configUid}}`) — Reads the current declaration.
+5. **`Delete declaration`** (`DELETE /{{ngc_api_version}}/config/{{configUid}}`) — Removes `{{configUid}}` and stops the background autosync worker.
---
## 7. Automated Test Scripts, Variable Chaining & Newman CLI
-Every request in the collection includes an automated Postman **Test Script**:
-- **Synchronous `POST /v5.7/config`**: Asserts `200 OK`, verifies `status.code === 0`, and stores `status.configUid` into `{{configUid}}`. On Backstage requests, also asserts that `status.manifests[0]` contains a valid Backstage YAML manifest.
-- **Synchronous `PATCH /v5.7/config/{{configUid}}`**: Asserts `200 OK`, verifies `status.code === 0`, and confirms `status.configUid` matches `{{configUid}}`.
-- **Asynchronous `POST` / `PATCH` (`?async=true`)**: Asserts `202 Accepted` and stores `status.submissionUid` into `{{submissionUid1}}` or `{{submissionUid2}}`.
-- **Introspection & Lifecycle (`GET` / `DELETE`)**: Validates JSON Schema structure, deployment status payloads, stored declarations, and deletion confirmations.
+Every request under `v5.7` includes a `pm.test()` / `pm.expect()` post-response script:
+
+- **Synchronous `POST` / `PATCH`**: Asserts `200 OK`, checks that `configUid` is a non-empty string, and updates `pm.collectionVariables.set("configUid", respData.configUid)`.
+- **Asynchronous `PATCH` (`output.synchronous: false`)**: Asserts `202 Accepted`, verifies a non-empty `submissionUid`, and saves it to `submissionUid1` or `submissionUid2`.
+- **`GET /schema`**: Asserts `200 OK` and verifies `properties.output` and `properties.declaration`.
+- **`GET /config/{{configUid}}` & Status / Submission Endpoints**: Asserts `200 OK` (and `output` + `declaration` keys in `Get final declaration` and `Housekeeping / Get declaration`).
+- **`DELETE /config/{{configUid}}`**: Asserts `200 OK` (and `status.code === 200` in `Housekeeping / Delete declaration`).
+- **Data-Plane Client Test Requests**:
+ - Authorized requests: status in `[200, 201, 429]`.
+ - Unauthenticated requests: `401 Unauthorized`.
+ - Forbidden role (`Guest` token): `403 Forbidden`.
+ - WAF XSS / LFI probes: status in `[200, 400, 403]`.
### Running with Newman CLI
-You can run any workflow folder from the command line using [Newman](https://learning.postman.com/docs/collections/using-newman-cli/command-line-integration-with-newman/):
+
+You can execute workflows from the command line using [Newman](https://learning.postman.com/docs/collections/using-newman-cli/command-line-integration-with-newman/):
```bash
-# Run the complete CRUD Automation workflow on NGINX Instance Manager
+# Run the complete v5.7 NGINX Instance Manager suite (all 16 folders)
newman run "NGINX Declarative API.postman_collection.json" \
- --folder "CRUD automation" \
+ --folder "v5.7" \
--env-var "ncg_host=127.0.0.1" \
--env-var "ncg_port=5000" \
+ --env-var "ngc_api_version=v5.7" \
--env-var "nim_host=https://nim.nginx.lab" \
--env-var "nim_username=admin" \
--env-var "nim_password=admin" \
@@ -313,13 +338,16 @@ newman run "NGINX Declarative API.postman_collection.json" \
--insecure
```
+> [!TIP]
+> Because `v5.5`, `v5.6`, and `v5.7` all contain identically named subfolders (such as `CRUD automation` under both control planes), targeting a leaf folder by name in Newman runs the first matching folder; use uniquely targeted collection exports or Postman Collection Runner when running a single subfolder under a specific version and control plane.
+
---
## 8. Troubleshooting
| Symptom | Cause | Resolution |
| :--- | :--- | :--- |
-| `404 Not Found` on `GET`/`PATCH`/`DELETE /v5.7/config/{{configUid}}` | `{{configUid}}` is empty or the NGINX Declarative API container was restarted (clearing its state store). | Run a `POST /v5.7/config` request first so the test script populates `{{configUid}}`. |
-| `422 Unprocessable Entity` | Request payload does not match the v5.7 Pydantic model (`V5_7_NginxConfigDeclaration.py`). | Run `Get v5.7 JSON Schema` (`GET /v5.7/schema`) to inspect required fields and enum values. |
-| `500 Internal Server Error` on WAF requests | The F5 WAF policy compiler container is unreachable (`etc/config.yaml -> f5_waf.compiler`) or `ngx_http_app_protect_module` is not installed on target NGINX instances. | Verify that the WAF compiler URL is configured in `etc/config.yaml` and target instances have F5 WAF for NGINX installed. |
-| `500 Internal Server Error` on `?async=true` requests | Redis queue server is not running or unreachable. | Ensure Redis is running and configured in `etc/config.yaml` (`redis.host` / `redis.port`). |
+| `404 Not Found` on `GET`/`PATCH`/`DELETE /v5.7/config/{{configUid}}` | `{{configUid}}` is empty or the Declarative API service restarted (clearing in-memory/local state). | Run a synchronous `POST /{{ngc_api_version}}/config` request first so its test script populates `{{configUid}}`. |
+| `422 Unprocessable Entity` | Request payload does not satisfy the `v5.7` Pydantic schema (`V5_7_NginxConfigDeclaration.py`). | Run `Get v5.7 JSON Schema` (`GET /{{ngc_api_version}}/schema`) to verify required fields and valid enum values. |
+| `500 Internal Server Error` on WAF requests | The F5 WAF policy compiler is unreachable or `ngx_http_app_protect_module` is unavailable on target instances. | Verify the WAF compiler configuration in `etc/config.yaml` and confirm F5 WAF for NGINX is installed on the target data plane. |
+| `500 Internal Server Error` on `output.synchronous: false` requests | Redis queue backend is stopped or unreachable. | Ensure Redis is running and properly configured in `etc/config.yaml`. |
diff --git a/etc/config.yaml b/etc/config.yaml
index 8b3da76f..59df555b 100644
--- a/etc/config.yaml
+++ b/etc/config.yaml
@@ -7,7 +7,7 @@
# Main variables
main:
banner: "NGINX Declarative API"
- version: "5.7.1"
+ version: "5.7.2"
url: "https://github.com/f5devcentral/NGINX-Declarative-API"
log:
@@ -37,9 +37,11 @@ templates:
license: "nginx-conf/license-key.tmpl"
httpconf: "http.tmpl"
- apigwconf: "apigateway.tmpl"
- apigwmapsconf: "apigateway-maps.tmpl"
- apigwupstreamsconf: "apigateway-upstreams.tmpl"
+ apigwconf: "apigateway/apigateway.tmpl"
+ apigwmapsconf: "apigateway/apigateway-maps.tmpl"
+ apigwupstreamsconf: "apigateway/apigateway-upstreams.tmpl"
+ apigwproxyconf: "apigateway/apigateway-proxy.tmpl"
+ apigwbodyvalidatorjs: "apigateway/apigateway-body-validator.js.tmpl"
visibility_root: "visibility"
streamconf: "stream.tmpl"
configmap: "configmap.tmpl"
diff --git a/src/V5_7_ConfigBuilder.py b/src/V5_7_ConfigBuilder.py
index 96aa48cd..e7264533 100644
--- a/src/V5_7_ConfigBuilder.py
+++ b/src/V5_7_ConfigBuilder.py
@@ -17,6 +17,7 @@
import base64
import ipaddress
+import json
import re
from urllib.parse import urlparse
@@ -26,6 +27,7 @@
import v5_7.MiscUtils
import v5_7.NGINXOneOutput
import v5_7.NIMOutput
+import v5_7.OpenAPIParser
from jinja2 import Environment, FileSystemLoader
from NcgConfig import NcgConfig
@@ -63,6 +65,8 @@ def __init__(self, d: dict, apiversion: str):
self.all_auth_server_profiles = []
self.all_authz_client_profiles = []
self.all_njs_profiles = []
+ self.apigw_njs_profiles = []
+ self._used_apigw_proxy_locations = set()
self.all_acme_issuers = []
@@ -153,7 +157,8 @@ def _render_main_configs(ctx: ConfigBuildContext):
http_conf = ''
if declaration.get('http'):
http_conf = ctx.j2_env.get_template(NcgConfig.config['templates']['httpconf']).render(
- declaration=declaration, ncgconfig=NcgConfig.config)
+ declaration=declaration, ncgconfig=NcgConfig.config,
+ apigw_njs_profiles=ctx.apigw_njs_profiles)
stream_conf = ''
if declaration.get('layer4'):
@@ -818,49 +823,50 @@ def _process_api_gateway_provisioning(ctx: ConfigBuildContext, server, loc, enab
error, upstream_info = _resolve_api_gateway_upstream(ctx, server, loc, api_gateway_declaration)
if error is not None:
return error, None
- api_gateway_declaration['upstream'] = upstream_info
+ api_gateway_declaration['upstream'] = upstream_info['primary']
+ api_gateway_declaration['upstreams'] = upstream_info['upstreams']
_render_api_gateway_files(ctx, server, loc, api_gateway_declaration, enabled_visibility)
return None, openapi_schema_json
-def _resolve_api_gateway_upstream(ctx: ConfigBuildContext, server: dict, loc: dict, api_gateway_declaration: dict):
- """Derives the NGINX HTTP upstream metadata from the API Gateway destination server.
-
- Returns an (error, upstream_dict) tuple.
- """
- servers = api_gateway_declaration.get('servers') or []
- server_url = ((loc.get('apigateway') or {}).get('api_gateway') or {}).get('server_url') or ''
- server_url = server_url.strip()
-
- if servers and servers[0].get('url'):
- schema_url = servers[0]['url'].strip()
- if schema_url.lower().startswith(('http://', 'https://')):
- destination_server = schema_url
- elif schema_url == '/':
- destination_server = server_url.rstrip('/')
- elif server_url:
- destination_server = f"{server_url.rstrip('/')}/{schema_url.lstrip('/')}"
- else:
- destination_server = schema_url
- else:
- destination_server = server_url
-
- if not destination_server:
+def _normalize_gateway_url(url: str, server_url: str) -> str:
+ cleaned = (url or '').strip()
+ if not cleaned:
+ return server_url
+ if cleaned.lower().startswith(('http://', 'https://')):
+ return cleaned
+ if cleaned.startswith('//') and server_url:
+ parsed_base = urlparse(server_url)
+ if parsed_base.scheme:
+ return f"{parsed_base.scheme}:{cleaned}"
+ if cleaned in ('/', '.'):
+ return server_url.rstrip('/')
+ if server_url:
+ return f"{server_url.rstrip('/')}/{cleaned.lstrip('/')}"
+ return cleaned
+
+
+def _parse_upstream_server(ctx: ConfigBuildContext, server: dict, loc: dict, dest_url: str):
+ if not dest_url:
return _validation_error(
f"missing API Gateway destination server URL in location [{loc.get('uri', '')}]"), None
- parsed = urlparse(destination_server)
+ if '{' in dest_url or '}' in dest_url:
+ return _validation_error(
+ f"unresolved server variable in API Gateway destination server URL [{dest_url}] in location [{loc.get('uri', '')}]"), None
+
+ parsed = urlparse(dest_url)
scheme = parsed.scheme.lower()
if scheme not in ('http', 'https') or not parsed.hostname:
return _validation_error(
- f"invalid API Gateway destination server URL [{destination_server}] in location [{loc.get('uri', '')}]"), None
+ f"invalid API Gateway destination server URL [{dest_url}] in location [{loc.get('uri', '')}]"), None
try:
explicit_port = parsed.port
except ValueError:
return _validation_error(
- f"invalid port in API Gateway destination server URL [{destination_server}] in location [{loc.get('uri', '')}]"), None
+ f"invalid port in API Gateway destination server URL [{dest_url}] in location [{loc.get('uri', '')}]"), None
hostname = parsed.hostname
try:
@@ -881,35 +887,272 @@ def _resolve_api_gateway_upstream(ctx: ConfigBuildContext, server: dict, loc: di
server_resolver = server.get('resolver') or ''
http_resolver = ((ctx.d.get('declaration') or {}).get('http') or {}).get('resolver') or ''
- resolver = server_resolver if (server_resolver and not is_ip) else ''
resolve = (not is_ip) and bool(server_resolver or http_resolver)
- uri_slug = loc.get('uri', '').strip('/') or 'root'
- base_name = re.sub(r'[^a-zA-Z0-9_-]', '_', f"apigw_{server['name']}_{uri_slug}")
+ return None, {
+ 'destination_server': dest_url,
+ 'scheme': scheme,
+ 'hostname': hostname,
+ 'port': port,
+ 'origin': origin,
+ 'base_path': base_path,
+ 'host_header': host_header,
+ 'ssl_name': ssl_name,
+ 'resolve': resolve,
+ 'is_ip': is_ip,
+ }
+
+
+def _build_upstream_info(ctx: ConfigBuildContext, server: dict, loc: dict, base_name: str, dest_urls: list):
+ parsed_servers = []
+ for d_url in dest_urls:
+ err, s_info = _parse_upstream_server(ctx, server, loc, d_url)
+ if err is not None:
+ return err, None
+ parsed_servers.append(s_info)
+
+ if not parsed_servers:
+ return _validation_error(
+ f"missing API Gateway destination server URL in location [{loc.get('uri', '')}]"), None
+
+ sanitized_base_name = re.sub(r'[^a-zA-Z0-9_-]', '_', base_name)
used_names = set(ctx.all_http_upstreams) | ctx.all_apigw_upstreams
- upstream_name = base_name
+ upstream_name = sanitized_base_name
suffix = 2
while upstream_name in used_names:
- upstream_name = f"{base_name}_{suffix}"
+ upstream_name = f"{sanitized_base_name}_{suffix}"
suffix += 1
ctx.all_apigw_upstreams.add(upstream_name)
+ primary = parsed_servers[0]
+ server_resolver = server.get('resolver') or ''
+ any_needs_resolve = any(s['resolve'] for s in parsed_servers)
+ resolver = server_resolver if (server_resolver and any_needs_resolve) else ''
+
return None, {
'name': upstream_name,
- 'destination_server': destination_server,
- 'scheme': scheme,
- 'origin': origin,
- 'base_path': base_path,
- 'host_header': host_header,
- 'ssl_name': ssl_name,
+ 'destination_server': ', '.join(dest_urls),
+ 'scheme': primary['scheme'],
+ 'origin': primary['origin'],
+ 'base_path': primary['base_path'],
+ 'host_header': primary['host_header'],
+ 'ssl_name': primary['ssl_name'],
'resolver': resolver,
- 'resolve': resolve,
+ 'resolve': primary['resolve'],
+ 'servers': parsed_servers,
}
+def _resolve_server_urls_list(servers: list, fallback_url: str) -> list:
+ urls = []
+ for s in servers or []:
+ raw_u = v5_7.OpenAPIParser.OpenAPIParser._resolve_server_url(
+ s.get('url') or '', s.get('variables')
+ ).strip()
+ if raw_u:
+ urls.append(_normalize_gateway_url(raw_u, fallback_url))
+ return urls
+
+
+def _resolve_api_gateway_upstream(ctx: ConfigBuildContext, server: dict, loc: dict, api_gateway_declaration: dict):
+ """Derives the NGINX HTTP upstream metadata for an API Gateway, supporting root,
+ per-path, and per-operation servers with server variables and statistics collection.
+
+ Returns an (error, upstream_info_dict) tuple.
+ """
+ srv_name = server.get('name') or (server['names'][0] if server.get('names') else 'server')
+ server_header_name = server['names'][0] if server.get('names') else srv_name
+ uri_slug = loc.get('uri', '').strip('/') or 'root'
+ server_url = ((loc.get('apigateway') or {}).get('api_gateway') or {}).get('server_url') or ''
+ server_url = server_url.strip()
+
+ top_servers = api_gateway_declaration.get('servers') or []
+ default_dest_urls = _resolve_server_urls_list(top_servers, server_url)
+ if not default_dest_urls and server_url:
+ default_dest_urls.append(server_url)
+
+ path_fallback_server_url = server_url
+ if not path_fallback_server_url and default_dest_urls:
+ parsed_def = urlparse(default_dest_urls[0])
+ if parsed_def.scheme and parsed_def.netloc:
+ path_fallback_server_url = f"{parsed_def.scheme}://{parsed_def.netloc}"
+
+ def _has_server_urls(servers_list):
+ return any((s.get('url') or '').strip() for s in (servers_list or []))
+
+ paths = api_gateway_declaration.get('paths') or []
+ any_path_uses_default = (not paths) or any(
+ (not _has_server_urls(p.get('servers'))) and (
+ not p.get('methods') or any(not _has_server_urls(m.get('servers')) for m in p.get('methods'))
+ )
+ for p in paths
+ )
+
+ default_upstream = None
+ if default_dest_urls and (any_path_uses_default or bool(top_servers)):
+ default_base_name = f"apigw_{srv_name}_{uri_slug}"
+ err, default_upstream = _build_upstream_info(ctx, server, loc, default_base_name, default_dest_urls)
+ if err is not None:
+ return err, None
+ elif any_path_uses_default:
+ return _validation_error(
+ f"missing API Gateway destination server URL in location [{loc.get('uri', '')}]"), None
+
+ extra_upstreams = []
+ for p in paths:
+ methods = p.get('methods') or []
+ raw_path_slug = re.sub(r'[^a-zA-Z0-9_-]', '_', p.get('path', '').strip('/'))
+ path_slug = re.sub(r'_+', '_', raw_path_slug).strip('_') or 'root'
+
+ path_dest_urls = _resolve_server_urls_list(p.get('servers') or [], path_fallback_server_url)
+ any_method_uses_path = (not methods) or any(not _has_server_urls(m.get('servers')) for m in methods)
+
+ p_upstream = None
+ if path_dest_urls and any_method_uses_path:
+ path_base_name = f"apigw_{srv_name}_{uri_slug}_{path_slug}"
+ err, p_upstream = _build_upstream_info(ctx, server, loc, path_base_name, path_dest_urls)
+ if err is not None:
+ return err, None
+ extra_upstreams.append(p_upstream)
+
+ op_fallback_url = path_fallback_server_url
+ if not op_fallback_url and path_dest_urls:
+ parsed_path_def = urlparse(path_dest_urls[0])
+ if parsed_path_def.scheme and parsed_path_def.netloc:
+ op_fallback_url = f"{parsed_path_def.scheme}://{parsed_path_def.netloc}"
+
+ method_upstreams = []
+ for m in methods:
+ m_dest_urls = _resolve_server_urls_list(m.get('servers') or [], op_fallback_url)
+ if m_dest_urls:
+ m_name = m.get('method', '').lower()
+ m_base_name = f"apigw_{srv_name}_{uri_slug}_{path_slug}_{m_name}"
+ err, m_upstream = _build_upstream_info(ctx, server, loc, m_base_name, m_dest_urls)
+ if err is not None:
+ return err, None
+ m['upstream'] = m_upstream
+ method_upstreams.append(m_upstream)
+ extra_upstreams.append(m_upstream)
+ else:
+ m['upstream'] = None
+
+ base_path_upstream = p_upstream if p_upstream is not None else default_upstream
+ if method_upstreams and len(method_upstreams) == len(methods) and len(methods) == 1:
+ p['upstream'] = method_upstreams[0]
+ p['use_method_upstreams'] = False
+ elif method_upstreams:
+ for m in methods:
+ m['effective_upstream'] = m['upstream'] if m['upstream'] is not None else base_path_upstream
+ p['upstream'] = base_path_upstream if base_path_upstream is not None else method_upstreams[0]
+ p['use_method_upstreams'] = True
+ p['any_ssl_name'] = any(
+ bool((m['effective_upstream'] or {}).get('ssl_name')) for m in methods
+ ) or bool((p['upstream'] or {}).get('ssl_name'))
+ p['var_suffix'] = re.sub(
+ r'[^a-zA-Z0-9_]', '_',
+ f"{server_header_name}{loc.get('uri', '')}{p.get('path', '')}"
+ )
+ else:
+ p['upstream'] = base_path_upstream
+ p['use_method_upstreams'] = False
+
+ upstreams_to_render = []
+ if default_upstream is not None:
+ upstreams_to_render.append(default_upstream)
+ upstreams_to_render.extend(extra_upstreams)
+
+ primary_upstream = upstreams_to_render[0] if upstreams_to_render else default_upstream
+
+ return None, {
+ 'primary': primary_upstream,
+ 'upstreams': upstreams_to_render,
+ }
+
+
+def _prepare_request_body_schema_validation(ctx: ConfigBuildContext, server: dict, loc: dict, api_gateway_declaration: dict) -> bool:
+ """
+ Prepares per-path njs request body schema validation metadata and renders the
+ njs module into ctx.auxFiles when enforce_bodies is enabled and at least one
+ operation defines a resolvable request body schema.
+ """
+ api_gw_cfg = (loc.get('apigateway') or {}).get('api_gateway') or {}
+ if not api_gw_cfg.get('enforce_bodies', True):
+ return False
+
+ server_name = server['names'][0] if server.get('names') else server['name']
+ srv_slug = re.sub(r'[^a-zA-Z0-9_]', '_', server_name).strip('_') or 'server'
+ uri_slug = re.sub(r'[^a-zA-Z0-9_]', '_', loc.get('uri', '').strip('/')) or 'root'
+
+ path_rules = {}
+ for idx, path in enumerate(api_gateway_declaration.get('paths') or []):
+ method_rules = {}
+ for m in (path.get('methods') or []):
+ details = m.get('details') or {}
+ rb_schemas = details.get('requestBodySchemas') or {}
+ if rb_schemas:
+ method_upper = (m.get('method') or '').upper()
+ method_rules[method_upper] = {
+ 'required': bool(details.get('requestBodyRequired', False)),
+ 'allowedContentTypes': list(details.get('requestBodyContentType') or []),
+ 'schemas': rb_schemas,
+ }
+
+ if not method_rules:
+ path['body_validation_enabled'] = False
+ continue
+
+ raw_path_slug = re.sub(r'[^a-zA-Z0-9_]', '_', (path.get('path') or '').strip('/'))
+ path_slug = re.sub(r'_+', '_', raw_path_slug).strip('_') or 'root'
+ func_name = f"validate_req_body_{idx}_{path_slug}"
+
+ proxy_base = f"@apigw_proxy_{srv_slug}_{uri_slug}_{idx}_{path_slug}"
+ proxy_loc = proxy_base
+ suffix = 2
+ while proxy_loc in ctx._used_apigw_proxy_locations:
+ proxy_loc = f"{proxy_base}_{suffix}"
+ suffix += 1
+ ctx._used_apigw_proxy_locations.add(proxy_loc)
+
+ path['body_validation_enabled'] = True
+ path['body_validation_js_func'] = func_name
+ path['body_validation_proxy_location'] = proxy_loc
+ path_rules[func_name] = {
+ 'proxyLocation': proxy_loc,
+ 'methods': method_rules,
+ }
+
+ if not path_rules:
+ return False
+
+ base_profile = f"apigw_body_{srv_slug}_{uri_slug}"
+ used_profiles = set(ctx.all_njs_profiles) | set(ctx.apigw_njs_profiles)
+ njs_profile_name = base_profile
+ p_suffix = 2
+ while njs_profile_name in used_profiles:
+ njs_profile_name = f"{base_profile}_{p_suffix}"
+ p_suffix += 1
+
+ api_gateway_declaration['body_validation_njs_profile'] = njs_profile_name
+ ctx.apigw_njs_profiles.append(njs_profile_name)
+
+ js_template_name = NcgConfig.config['templates'].get('apigwbodyvalidatorjs', 'apigateway-body-validator.js.tmpl')
+ js_rendered = ctx.j2_env.get_template(js_template_name).render(
+ schema_defs_json=json.dumps(api_gateway_declaration.get('schema_defs') or {}, ensure_ascii=True),
+ path_rules_json=json.dumps(path_rules, ensure_ascii=True),
+ func_names=list(path_rules.keys()),
+ )
+ ctx.auxFiles['files'].append({
+ 'contents': _b64(js_rendered),
+ 'name': f"{NcgConfig.config['nms']['njs_dir']}/{njs_profile_name}.js",
+ })
+ return True
+
+
def _render_api_gateway_files(ctx: ConfigBuildContext, server, loc, api_gateway_declaration, enabled_visibility):
server_name = server['names'][0] if server.get('names') else server['name']
+ has_body_validation = _prepare_request_body_schema_validation(ctx, server, loc, api_gateway_declaration)
+
snippet = ctx.j2_env.get_template(NcgConfig.config['templates']['apigwconf']).render(
declaration=api_gateway_declaration, server=server_name,
enabledVisibility=enabled_visibility, ncgconfig=NcgConfig.config)
@@ -917,6 +1160,14 @@ def _render_api_gateway_files(ctx: ConfigBuildContext, server, loc, api_gateway_
'contents': _b64(snippet),
'name': f"{NcgConfig.config['nms']['apigw_dir']}/{server_name}{loc['uri']}.conf"})
+ if has_body_validation:
+ proxy_template_name = NcgConfig.config['templates'].get('apigwproxyconf', 'apigateway-proxy.tmpl')
+ proxy_snippet = ctx.j2_env.get_template(proxy_template_name).render(
+ declaration=api_gateway_declaration, server=server_name, ncgconfig=NcgConfig.config)
+ ctx.configFiles['files'].append({
+ 'contents': _b64(proxy_snippet),
+ 'name': f"{NcgConfig.config['nms']['apigw_dir']}/{server_name}{loc['uri']}_proxy.conf"})
+
maps_snippet = ctx.j2_env.get_template(NcgConfig.config['templates']['apigwmapsconf']).render(
declaration=api_gateway_declaration, server=server_name, ncgconfig=NcgConfig.config)
uri_for_filename = loc['uri'].replace('/', '_')
diff --git a/src/v5_7/APIGateway.py b/src/v5_7/APIGateway.py
index d1ddda6f..b7ca59a8 100644
--- a/src/v5_7/APIGateway.py
+++ b/src/v5_7/APIGateway.py
@@ -70,12 +70,14 @@ def createAPIGateway(locationDeclaration: dict, authProfiles: Authentication = {
return status, "", ""
raw_schema_content = schema_obj.get('content', '')
+ parsed_paths = apiSchema.paths()
apiGwDeclaration = {
'location': locationDeclaration,
'info': apiSchema.info(),
'servers': apiSchema.servers(),
- 'paths': apiSchema.paths(),
- 'version': apiSchema.version()
+ 'paths': parsed_paths,
+ 'version': apiSchema.version(),
+ 'schema_defs': apiSchema.request_body_schema_defs(parsed_paths),
}
return 200, apiGwDeclaration, raw_schema_content
\ No newline at end of file
diff --git a/src/v5_7/NGINXOneOutput.py b/src/v5_7/NGINXOneOutput.py
index 7d41bc5d..243fc294 100644
--- a/src/v5_7/NGINXOneOutput.py
+++ b/src/v5_7/NGINXOneOutput.py
@@ -193,11 +193,20 @@ def _build_rendered_config_files(
extensions=["jinja2_base64_filters.Base64Filters"]
)
+ modules = list(v5_7.MiscUtils.getDictKey(d, 'output.nginxone.modules') or [])
+ njs_dir = NcgConfig.config['nms']['njs_dir']
+ has_apigw_njs = any(
+ f.get('name', '').startswith(f"{njs_dir}/apigw_body_")
+ for f in (auxFiles or {}).get('files', [])
+ )
+ if has_apigw_njs and 'ngx_http_js_module' not in modules:
+ modules.append('ngx_http_js_module')
+
nginxMainConf = j2_env.get_template(NcgConfig.config['templates']['nginxmain']).render(
nginxconf={
'mainhttpfile': NcgConfig.config['nms']['staged_config_http_filename'],
'mainstreamfile': NcgConfig.config['nms']['staged_config_stream_filename'],
- 'modules': v5_7.MiscUtils.getDictKey(d, 'output.nginxone.modules'),
+ 'modules': modules,
'license': v5_7.MiscUtils.getDictKey(d, 'output.license')
},
d={'http': v5_7.MiscUtils.getDictKey(d, 'declaration.http')}
diff --git a/src/v5_7/NIMOutput.py b/src/v5_7/NIMOutput.py
index 1b6737bf..d8415af7 100644
--- a/src/v5_7/NIMOutput.py
+++ b/src/v5_7/NIMOutput.py
@@ -195,11 +195,20 @@ def _build_rendered_config_files(
extensions=["jinja2_base64_filters.Base64Filters"]
)
+ modules = list(v5_7.MiscUtils.getDictKey(d, 'output.nms.modules') or [])
+ njs_dir = NcgConfig.config['nms']['njs_dir']
+ has_apigw_njs = any(
+ f.get('name', '').startswith(f"{njs_dir}/apigw_body_")
+ for f in (auxFiles or {}).get('files', [])
+ )
+ if has_apigw_njs and 'ngx_http_js_module' not in modules:
+ modules.append('ngx_http_js_module')
+
nginxMainConf = j2_env.get_template(NcgConfig.config['templates']['nginxmain']).render(
nginxconf={
'mainhttpfile': NcgConfig.config['nms']['staged_config_http_filename'],
'mainstreamfile': NcgConfig.config['nms']['staged_config_stream_filename'],
- 'modules': v5_7.MiscUtils.getDictKey(d, 'output.nms.modules'),
+ 'modules': modules,
'license': v5_7.MiscUtils.getDictKey(d, 'output.license')
},
d={'http': v5_7.MiscUtils.getDictKey(d, 'declaration.http')}
diff --git a/src/v5_7/OpenAPIParser.py b/src/v5_7/OpenAPIParser.py
index 3d753108..040b3af9 100644
--- a/src/v5_7/OpenAPIParser.py
+++ b/src/v5_7/OpenAPIParser.py
@@ -2,7 +2,9 @@
OpenAPI schema parser support functions
"""
+import re
from typing import Dict, Any, List, Optional
+from urllib.parse import unquote
class OpenAPIParser:
@@ -10,6 +12,7 @@ class OpenAPIParser:
Parser for OpenAPI / Swagger specification dictionaries.
"""
httpMethods = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH']
+ _HTTP_TOKEN_RE = re.compile(r"^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$")
httpStatusCodes = [
# "000",
# "100", "101", "102", "103",
@@ -62,25 +65,125 @@ def info(self) -> Optional[Dict[str, Any]]:
"""
return self.openAPISchema.get('info')
- def servers(self) -> List[Dict[str, str]]:
+ @staticmethod
+ def _resolve_server_url(url: str, variables: Optional[Dict[str, Any]] = None) -> str:
+ """
+ Resolves server variable placeholders {var} in a server URL using their default values.
+
+ Args:
+ url (str): The raw server URL template.
+ variables (Optional[Dict[str, Any]]): Dictionary of Server Variable Objects.
+
+ Returns:
+ str: The resolved URL with variables substituted.
+ """
+ if not url:
+ return ""
+ if not variables or not isinstance(variables, dict):
+ return url
+
+ def _replace_var(match: re.Match) -> str:
+ var_name = match.group(1).strip()
+ if var_name in variables and isinstance(variables[var_name], dict):
+ var_obj = variables[var_name]
+ if 'default' in var_obj and var_obj['default'] is not None:
+ return str(var_obj['default'])
+ if 'enum' in var_obj and isinstance(var_obj['enum'], list) and var_obj['enum']:
+ return str(var_obj['enum'][0])
+ return match.group(0)
+
+ return re.sub(r'\{([^{}]+)\}', _replace_var, url)
+
+ def _parse_server(self, server: Dict[str, Any]) -> Dict[str, Any]:
+ """
+ Parses a single server definition and resolves server variables if present.
+
+ Args:
+ server (Dict[str, Any]): Server definition dictionary.
+
+ Returns:
+ Dict[str, Any]: Parsed server dictionary with resolved 'url' and optional fields.
+ """
+ raw_url = server.get('url', '')
+ variables = server.get('variables') if isinstance(server.get('variables'), dict) else None
+ resolved_url = self._resolve_server_url(raw_url, variables)
+ s: Dict[str, Any] = {'url': resolved_url}
+ if 'name' in server:
+ s['name'] = server['name']
+ if 'description' in server:
+ s['description'] = server['description']
+ if variables:
+ s['variables'] = variables
+ return s
+
+ @staticmethod
+ def _default_swagger_scheme(host: str) -> str:
+ """
+ Determines a fallback HTTP scheme when a Swagger 2.0 definition omits 'schemes'.
+ """
+ port_str = None
+ if host.startswith('['):
+ if ']:' in host:
+ port_str = host.rsplit(']:', 1)[1]
+ elif ':' in host:
+ port_str = host.rsplit(':', 1)[1]
+ return 'http' if (port_str and port_str != '443') else 'https'
+
+ def _swagger_servers(self) -> List[Dict[str, Any]]:
+ """
+ Synthesizes server entries from Swagger / OpenAPI 2.0 top-level
+ 'host', 'basePath', and 'schemes' fields.
+ """
+ raw_host = self.openAPISchema.get('host')
+ host = raw_host.strip() if isinstance(raw_host, str) else ''
+
+ raw_base_path = self.openAPISchema.get('basePath')
+ base_path_str = raw_base_path.strip().strip('/') if isinstance(raw_base_path, str) else ''
+ normalized_base_path = f"/{base_path_str}" if base_path_str else ''
+
+ if host:
+ raw_schemes = self.openAPISchema.get('schemes')
+ http_schemes = [
+ s.strip().lower() for s in raw_schemes
+ if isinstance(s, str) and s.strip().lower() in ('http', 'https')
+ ] if isinstance(raw_schemes, list) else []
+ scheme = http_schemes[0] if http_schemes else self._default_swagger_scheme(host)
+ return [{'url': f"{scheme}://{host}{normalized_base_path}"}]
+
+ if normalized_base_path:
+ return [{'url': normalized_base_path}]
+
+ return []
+
+ def servers(self) -> List[Dict[str, Any]]:
"""
Retrieves server definitions from the schema.
+ Supports OpenAPI 3.x 'servers' arrays as well as Swagger / OpenAPI 2.0
+ top-level 'host', 'basePath', and 'schemes' fields.
+
Returns:
- List[Dict[str, str]]: List of server dictionaries containing 'url' and optional 'description'.
+ List[Dict[str, Any]]: List of server dictionaries containing resolved 'url' and optional fields.
"""
all_servers = []
if 'servers' in self.openAPISchema and isinstance(self.openAPISchema['servers'], list):
for server in self.openAPISchema['servers']:
- s = {'url': server.get('url', '')}
- if 'description' in server:
- s['description'] = server['description']
- all_servers.append(s)
+ if isinstance(server, dict):
+ all_servers.append(self._parse_server(server))
+ if all_servers:
+ return all_servers
+
+ if 'swagger' in self.openAPISchema or 'host' in self.openAPISchema:
+ return self._swagger_servers()
+
return all_servers
def _parse_parameter(self, qsParam: Dict[str, Any]) -> Optional[Dict[str, Any]]:
"""
- Helper method to parse a single query string / path parameter dictionary.
+ Helper method to parse a single query string / path / header parameter dictionary.
+
+ Supports both OpenAPI 3.x ('parameter.schema') and Swagger / OpenAPI 2.0
+ (type/default/enum/items directly on the Parameter Object).
Args:
qsParam (Dict[str, Any]): Parameter definition dictionary.
@@ -98,58 +201,313 @@ def _parse_parameter(self, qsParam: Dict[str, Any]) -> Optional[Dict[str, Any]]:
'required': qsParam.get('required', False)
}
- param_schema = {}
+ param_schema: Dict[str, Any] = {}
+ schema_source: Optional[Dict[str, Any]] = None
if 'schema' in qsParam and isinstance(qsParam['schema'], dict):
- schema_obj = qsParam['schema']
- param_schema['type'] = schema_obj.get('type', '')
- param_schema['default'] = schema_obj.get('default', '')
- param_schema['enum'] = list(schema_obj.get('enum', [])) if 'enum' in schema_obj else []
+ schema_source = qsParam['schema']
+ elif any(k in qsParam for k in ('type', 'default', 'enum', 'items')):
+ schema_source = qsParam
+
+ if schema_source is not None:
+ items_obj = schema_source.get('items') if isinstance(schema_source.get('items'), dict) else {}
+ param_schema['type'] = schema_source.get('type', '')
+ param_schema['default'] = (
+ schema_source['default'] if 'default' in schema_source else items_obj.get('default', '')
+ )
+ raw_enum = schema_source['enum'] if 'enum' in schema_source else items_obj.get('enum')
+ param_schema['enum'] = list(raw_enum) if isinstance(raw_enum, list) else []
param['schema'] = param_schema
return param
- def _parse_method(self, method: str, methodInfo: Dict[str, Any]) -> Optional[Dict[str, Any]]:
+ def _effective_consumes(self, methodInfo: Dict[str, Any]) -> List[str]:
+ """
+ Returns the effective Swagger 2.0 'consumes' media types for an operation,
+ with operation-level 'consumes' overriding global document-level 'consumes'.
+ """
+ if 'consumes' in methodInfo:
+ raw_consumes = methodInfo.get('consumes')
+ else:
+ raw_consumes = self.openAPISchema.get('consumes')
+
+ if not isinstance(raw_consumes, list):
+ return []
+ return [ct for ct in raw_consumes if isinstance(ct, str) and ct]
+
+ @staticmethod
+ def _merge_parameters(
+ pathParameters: Optional[List[Dict[str, Any]]],
+ methodParameters: Optional[List[Dict[str, Any]]],
+ ) -> List[Dict[str, Any]]:
+ """
+ Merges path-level and operation-level parameters per OpenAPI rules,
+ allowing operation parameters to override matching (name, in) pairs.
+ """
+ merged: List[Dict[str, Any]] = []
+ seen = set()
+
+ for p in (methodParameters or []):
+ if isinstance(p, dict):
+ merged.append(p)
+ if 'name' in p:
+ seen.add((p.get('name'), str(p.get('in', '')).lower()))
+
+ for p in (pathParameters or []):
+ if isinstance(p, dict):
+ key = (p.get('name'), str(p.get('in', '')).lower()) if 'name' in p else None
+ if key is None or key not in seen:
+ merged.append(p)
+ if key is not None:
+ seen.add(key)
+
+ return merged
+
+ @staticmethod
+ def _unescape_json_pointer_token(token: str) -> str:
+ """Unescapes a single RFC 6901 JSON Pointer reference token."""
+ return unquote(token).replace('~1', '/').replace('~0', '~')
+
+ def _resolve_ref(self, ref: str, visited: Optional[set] = None) -> Optional[Any]:
+ """
+ Resolves a local JSON Pointer reference (e.g. '#/components/schemas/Pet')
+ against self.openAPISchema, with cycle protection.
+ """
+ if not isinstance(ref, str) or not ref.startswith('#'):
+ return None
+ if visited is None:
+ visited = set()
+ if ref in visited:
+ return None
+ visited.add(ref)
+
+ if ref in ('#', '#/'):
+ target: Any = self.openAPISchema
+ elif ref.startswith('#/'):
+ target = self.openAPISchema
+ for part in ref[2:].split('/'):
+ key = self._unescape_json_pointer_token(part)
+ if isinstance(target, dict) and key in target:
+ target = target[key]
+ elif isinstance(target, list):
+ try:
+ target = target[int(key)]
+ except (ValueError, IndexError):
+ return None
+ else:
+ return None
+ else:
+ return None
+
+ if isinstance(target, dict) and isinstance(target.get('$ref'), str):
+ resolved_next = self._resolve_ref(target['$ref'], visited)
+ if resolved_next is None:
+ return None
+ if isinstance(resolved_next, dict):
+ merged = dict(resolved_next)
+ for k, v in target.items():
+ if k != '$ref':
+ merged[k] = v
+ return merged
+ return resolved_next
+
+ return target
+
+ def _deref_shallow(self, obj: Any) -> Any:
+ """
+ Resolves top-level '$ref' on an OpenAPI object if present, merging sibling
+ keywords (per OAS 3.1+) on top of the resolved target.
+ """
+ if isinstance(obj, dict) and isinstance(obj.get('$ref'), str):
+ resolved = self._resolve_ref(obj['$ref'])
+ if resolved is None:
+ return obj
+ if isinstance(resolved, dict):
+ merged = dict(resolved)
+ for k, v in obj.items():
+ if k != '$ref':
+ merged[k] = v
+ return merged
+ return resolved
+ return obj
+
+ _SCHEMA_METADATA_ONLY_KEYS = frozenset({
+ '$ref', '$id', '$schema', '$comment', 'title', 'description',
+ 'default', 'examples', 'example', 'deprecated', 'externalDocs', 'xml',
+ })
+
+ def _is_schema_resolvable(self, schema: Any) -> bool:
+ """
+ Returns True if schema is a boolean schema or dict schema whose top-level
+ '$ref' (when no other validation keywords exist) resolves in self.openAPISchema.
+ """
+ if isinstance(schema, bool):
+ return True
+ if not isinstance(schema, dict):
+ return False
+ ref = schema.get('$ref')
+ if isinstance(ref, str) and self._resolve_ref(ref) is None:
+ has_other_validation_keys = any(k not in self._SCHEMA_METADATA_ONLY_KEYS for k in schema)
+ if not has_other_validation_keys:
+ return False
+ return True
+
+ def request_body_schema_defs(self, paths: Optional[List[Dict[str, Any]]] = None) -> Dict[str, Any]:
+ """
+ Collects all local JSON Pointer '$ref' schema targets reachable from
+ requestBodySchemas across the parsed paths, keyed by '$ref' string.
+ """
+ if paths is None:
+ paths = self.paths()
+
+ defs: Dict[str, Any] = {}
+ queue: List[Any] = []
+
+ for p in paths:
+ for m in p.get('methods', []):
+ rb_schemas = (m.get('details') or {}).get('requestBodySchemas') or {}
+ for schema in rb_schemas.values():
+ queue.append(schema)
+
+ def _scan_schema_node(node: Any) -> None:
+ if not isinstance(node, dict):
+ if isinstance(node, list):
+ for item in node:
+ _scan_schema_node(item)
+ return
+
+ ref = node.get('$ref')
+ if isinstance(ref, str) and ref.startswith('#') and ref not in defs:
+ resolved = self._resolve_ref(ref)
+ if resolved is not None:
+ defs[ref] = resolved
+ queue.append(resolved)
+
+ for key, val in node.items():
+ if key in ('example', 'examples'):
+ continue
+ if key in ('properties', 'patternProperties', '$defs', 'definitions') and isinstance(val, dict):
+ for sub_schema in val.values():
+ _scan_schema_node(sub_schema)
+ elif key == 'dependencies' and isinstance(val, dict):
+ for dep_val in val.values():
+ if isinstance(dep_val, dict):
+ _scan_schema_node(dep_val)
+ elif key == 'dependentSchemas' and isinstance(val, dict):
+ for dep_val in val.values():
+ _scan_schema_node(dep_val)
+ elif isinstance(val, (dict, list)):
+ _scan_schema_node(val)
+
+ while queue:
+ _scan_schema_node(queue.pop(0))
+
+ return defs
+
+ def _parse_method(
+ self,
+ method: str,
+ methodInfo: Dict[str, Any],
+ pathParameters: Optional[List[Dict[str, Any]]] = None,
+ allow_additional: bool = False,
+ ) -> Optional[Dict[str, Any]]:
"""
Helper method to parse details and parameters for an HTTP method on a path.
Args:
- method (str): HTTP method name (e.g. 'get').
+ method (str): HTTP method name (e.g. 'get' or an additionalOperations method).
methodInfo (Dict[str, Any]): Method details dictionary.
+ pathParameters (Optional[List[Dict[str, Any]]]): Optional path-item parameters.
+ allow_additional (bool): When True, accept arbitrary valid HTTP method tokens from
+ OAS 3.2 additionalOperations (excluding unsupported QUERY).
Returns:
Optional[Dict[str, Any]]: Parsed method dictionary or None if method not supported.
"""
- if method.upper() not in self.httpMethods:
+ if not isinstance(method, str) or not method or method.upper() == 'QUERY':
+ return None
+ if allow_additional:
+ if not self._HTTP_TOKEN_RE.match(method):
+ return None
+ elif method.upper() not in self.httpMethods:
return None
+ raw_request_body = methodInfo.get('requestBody')
+ request_body = self._deref_shallow(raw_request_body) if isinstance(raw_request_body, dict) else {}
+ if not isinstance(request_body, dict):
+ request_body = {}
+
m = {}
m['method'] = method
m['details'] = {}
m['details']['description'] = methodInfo.get('description', '')
m['details']['summary'] = methodInfo.get('summary', '')
m['details']['operationId'] = methodInfo.get('operationId', '')
- m['details']['requestBodyRequired'] = methodInfo.get('requestBody', {}).get('required', False)
+ m['details']['requestBodyRequired'] = bool(request_body.get('required', False))
m['details']['requestBodyContentType'] = []
+ m['details']['requestBodySchemas'] = {}
m['details']['disallowedResponseCodes'] = self.httpStatusCodes.copy()
m['parameters'] = []
- for rbct in list(methodInfo.get('requestBody', {}).get('content', {}).keys()):
+ content_dict = request_body.get('content') if isinstance(request_body.get('content'), dict) else {}
+ for rbct, raw_media_obj in content_dict.items():
m['details']['requestBodyContentType'].append(rbct)
+ media_obj = self._deref_shallow(raw_media_obj) if isinstance(raw_media_obj, dict) else {}
+ if isinstance(media_obj, dict) and 'schema' in media_obj:
+ rb_schema = media_obj['schema']
+ if self._is_schema_resolvable(rb_schema):
+ m['details']['requestBodySchemas'][rbct] = rb_schema
# m['details']['disallowedResponseCodes'] holds the list of disallowed HTTP return codes
- for respCode in list(methodInfo.get('responses', {}).keys()):
- if respCode.lower() == 'default':
- m['details']['responseCodeDefault'] = methodInfo.get('responses', {}).get('default')
+ responses = methodInfo.get('responses') if isinstance(methodInfo.get('responses'), dict) else {}
+ for respCode in list(responses.keys()):
+ resp_code_str = str(respCode)
+ if resp_code_str.lower() == 'default':
+ m['details']['responseCodeDefault'] = responses.get(respCode)
else:
- if respCode in m['details']['disallowedResponseCodes']:
- m['details']['disallowedResponseCodes'].remove(respCode)
+ if resp_code_str in m['details']['disallowedResponseCodes']:
+ m['details']['disallowedResponseCodes'].remove(resp_code_str)
+
+ raw_path_params = [
+ self._deref_shallow(p) if isinstance(p, dict) else p
+ for p in (pathParameters if isinstance(pathParameters, list) else [])
+ ]
+ raw_method_params = [
+ self._deref_shallow(p) if isinstance(p, dict) else p
+ for p in (methodInfo.get('parameters') if isinstance(methodInfo.get('parameters'), list) else [])
+ ]
+ deref_params = self._merge_parameters(raw_path_params or None, raw_method_params or None)
+
+ # Swagger / OpenAPI 2.0 body enforcement: inspect in="body" parameters and consumes
+ if not request_body:
+ body_params = [
+ p for p in deref_params
+ if isinstance(p, dict) and str(p.get('in', '')).lower() == 'body'
+ ]
+ if body_params:
+ m['details']['requestBodyRequired'] = any(bool(bp.get('required', False)) for bp in body_params)
+ consumes_list = self._effective_consumes(methodInfo)
+ for ct in consumes_list:
+ if ct not in m['details']['requestBodyContentType']:
+ m['details']['requestBodyContentType'].append(ct)
+ body_schema = None
+ for bp in body_params:
+ if 'schema' in bp and self._is_schema_resolvable(bp['schema']):
+ body_schema = bp['schema']
+ break
+ if body_schema is not None:
+ target_cts = consumes_list if consumes_list else ['*/*']
+ for ct in target_cts:
+ m['details']['requestBodySchemas'][ct] = body_schema
- raw_params = methodInfo.get('parameters')
- if raw_params and isinstance(raw_params, list):
- for qsParam in raw_params:
- parsed_p = self._parse_parameter(qsParam)
- if parsed_p:
- m['parameters'].append(parsed_p)
+ for qsParam in deref_params:
+ parsed_p = self._parse_parameter(qsParam)
+ if parsed_p:
+ m['parameters'].append(parsed_p)
+
+ if 'servers' in methodInfo and isinstance(methodInfo['servers'], list):
+ m['servers'] = [
+ self._parse_server(s) for s in methodInfo['servers'] if isinstance(s, dict)
+ ]
return m
@@ -158,7 +516,7 @@ def paths(self) -> List[Dict[str, Any]]:
Retrieves all path and method definitions from the schema.
Returns:
- List[Dict[str, Any]]: List of path dictionaries containing 'path' and 'methods'.
+ List[Dict[str, Any]]: List of path dictionaries containing 'path', 'methods', and optional 'servers'.
"""
all_paths = []
raw_paths = self.openAPISchema.get('paths')
@@ -171,11 +529,37 @@ def paths(self) -> List[Dict[str, Any]]:
}
if isinstance(path_obj, dict):
+ if 'servers' in path_obj and isinstance(path_obj['servers'], list):
+ p['servers'] = [
+ self._parse_server(s) for s in path_obj['servers'] if isinstance(s, dict)
+ ]
+
+ path_parameters = path_obj.get('parameters') if isinstance(path_obj.get('parameters'), list) else None
+ seen_methods = set()
+
for method, method_info in path_obj.items():
if isinstance(method_info, dict):
- parsed_m = self._parse_method(method, method_info)
+ parsed_m = self._parse_method(method, method_info, pathParameters=path_parameters)
if parsed_m:
p['methods'].append(parsed_m)
+ seen_methods.add(parsed_m['method'].upper())
+
+ # OAS 3.2 additionalOperations: Map[string, Operation Object]
+ additional_ops = path_obj.get('additionalOperations')
+ if isinstance(additional_ops, dict):
+ for add_method, add_method_info in additional_ops.items():
+ if isinstance(add_method, str) and isinstance(add_method_info, dict):
+ if add_method.upper() in seen_methods:
+ continue
+ parsed_m = self._parse_method(
+ add_method,
+ add_method_info,
+ pathParameters=path_parameters,
+ allow_additional=True,
+ )
+ if parsed_m:
+ p['methods'].append(parsed_m)
+ seen_methods.add(parsed_m['method'].upper())
all_paths.append(p)
diff --git a/templates/v5.7/apigateway-upstreams.tmpl b/templates/v5.7/apigateway-upstreams.tmpl
deleted file mode 100644
index 2784c566..00000000
--- a/templates/v5.7/apigateway-upstreams.tmpl
+++ /dev/null
@@ -1,13 +0,0 @@
-# API Gateway upstream file - server {{ server }}
-# OpenAPI version: {{ declaration.version | replace('\n',' ') }}
-# Base URI: {{ declaration.location.uri | replace('\n',' ') }}
-# Destination server: {{ declaration.upstream.destination_server | replace('\n',' ') }}
-{% if declaration.upstream and declaration.upstream.name and declaration.upstream.origin %}
-upstream {{ declaration.upstream.name }} {
- zone {{ declaration.upstream.name }} 64k;
- server {{ declaration.upstream.origin }}{% if declaration.upstream.resolve %} resolve{% endif %};
-{% if declaration.upstream.resolver %}
- include "{{ ncgconfig.nms.resolver_dir }}/{{ declaration.upstream.resolver | replace(" ", "_") }}.conf";
-{% endif %}
-}
-{% endif %}
diff --git a/templates/v5.7/apigateway/apigateway-body-validator.js.tmpl b/templates/v5.7/apigateway/apigateway-body-validator.js.tmpl
new file mode 100644
index 00000000..6c2ab723
--- /dev/null
+++ b/templates/v5.7/apigateway/apigateway-body-validator.js.tmpl
@@ -0,0 +1,883 @@
+// Auto-generated by NGINX Declarative API (v5.7) - OpenAPI Request Body Schema Validator
+
+var SCHEMA_DEFS = {{ schema_defs_json }};
+var PATH_RULES = {{ path_rules_json }};
+
+var MAX_DEPTH = 64;
+var METADATA_KEYS = {
+ '$ref': true,
+ '$id': true,
+ '$schema': true,
+ '$comment': true,
+ 'title': true,
+ 'description': true,
+ 'summary': true,
+ 'default': true,
+ 'examples': true,
+ 'example': true,
+ 'deprecated': true,
+ 'readOnly': true,
+ 'writeOnly': true,
+ 'externalDocs': true,
+ 'xml': true,
+ 'discriminator': true
+};
+
+function hasOwn(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+}
+
+function isPlainObject(val) {
+ return val !== null && typeof val === 'object' && !Array.isArray(val);
+}
+
+function getJsonType(val) {
+ if (val === null) return 'null';
+ if (Array.isArray(val)) return 'array';
+ if (typeof val === 'number') {
+ return Number.isInteger(val) ? 'integer' : 'number';
+ }
+ return typeof val;
+}
+
+function deepEqual(a, b) {
+ if (a === b) return true;
+ if (a === null || b === null) return a === b;
+ if (typeof a !== typeof b) return false;
+ if (typeof a !== 'object') return false;
+
+ var aIsArr = Array.isArray(a);
+ var bIsArr = Array.isArray(b);
+ if (aIsArr !== bIsArr) return false;
+
+ if (aIsArr) {
+ if (a.length !== b.length) return false;
+ for (var i = 0; i < a.length; i++) {
+ if (!deepEqual(a[i], b[i])) return false;
+ }
+ return true;
+ }
+
+ var aKeys = Object.keys(a);
+ var bKeys = Object.keys(b);
+ if (aKeys.length !== bKeys.length) return false;
+ for (var j = 0; j < aKeys.length; j++) {
+ var k = aKeys[j];
+ if (!hasOwn(b, k) || !deepEqual(a[k], b[k])) return false;
+ }
+ return true;
+}
+
+function unicodeLength(s) {
+ var count = 0;
+ for (var i = 0; i < s.length; i++) {
+ var code = s.charCodeAt(i);
+ if (code >= 0xD800 && code <= 0xDBFF && i + 1 < s.length) {
+ var next = s.charCodeAt(i + 1);
+ if (next >= 0xDC00 && next <= 0xDFFF) {
+ i++;
+ }
+ }
+ count++;
+ }
+ return count;
+}
+
+function isMultipleOf(val, divisor) {
+ if (typeof divisor !== 'number' || divisor <= 0 || !Number.isFinite(divisor)) {
+ return true;
+ }
+ var sDiv = String(divisor);
+ var sVal = String(val);
+ if (sDiv.indexOf('e') === -1 && sDiv.indexOf('E') === -1 &&
+ sVal.indexOf('e') === -1 && sVal.indexOf('E') === -1) {
+ var decDiv = sDiv.indexOf('.') >= 0 ? sDiv.length - sDiv.indexOf('.') - 1 : 0;
+ var decVal = sVal.indexOf('.') >= 0 ? sVal.length - sVal.indexOf('.') - 1 : 0;
+ var scale = Math.pow(10, Math.max(decDiv, decVal));
+ if (Number.isFinite(scale) && scale <= 1e12) {
+ var iv = Math.round(val * scale);
+ var id = Math.round(divisor * scale);
+ if (id !== 0) {
+ return (iv % id) === 0;
+ }
+ }
+ }
+ var quotient = val / divisor;
+ var nearest = Math.round(quotient) * divisor;
+ return Math.abs(val - nearest) <= 1e-9 * Math.max(1, Math.abs(val));
+}
+
+function isValidDaysInMonth(year, month, day) {
+ if (month < 1 || month > 12 || day < 1) return false;
+ var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+ var isLeap = (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
+ if (month === 2 && isLeap) return day <= 29;
+ return day <= days[month - 1];
+}
+
+function checkDateParts(dateStr) {
+ var m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(dateStr);
+ if (!m) return false;
+ return isValidDaysInMonth(parseInt(m[1], 10), parseInt(m[2], 10), parseInt(m[3], 10));
+}
+
+function checkTimeParts(hour, minute, second) {
+ return hour >= 0 && hour <= 23 && minute >= 0 && minute <= 59 && second >= 0 && second <= 60;
+}
+
+function isValidIpv4(ip) {
+ var parts = ip.split('.');
+ if (parts.length !== 4) return false;
+ for (var i = 0; i < 4; i++) {
+ if (!/^(?:0|[1-9]\d{0,2})$/.test(parts[i])) return false;
+ if (parseInt(parts[i], 10) > 255) return false;
+ }
+ return true;
+}
+
+function isValidIpv6(ip) {
+ if (ip.indexOf(':::') !== -1) return false;
+ var halves = ip.split('::');
+ if (halves.length > 2) return false;
+ var hexGroup = /^[0-9a-fA-F]{1,4}$/;
+ var groupsCount = 0;
+ for (var h = 0; h < halves.length; h++) {
+ if (halves[h] === '') continue;
+ var segs = halves[h].split(':');
+ for (var i = 0; i < segs.length; i++) {
+ if (i === segs.length - 1 && h === halves.length - 1 && segs[i].indexOf('.') !== -1) {
+ if (!isValidIpv4(segs[i])) return false;
+ groupsCount += 2;
+ } else {
+ if (!hexGroup.test(segs[i])) return false;
+ groupsCount += 1;
+ }
+ }
+ }
+ return halves.length === 2 ? groupsCount < 8 : groupsCount === 8;
+}
+
+function validateFormat(val, fmt) {
+ if (typeof val === 'number') {
+ if (fmt === 'int32') {
+ return Number.isInteger(val) && val >= -2147483648 && val <= 2147483647;
+ }
+ if (fmt === 'int64') {
+ return Number.isInteger(val);
+ }
+ if (fmt === 'float' || fmt === 'double') {
+ return Number.isFinite(val);
+ }
+ return true;
+ }
+ if (typeof val !== 'string') return true;
+
+ switch (fmt) {
+ case 'date':
+ return checkDateParts(val);
+ case 'date-time': {
+ var dtMatch = /^(\d{4}-\d{2}-\d{2})[Tt ](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|[+-](\d{2}):(\d{2}))$/.exec(val);
+ if (!dtMatch) return false;
+ if (!checkDateParts(dtMatch[1])) return false;
+ if (!checkTimeParts(parseInt(dtMatch[2], 10), parseInt(dtMatch[3], 10), parseInt(dtMatch[4], 10))) return false;
+ if (dtMatch[5] !== undefined) {
+ var tzH = parseInt(dtMatch[5], 10);
+ var tzM = parseInt(dtMatch[6], 10);
+ if (tzH > 23 || tzM > 59) return false;
+ }
+ return true;
+ }
+ case 'time': {
+ var tMatch = /^(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|[+-](\d{2}):(\d{2}))$/.exec(val);
+ if (!tMatch) return false;
+ if (!checkTimeParts(parseInt(tMatch[1], 10), parseInt(tMatch[2], 10), parseInt(tMatch[3], 10))) return false;
+ if (tMatch[4] !== undefined) {
+ if (parseInt(tMatch[4], 10) > 23 || parseInt(tMatch[5], 10) > 59) return false;
+ }
+ return true;
+ }
+ case 'uuid':
+ return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(val);
+ case 'email':
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val);
+ case 'ipv4':
+ return isValidIpv4(val);
+ case 'ipv6':
+ return isValidIpv6(val);
+ case 'uri':
+ return /^[a-zA-Z][a-zA-Z0-9+.-]*:\S+$/.test(val);
+ case 'hostname':
+ return val.length <= 253 && /^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/.test(val);
+ case 'byte':
+ return (val.length % 4 === 0) && /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(val);
+ default:
+ return true;
+ }
+}
+
+function resolveSchemaShallow(schema) {
+ var seen = {};
+ var current = schema;
+ while (isPlainObject(current) && typeof current.$ref === 'string') {
+ if (seen[current.$ref]) break;
+ seen[current.$ref] = true;
+ if (!hasOwn(SCHEMA_DEFS, current.$ref)) break;
+ current = SCHEMA_DEFS[current.$ref];
+ }
+ return current;
+}
+
+function isPropertyReadOnly(propSchema) {
+ var resolved = resolveSchemaShallow(propSchema);
+ return isPlainObject(resolved) && resolved.readOnly === true;
+}
+
+function matchesType(val, expectedType) {
+ if (expectedType === 'null') return val === null;
+ if (expectedType === 'boolean') return typeof val === 'boolean';
+ if (expectedType === 'string') return typeof val === 'string';
+ if (expectedType === 'number') return typeof val === 'number' && Number.isFinite(val);
+ if (expectedType === 'integer') return typeof val === 'number' && Number.isInteger(val);
+ if (expectedType === 'array') return Array.isArray(val);
+ if (expectedType === 'object') return isPlainObject(val);
+ return true;
+}
+
+function hasSiblingValidationKeys(schema) {
+ var keys = Object.keys(schema);
+ for (var i = 0; i < keys.length; i++) {
+ if (!METADATA_KEYS[keys[i]]) return true;
+ }
+ return false;
+}
+
+function validateSchema(val, schema, path, depth) {
+ if (depth > MAX_DEPTH) {
+ return path + ': maximum schema validation depth exceeded';
+ }
+ if (schema === true || schema === undefined || schema === null) {
+ return null;
+ }
+ if (schema === false) {
+ return path + ': value is not allowed by schema';
+ }
+ if (!isPlainObject(schema)) {
+ return null;
+ }
+
+ // OpenAPI 3.0 nullable support
+ if (val === null && schema.nullable === true) {
+ if (!hasOwn(schema, 'enum') && !hasOwn(schema, 'const')) {
+ return null;
+ }
+ }
+
+ // $ref handling (supports OAS 3.1 sibling keywords)
+ if (typeof schema.$ref === 'string') {
+ if (hasOwn(SCHEMA_DEFS, schema.$ref)) {
+ var refErr = validateSchema(val, SCHEMA_DEFS[schema.$ref], path, depth + 1);
+ if (refErr !== null) return refErr;
+ }
+ if (!hasSiblingValidationKeys(schema)) {
+ return null;
+ }
+ }
+
+ // const
+ if (hasOwn(schema, 'const')) {
+ if (!deepEqual(val, schema.const)) {
+ return path + ': value must equal ' + JSON.stringify(schema.const);
+ }
+ }
+
+ // enum
+ if (Array.isArray(schema.enum)) {
+ var enumMatched = false;
+ for (var ei = 0; ei < schema.enum.length; ei++) {
+ if (deepEqual(val, schema.enum[ei])) {
+ enumMatched = true;
+ break;
+ }
+ }
+ if (!enumMatched && !(val === null && schema.nullable === true)) {
+ return path + ': value must be one of ' + JSON.stringify(schema.enum);
+ }
+ }
+
+ // type (string or array of strings in OAS 3.1)
+ if (hasOwn(schema, 'type')) {
+ var allowedTypes = Array.isArray(schema.type) ? schema.type : [schema.type];
+ var typeOk = (val === null && schema.nullable === true);
+ if (!typeOk) {
+ for (var ti = 0; ti < allowedTypes.length; ti++) {
+ if (matchesType(val, allowedTypes[ti])) {
+ typeOk = true;
+ break;
+ }
+ }
+ }
+ if (!typeOk) {
+ return path + ': expected type ' + JSON.stringify(schema.type) + ', got ' + getJsonType(val);
+ }
+ }
+
+ // String validations
+ if (typeof val === 'string') {
+ var strLen = (hasOwn(schema, 'minLength') || hasOwn(schema, 'maxLength')) ? unicodeLength(val) : 0;
+ if (typeof schema.minLength === 'number' && strLen < schema.minLength) {
+ return path + ': string length ' + strLen + ' is less than minLength ' + schema.minLength;
+ }
+ if (typeof schema.maxLength === 'number' && strLen > schema.maxLength) {
+ return path + ': string length ' + strLen + ' exceeds maxLength ' + schema.maxLength;
+ }
+ if (typeof schema.pattern === 'string') {
+ try {
+ var re = new RegExp(schema.pattern);
+ if (!re.test(val)) {
+ return path + ': string does not match pattern ' + schema.pattern;
+ }
+ } catch (e) {
+ // Ignore unsupported regex flavor errors
+ }
+ }
+ if (typeof schema.format === 'string' && !validateFormat(val, schema.format)) {
+ return path + ': string does not match format "' + schema.format + '"';
+ }
+ }
+
+ // Number / integer validations
+ if (typeof val === 'number') {
+ if (typeof schema.minimum === 'number') {
+ if (schema.exclusiveMinimum === true) {
+ if (val <= schema.minimum) {
+ return path + ': value ' + val + ' must be > ' + schema.minimum;
+ }
+ } else {
+ if (val < schema.minimum) {
+ return path + ': value ' + val + ' must be >= ' + schema.minimum;
+ }
+ }
+ }
+ if (typeof schema.exclusiveMinimum === 'number' && val <= schema.exclusiveMinimum) {
+ return path + ': value ' + val + ' must be > ' + schema.exclusiveMinimum;
+ }
+ if (typeof schema.maximum === 'number') {
+ if (schema.exclusiveMaximum === true) {
+ if (val >= schema.maximum) {
+ return path + ': value ' + val + ' must be < ' + schema.maximum;
+ }
+ } else {
+ if (val > schema.maximum) {
+ return path + ': value ' + val + ' must be <= ' + schema.maximum;
+ }
+ }
+ }
+ if (typeof schema.exclusiveMaximum === 'number' && val >= schema.exclusiveMaximum) {
+ return path + ': value ' + val + ' must be < ' + schema.exclusiveMaximum;
+ }
+ if (typeof schema.multipleOf === 'number' && !isMultipleOf(val, schema.multipleOf)) {
+ return path + ': value ' + val + ' must be a multiple of ' + schema.multipleOf;
+ }
+ if (typeof schema.format === 'string' && !validateFormat(val, schema.format)) {
+ return path + ': number does not match format "' + schema.format + '"';
+ }
+ }
+
+ // Array validations
+ if (Array.isArray(val)) {
+ if (typeof schema.minItems === 'number' && val.length < schema.minItems) {
+ return path + ': array has ' + val.length + ' items, minItems is ' + schema.minItems;
+ }
+ if (typeof schema.maxItems === 'number' && val.length > schema.maxItems) {
+ return path + ': array has ' + val.length + ' items, maxItems is ' + schema.maxItems;
+ }
+ if (schema.uniqueItems === true) {
+ for (var ui = 0; ui < val.length; ui++) {
+ for (var uj = ui + 1; uj < val.length; uj++) {
+ if (deepEqual(val[ui], val[uj])) {
+ return path + ': array items must be unique (duplicate at index ' + uj + ')';
+ }
+ }
+ }
+ }
+
+ // JSON Schema 2020-12 prefixItems + items
+ if (Array.isArray(schema.prefixItems)) {
+ for (var pi = 0; pi < val.length; pi++) {
+ if (pi < schema.prefixItems.length) {
+ var pItemErr = validateSchema(val[pi], schema.prefixItems[pi], path + '[' + pi + ']', depth + 1);
+ if (pItemErr !== null) return pItemErr;
+ } else if (hasOwn(schema, 'items')) {
+ if (schema.items === false) {
+ return path + '[' + pi + ']: extra array items are not allowed';
+ }
+ var restErr = validateSchema(val[pi], schema.items, path + '[' + pi + ']', depth + 1);
+ if (restErr !== null) return restErr;
+ }
+ }
+ } else if (Array.isArray(schema.items)) {
+ // Draft 4/7 tuple validation
+ for (var ti2 = 0; ti2 < val.length; ti2++) {
+ if (ti2 < schema.items.length) {
+ var tupErr = validateSchema(val[ti2], schema.items[ti2], path + '[' + ti2 + ']', depth + 1);
+ if (tupErr !== null) return tupErr;
+ } else if (hasOwn(schema, 'additionalItems')) {
+ if (schema.additionalItems === false) {
+ return path + '[' + ti2 + ']: additional array items are not allowed';
+ }
+ if (isPlainObject(schema.additionalItems) || typeof schema.additionalItems === 'boolean') {
+ var addItemErr = validateSchema(val[ti2], schema.additionalItems, path + '[' + ti2 + ']', depth + 1);
+ if (addItemErr !== null) return addItemErr;
+ }
+ }
+ }
+ } else if (hasOwn(schema, 'items')) {
+ for (var ii = 0; ii < val.length; ii++) {
+ var itemErr = validateSchema(val[ii], schema.items, path + '[' + ii + ']', depth + 1);
+ if (itemErr !== null) return itemErr;
+ }
+ }
+
+ if (hasOwn(schema, 'contains')) {
+ var matchCount = 0;
+ for (var ci = 0; ci < val.length; ci++) {
+ if (validateSchema(val[ci], schema.contains, path + '[' + ci + ']', depth + 1) === null) {
+ matchCount++;
+ }
+ }
+ var minC = typeof schema.minContains === 'number' ? schema.minContains : 1;
+ if (matchCount < minC) {
+ return path + ': array must contain at least ' + minC + ' matching item(s)';
+ }
+ if (typeof schema.maxContains === 'number' && matchCount > schema.maxContains) {
+ return path + ': array must contain at most ' + schema.maxContains + ' matching item(s)';
+ }
+ }
+ }
+
+ // Object validations
+ if (isPlainObject(val)) {
+ var valKeys = Object.keys(val);
+ if (typeof schema.minProperties === 'number' && valKeys.length < schema.minProperties) {
+ return path + ': object has ' + valKeys.length + ' properties, minProperties is ' + schema.minProperties;
+ }
+ if (typeof schema.maxProperties === 'number' && valKeys.length > schema.maxProperties) {
+ return path + ': object has ' + valKeys.length + ' properties, maxProperties is ' + schema.maxProperties;
+ }
+
+ if (Array.isArray(schema.required)) {
+ for (var ri = 0; ri < schema.required.length; ri++) {
+ var reqKey = schema.required[ri];
+ if (isPlainObject(schema.properties) && hasOwn(schema.properties, reqKey) &&
+ isPropertyReadOnly(schema.properties[reqKey])) {
+ continue;
+ }
+ if (!hasOwn(val, reqKey)) {
+ return path + ': missing required property "' + reqKey + '"';
+ }
+ }
+ }
+
+ if (hasOwn(schema, 'propertyNames')) {
+ for (var pni = 0; pni < valKeys.length; pni++) {
+ var pnErr = validateSchema(valKeys[pni], schema.propertyNames, path + '.' + valKeys[pni], depth + 1);
+ if (pnErr !== null) return pnErr;
+ }
+ }
+
+ var props = isPlainObject(schema.properties) ? schema.properties : null;
+ var patProps = isPlainObject(schema.patternProperties) ? schema.patternProperties : null;
+ var patKeys = patProps ? Object.keys(patProps) : [];
+
+ for (var ki = 0; ki < valKeys.length; ki++) {
+ var propName = valKeys[ki];
+ var propPath = path + '.' + propName;
+ var matchedKnownProp = false;
+
+ if (props && hasOwn(props, propName)) {
+ matchedKnownProp = true;
+ var propErr = validateSchema(val[propName], props[propName], propPath, depth + 1);
+ if (propErr !== null) return propErr;
+ }
+
+ for (var pk = 0; pk < patKeys.length; pk++) {
+ var patStr = patKeys[pk];
+ try {
+ if (new RegExp(patStr).test(propName)) {
+ matchedKnownProp = true;
+ var patErr = validateSchema(val[propName], patProps[patStr], propPath, depth + 1);
+ if (patErr !== null) return patErr;
+ }
+ } catch (e) {
+ // Ignore invalid regex
+ }
+ }
+
+ if (!matchedKnownProp && hasOwn(schema, 'additionalProperties')) {
+ if (schema.additionalProperties === false) {
+ return propPath + ': additional property is not allowed';
+ }
+ if (isPlainObject(schema.additionalProperties) || typeof schema.additionalProperties === 'boolean') {
+ var addPropErr = validateSchema(val[propName], schema.additionalProperties, propPath, depth + 1);
+ if (addPropErr !== null) return addPropErr;
+ }
+ }
+ }
+
+ if (isPlainObject(schema.dependentRequired)) {
+ var depReqKeys = Object.keys(schema.dependentRequired);
+ for (var dri = 0; dri < depReqKeys.length; dri++) {
+ var drk = depReqKeys[dri];
+ if (hasOwn(val, drk) && Array.isArray(schema.dependentRequired[drk])) {
+ var reqList = schema.dependentRequired[drk];
+ for (var drj = 0; drj < reqList.length; drj++) {
+ if (!hasOwn(val, reqList[drj])) {
+ return path + ': property "' + reqList[drj] + '" is required when "' + drk + '" is present';
+ }
+ }
+ }
+ }
+ }
+
+ if (isPlainObject(schema.dependentSchemas)) {
+ var depSchKeys = Object.keys(schema.dependentSchemas);
+ for (var dsi = 0; dsi < depSchKeys.length; dsi++) {
+ var dsk = depSchKeys[dsi];
+ if (hasOwn(val, dsk)) {
+ var dsErr = validateSchema(val, schema.dependentSchemas[dsk], path, depth + 1);
+ if (dsErr !== null) return dsErr;
+ }
+ }
+ }
+
+ if (isPlainObject(schema.dependencies)) {
+ var depKeys = Object.keys(schema.dependencies);
+ for (var di = 0; di < depKeys.length; di++) {
+ var dk = depKeys[di];
+ if (!hasOwn(val, dk)) continue;
+ var depVal = schema.dependencies[dk];
+ if (Array.isArray(depVal)) {
+ for (var dj = 0; dj < depVal.length; dj++) {
+ if (!hasOwn(val, depVal[dj])) {
+ return path + ': property "' + depVal[dj] + '" is required when "' + dk + '" is present';
+ }
+ }
+ } else if (isPlainObject(depVal) || typeof depVal === 'boolean') {
+ var depErr = validateSchema(val, depVal, path, depth + 1);
+ if (depErr !== null) return depErr;
+ }
+ }
+ }
+ }
+
+ // Composition keywords: allOf, anyOf, oneOf, not, if/then/else
+ if (Array.isArray(schema.allOf)) {
+ for (var ai = 0; ai < schema.allOf.length; ai++) {
+ var allErr = validateSchema(val, schema.allOf[ai], path, depth + 1);
+ if (allErr !== null) return allErr;
+ }
+ }
+
+ if (Array.isArray(schema.anyOf) && schema.anyOf.length > 0) {
+ var anyMatched = false;
+ var lastAnyErr = null;
+ for (var ayi = 0; ayi < schema.anyOf.length; ayi++) {
+ var ayErr = validateSchema(val, schema.anyOf[ayi], path, depth + 1);
+ if (ayErr === null) {
+ anyMatched = true;
+ break;
+ }
+ lastAnyErr = ayErr;
+ }
+ if (!anyMatched) {
+ return path + ': value does not match any schema in anyOf (' + lastAnyErr + ')';
+ }
+ }
+
+ if (Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {
+ var oneCount = 0;
+ var lastOneErr = null;
+ for (var oi = 0; oi < schema.oneOf.length; oi++) {
+ var oErr = validateSchema(val, schema.oneOf[oi], path, depth + 1);
+ if (oErr === null) {
+ oneCount++;
+ } else {
+ lastOneErr = oErr;
+ }
+ }
+ if (oneCount !== 1) {
+ if (oneCount === 0) {
+ return path + ': value does not match any schema in oneOf (' + lastOneErr + ')';
+ }
+ return path + ': value matched ' + oneCount + ' schemas in oneOf, expected exactly 1';
+ }
+ }
+
+ if (hasOwn(schema, 'not')) {
+ if (validateSchema(val, schema.not, path, depth + 1) === null) {
+ return path + ': value must not match schema in "not"';
+ }
+ }
+
+ if (hasOwn(schema, 'if')) {
+ var ifPassed = validateSchema(val, schema['if'], path, depth + 1) === null;
+ if (ifPassed && hasOwn(schema, 'then')) {
+ var thenErr = validateSchema(val, schema.then, path, depth + 1);
+ if (thenErr !== null) return thenErr;
+ } else if (!ifPassed && hasOwn(schema, 'else')) {
+ var elseErr = validateSchema(val, schema['else'], path, depth + 1);
+ if (elseErr !== null) return elseErr;
+ }
+ }
+
+ return null;
+}
+
+function matchMediaType(ct, candidates) {
+ if (!ct || !candidates || candidates.length === 0) return null;
+ var exact = null;
+ var suffixWild = null;
+ var typeWild = null;
+ var anyWild = null;
+
+ var slash = ct.indexOf('/');
+ var reqType = slash >= 0 ? ct.slice(0, slash) : ct;
+ var reqSub = slash >= 0 ? ct.slice(slash + 1) : '';
+ var plusIdx = reqSub.lastIndexOf('+');
+ var reqSuffix = plusIdx >= 0 ? reqSub.slice(plusIdx + 1) : '';
+
+ for (var i = 0; i < candidates.length; i++) {
+ var rawCand = candidates[i];
+ var cand = rawCand.split(';')[0].trim().toLowerCase();
+ if (cand === ct) {
+ exact = rawCand;
+ break;
+ }
+ if (cand === '*/*') {
+ anyWild = rawCand;
+ continue;
+ }
+ if (reqSuffix && cand === ('*+' + reqSuffix)) {
+ suffixWild = rawCand;
+ continue;
+ }
+ var cSlash = cand.indexOf('/');
+ if (cSlash >= 0) {
+ var cType = cand.slice(0, cSlash);
+ var cSub = cand.slice(cSlash + 1);
+ if (cType === reqType) {
+ if (cSub === '*') {
+ typeWild = rawCand;
+ } else if (reqSuffix && cSub === ('*+' + reqSuffix)) {
+ suffixWild = rawCand;
+ }
+ }
+ }
+ }
+ return exact || suffixWild || typeWild || anyWild;
+}
+
+function isJsonMediaType(ct) {
+ if (!ct) return false;
+ return ct === 'application/json' || ct === 'text/json' ||
+ (ct.indexOf('/') !== -1 && ct.slice(-5) === '+json');
+}
+
+function decodeFormPart(s) {
+ try {
+ return decodeURIComponent(s.replace(/\+/g, ' '));
+ } catch (e) {
+ return s.replace(/\+/g, ' ');
+ }
+}
+
+function coerceFormValue(raw, propSchema) {
+ var resolved = resolveSchemaShallow(propSchema);
+ if (!isPlainObject(resolved)) return raw;
+ var t = resolved.type;
+ if (Array.isArray(t)) {
+ t = t.length > 0 ? t[0] : '';
+ }
+ if (t === 'boolean') {
+ if (raw === 'true') return true;
+ if (raw === 'false') return false;
+ return raw;
+ }
+ if (t === 'integer') {
+ if (/^-?\d+$/.test(raw)) return parseInt(raw, 10);
+ return raw;
+ }
+ if (t === 'number') {
+ if (/^-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(raw)) return parseFloat(raw);
+ return raw;
+ }
+ if (resolved.nullable === true && raw === 'null') {
+ return null;
+ }
+ return raw;
+}
+
+function parseFormUrlEncoded(rawBody, rootSchema) {
+ var resolvedRoot = resolveSchemaShallow(rootSchema);
+ var props = (isPlainObject(resolvedRoot) && isPlainObject(resolvedRoot.properties)) ? resolvedRoot.properties : {};
+ var result = {};
+ if (!rawBody) return result;
+
+ var pairs = rawBody.split('&');
+ for (var i = 0; i < pairs.length; i++) {
+ if (!pairs[i]) continue;
+ var eq = pairs[i].indexOf('=');
+ var k = decodeFormPart(eq >= 0 ? pairs[i].slice(0, eq) : pairs[i]);
+ var vRaw = eq >= 0 ? decodeFormPart(pairs[i].slice(eq + 1)) : '';
+ var pSchema = hasOwn(props, k) ? resolveSchemaShallow(props[k]) : null;
+
+ if (isPlainObject(pSchema) && pSchema.type === 'array') {
+ var coercedItem = coerceFormValue(vRaw, pSchema.items);
+ if (!Array.isArray(result[k])) {
+ result[k] = [];
+ }
+ result[k].push(coercedItem);
+ } else {
+ result[k] = coerceFormValue(vRaw, pSchema);
+ }
+ }
+ return result;
+}
+
+function sendError(r, status, message) {
+ if (r.headersOut) {
+ r.headersOut['Content-Type'] = 'application/json';
+ }
+ r.return(status, JSON.stringify({ code: status, message: message }));
+}
+
+function readRequestBody(r) {
+ try {
+ if (r.requestText !== undefined && r.requestText !== null) {
+ return r.requestText;
+ }
+ } catch (e) {
+ if (r.variables && r.variables.request_body_file) {
+ try {
+ var fs = require('fs');
+ return fs.readFileSync(r.variables.request_body_file, 'utf8');
+ } catch (fe) {
+ return null;
+ }
+ }
+ return null;
+ }
+ if (r.requestBuffer !== undefined && r.requestBuffer !== null) {
+ return r.requestBuffer.toString('utf8');
+ }
+ return '';
+}
+
+function handleRequest(r, funcName) {
+ var pathRule = PATH_RULES[funcName];
+ if (!pathRule) {
+ return sendError(r, 500, 'Internal body validator configuration error');
+ }
+
+ var method = (r.method || '').toUpperCase();
+ var methodRule = pathRule.methods ? pathRule.methods[method] : null;
+ if (!methodRule) {
+ r.internalRedirect(pathRule.proxyLocation);
+ return;
+ }
+
+ var rawBody = readRequestBody(r);
+ if (rawBody === null) {
+ return sendError(r, 400, 'Unable to read request body');
+ }
+
+ if (rawBody.length === 0) {
+ if (methodRule.required) {
+ return sendError(r, 400, 'Missing required request body');
+ }
+ r.internalRedirect(pathRule.proxyLocation);
+ return;
+ }
+
+ var rawCt = '';
+ if (r.headersIn) {
+ rawCt = r.headersIn['Content-Type'] || r.headersIn['content-type'] || '';
+ }
+ if (!rawCt && r.variables && r.variables.http_content_type) {
+ rawCt = r.variables.http_content_type;
+ }
+ var ct = rawCt.split(';')[0].trim().toLowerCase();
+
+ var allowedTypes = methodRule.allowedContentTypes || [];
+ if (allowedTypes.length > 0 && !matchMediaType(ct, allowedTypes)) {
+ return sendError(r, 400, 'Unsupported Content-Type: ' + (ct || '(none)'));
+ }
+
+ var schemasMap = methodRule.schemas || {};
+ var schemaKeys = Object.keys(schemasMap);
+ if (schemaKeys.length === 0) {
+ r.internalRedirect(pathRule.proxyLocation);
+ return;
+ }
+
+ var matchedKey = matchMediaType(ct, schemaKeys);
+ if (!matchedKey && !ct && hasOwn(schemasMap, '*/*')) {
+ matchedKey = '*/*';
+ }
+ if (!matchedKey) {
+ r.internalRedirect(pathRule.proxyLocation);
+ return;
+ }
+
+ var targetSchema = schemasMap[matchedKey];
+ var payload;
+
+ if (isJsonMediaType(ct)) {
+ try {
+ payload = JSON.parse(rawBody);
+ } catch (parseErr) {
+ return sendError(r, 400, 'Invalid JSON request body');
+ }
+ } else if (ct === 'application/x-www-form-urlencoded') {
+ payload = parseFormUrlEncoded(rawBody, targetSchema);
+ } else if (ct === 'text/plain') {
+ payload = rawBody;
+ } else if (matchedKey === '*/*' && !ct) {
+ var resolvedTarget = resolveSchemaShallow(targetSchema);
+ var expectPlainString = isPlainObject(resolvedTarget) && resolvedTarget.type === 'string' &&
+ !/^\s*"/.test(rawBody);
+ if (expectPlainString) {
+ payload = rawBody;
+ } else {
+ try {
+ payload = JSON.parse(rawBody);
+ } catch (parseErr2) {
+ return sendError(r, 400, 'Invalid JSON request body');
+ }
+ }
+ } else {
+ // Non-JSON/form/text payloads (e.g. XML, multipart, binary) cannot be structurally validated by JSON Schema
+ r.internalRedirect(pathRule.proxyLocation);
+ return;
+ }
+
+ var validationErr = validateSchema(payload, targetSchema, '$', 0);
+ if (validationErr !== null) {
+ return sendError(r, 400, 'Request body validation failed: ' + validationErr);
+ }
+
+ r.internalRedirect(pathRule.proxyLocation);
+}
+
+{% for fn in func_names %}
+function {{ fn }}(r) {
+ return handleRequest(r, "{{ fn }}");
+}
+
+{% endfor %}
+export default {
+{% for fn in func_names %}
+ {{ fn }}: {{ fn }}{% if not loop.last %},{% endif %}
+
+{% endfor %}
+};
diff --git a/templates/v5.7/apigateway-maps.tmpl b/templates/v5.7/apigateway/apigateway-maps.tmpl
similarity index 52%
rename from templates/v5.7/apigateway-maps.tmpl
rename to templates/v5.7/apigateway/apigateway-maps.tmpl
index 80b4fa8c..2e8c81c1 100644
--- a/templates/v5.7/apigateway-maps.tmpl
+++ b/templates/v5.7/apigateway/apigateway-maps.tmpl
@@ -39,7 +39,7 @@ map $request_method-$host-$uri-$http_content_type-$http_content_length $is_reque
# Required query string parameters for {{ declaration.location.uri }}{{ path.path }} - method {{ method.method|upper }}
-map "" $required_params_{{ method.method }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} {
+map "" $required_params_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} {
default "{{ queryStringParms.allParams | trim }}";
}
{%- endif -%}
@@ -52,25 +52,25 @@ map "" $required_params_{{ method.method }}_{{ server | replace('.','_') }}{{ de
{# --- Mandatory query string parameter enforcement --- #}
{% if parm.in | lower == "query" or parm.in | lower == "header" %}
-{% set allParams.missing = allParams.missing + "$missing_" + method.method + "_" + server | replace('.','_') | replace('-','_') + declaration.location.uri | replace('/','_') | replace('-','_') + path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') + "_" + parm.name %}
+{% set allParams.missing = allParams.missing + "$missing_" + method.method | replace('-','_') | replace('.','_') + "_" + server | replace('.','_') | replace('-','_') + declaration.location.uri | replace('/','_') | replace('-','_') + path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') + "_" + parm.name %}
# Check query string parameter value and set variable to 0 if the value is among allowed ones in the OpenAPI schema enum, 1 if value is wrong
{% if parm.schema.enum %}
{% if parm.in | lower == "query" %}
-map $request_method$host$uri-$arg_{{ parm.name }} $wrongvalue_{{ method.method }}_{{ server | replace('.','_') | replace('-','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}_{{ parm.name }}
+map $request_method$host$uri-$arg_{{ parm.name }} $wrongvalue_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') | replace('-','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}_{{ parm.name }}
{
{% for enum in parm.schema.enum %}
"{{ method.method | upper }}{{ server }}{{ declaration.location.uri }}{{ path.path }}-{{ enum }}" 0;
-{% set allParamsValues.missing = allParamsValues.missing + "$wrongvalue_" + method.method + "_" + server | replace('.','_') + declaration.location.uri | replace('-','_') | replace('/','_') + path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') + "_" + parm.name + "-" + enum %}
+{% set allParamsValues.missing = allParamsValues.missing + "$wrongvalue_" + method.method | replace('-','_') | replace('.','_') + "_" + server | replace('.','_') + declaration.location.uri | replace('-','_') | replace('/','_') + path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') + "_" + parm.name + "-" + enum %}
{% endfor %}
default 1;
}
{% elif parm.in | lower == "header" %}
-map $request_method$host$uri-$http_{{ parm.name }} $wrongvalue_{{ method.method }}_{{ server | replace('.','_') | replace('-','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}_{{ parm.name }}
+map $request_method$host$uri-$http_{{ parm.name }} $wrongvalue_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') | replace('-','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}_{{ parm.name }}
{
{% for enum in parm.schema.enum %}
"{{ method.method | upper }}{{ server }}{{ declaration.location.uri }}{{ path.path }}-{{ enum }}" 0;
-{% set allParamsValues.missing = allParamsValues.missing + "$wrongvalue_" + method.method + "_" + server | replace('.','_') + declaration.location.uri | replace('-','_') | replace('/','_') + path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') + "_" + parm.name + "-" + enum %}
+{% set allParamsValues.missing = allParamsValues.missing + "$wrongvalue_" + method.method | replace('-','_') | replace('.','_') + "_" + server | replace('.','_') + declaration.location.uri | replace('-','_') | replace('/','_') + path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') + "_" + parm.name + "-" + enum %}
{% endfor %}
default 1;
}
@@ -79,13 +79,13 @@ map $request_method$host$uri-$http_{{ parm.name }} $wrongvalue_{{ method.method
# Check query string parameters and set variable to 0 if found, 1 if missing
{% if parm.in | lower == "query" %}
-map $request_method$host$uri$arg_{{ parm.name }} $missing_{{ method.method }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}_{{ parm.name }}
+map $request_method$host$uri$arg_{{ parm.name }} $missing_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}_{{ parm.name }}
{
"{{ method.method|upper }}{{ server }}{{ declaration.location.uri }}{{ path.path }}" 1;
default 0;
}
{% elif parm.in | lower == "header" %}
-map $request_method$host$uri-$http_{{ parm.name }} $missing_{{ method.method }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}_{{ parm.name }}
+map $request_method$host$uri-$http_{{ parm.name }} $missing_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') | replace('-','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}_{{ parm.name }}
{
~^{{ method.method|upper }}{{ server }}{{ declaration.location.uri }}{{ path.path | regex_replace('{(.*?)}','(.*)') }}-$ 1;
default 0;
@@ -100,7 +100,7 @@ map $request_method$host$uri-$http_{{ parm.name }} $missing_{{ method.method }}_
{% if allParams.missing != '' %}
# Check if all required parameters have been received
-map "{{ allParams.missing | trim }}" $any_missing_{{ method.method }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') }}{{ path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} {
+map "{{ allParams.missing | trim }}" $any_missing_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') }}{{ path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} {
~1 1; # if any digit is 1 one or more required query string parameter is missing
default 0; # all required query string parameters present
}
@@ -108,11 +108,50 @@ map "{{ allParams.missing | trim }}" $any_missing_{{ method.method }}_{{ server
# Check if all required parameter values have been received
-map "{{ allParamsValues.missing | trim }}" $any_values_invalid_{{ method.method }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') }}{{ path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} {
+map "{{ allParamsValues.missing | trim }}" $any_values_invalid_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') }}{{ path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} {
{% if allParamsValues.missing != '' %}
~1 1; # if any digit is 1 one or more required query string parameter value is invalid
{% endif %}
default 0; # all required query string parameters have valid values
}
{%- endfor %}
+{% if path.use_method_upstreams %}
+# Per-method upstream routing for {{ declaration.location.uri }}{{ path.path }}
+map $request_method $apigw_scheme_{{ path.var_suffix }} {
+{% for method in path.methods %}
+ "{{ method.method | upper }}" "{{ method.effective_upstream.scheme }}";
+{% endfor %}
+ default "{{ path.upstream.scheme }}";
+}
+
+map $request_method $apigw_upstream_{{ path.var_suffix }} {
+{% for method in path.methods %}
+ "{{ method.method | upper }}" "{{ method.effective_upstream.name }}";
+{% endfor %}
+ default "{{ path.upstream.name }}";
+}
+
+map $request_method $apigw_base_path_{{ path.var_suffix }} {
+{% for method in path.methods %}
+ "{{ method.method | upper }}" "{{ method.effective_upstream.base_path }}";
+{% endfor %}
+ default "{{ path.upstream.base_path }}";
+}
+
+map $request_method $apigw_host_{{ path.var_suffix }} {
+{% for method in path.methods %}
+ "{{ method.method | upper }}" "{{ method.effective_upstream.host_header }}";
+{% endfor %}
+ default "{{ path.upstream.host_header }}";
+}
+{% if path.any_ssl_name %}
+
+map $request_method $apigw_ssl_name_{{ path.var_suffix }} {
+{% for method in path.methods %}
+ "{{ method.method | upper }}" "{{ method.effective_upstream.ssl_name }}";
+{% endfor %}
+ default "{{ path.upstream.ssl_name }}";
+}
+{% endif %}
+{% endif %}
{% endfor %}
\ No newline at end of file
diff --git a/templates/v5.7/apigateway/apigateway-proxy.tmpl b/templates/v5.7/apigateway/apigateway-proxy.tmpl
new file mode 100644
index 00000000..26bc7097
--- /dev/null
+++ b/templates/v5.7/apigateway/apigateway-proxy.tmpl
@@ -0,0 +1,119 @@
+# API Gateway internal proxy locations (post request body schema validation) - server {{ server }}
+{% if declaration.paths -%}
+{% for path in declaration.paths|sort(attribute='path', reverse = True) %}
+{% if path.body_validation_enabled -%}
+location {{ path.body_validation_proxy_location }} {
+ {% if declaration.location.apigateway.api_gateway.enforce_response_codes -%}
+ proxy_intercept_errors on;
+ {% for method in path.methods -%}
+ # {{ method.method | upper }} - operationId: {{ method.details.operationId }}
+ if ( $request_method = "{{ method.method | upper }}" ) {
+ error_page {{ method.details.disallowedResponseCodes | join(' ') }} =500 @apigw-error-page-500;
+ }
+ {% endfor -%}
+ {% endif %}
+
+ {% if declaration.location.apigateway.log and declaration.location.apigateway.log.access %}access_log {{ declaration.location.apigateway.log.access.destination }}{% if declaration.location.apigateway.log.access.format %} {{ declaration.location.apigateway.log.access.format }}{% endif %}{% if declaration.location.apigateway.log.access.condition %} if={{ declaration.location.apigateway.log.access.condition }}{% endif %};{% elif declaration.location.log and declaration.location.log.access %}access_log {{ declaration.location.log.access.destination }}{% if declaration.location.log.access.format %} {{ declaration.location.log.access.format }}{% endif %}{% if declaration.location.log.access.condition %} if={{ declaration.location.log.access.condition }}{% endif %};{% endif %}
+
+ {% if declaration.location.apigateway.log and declaration.location.apigateway.log.error %}error_log {{ declaration.location.apigateway.log.error.destination }}{% if declaration.location.apigateway.log.error.level %} {{ declaration.location.apigateway.log.error.level }}{% endif %};{% elif declaration.location.log and declaration.location.log.error %}error_log {{ declaration.location.log.error.destination }}{% if declaration.location.log.error.level %} {{ declaration.location.log.error.level }}{% endif %};{% endif %}
+
+ {% if declaration.location.authentication and declaration.location.authentication.server and declaration.location.authentication.server[0].profile -%}
+ include "{{ ncgconfig.nms.auth_server_dir }}/{{ declaration.location.authentication.server[0].profile | replace(" ", "_") }}.conf";
+ {% endif -%}
+
+ {# --- Location HTTP headers manipulation --- #}
+ {%- if declaration.location.headers -%}
+ {% if declaration.location.headers.to_server -%}
+ {% if declaration.location.headers.to_server.set -%}
+ {% for hSet in declaration.location.headers.to_server.set -%}
+ proxy_set_header {{ hSet.name }} "{{ hSet.value }}";
+ {% endfor %}
+ {% endif %}
+ {% if declaration.location.headers.to_server.delete -%}
+ {% for hDel in declaration.location.headers.to_server.delete -%}
+ proxy_set_header {{ hDel }} "";
+ {% endfor %}
+ {% endif %}
+ {% endif %}
+ {% if declaration.location.headers.to_client -%}
+ {% if declaration.location.headers.to_client.add -%}
+ {% for hAdd in declaration.location.headers.to_client.add -%}
+ add_header {{ hAdd.name }} "{{ hAdd.value }}";
+ {% endfor %}
+ {% endif %}
+ {% if declaration.location.headers.to_client.delete -%}
+ {% for hDel in declaration.location.headers.to_client.delete -%}
+ proxy_hide_header {{ hDel }};
+ {% endfor %}
+ {% endif %}
+ {% if declaration.location.headers.to_client.replace -%}
+ {% for hDel in declaration.location.headers.to_client.replace -%}
+ proxy_hide_header {{ hDel.name }};
+ add_header {{ hDel.name }} "{{ hDel.value }}";
+ {% endfor %}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+
+ {# --- Cache --- #}
+ {%- if declaration.location.apigateway.cache -%}
+ {%- for cacheEntry in declaration.location.apigateway.cache %}
+ {%- set enforceCache = namespace(toBeEnforced = False) -%}
+ {%- if cacheEntry.enforceOnPaths == False -%}
+ {%- set enforceCache.toBeEnforced = True -%}
+ {%- endif -%}
+ {%- for cachePath in cacheEntry.paths -%}
+ {%- if path.path == cachePath -%}
+ {%- if cacheEntry.enforceOnPaths == True -%}
+ {%- set enforceCache.toBeEnforced = True -%}
+ {%- else -%}
+ {%- set enforceCache.toBeEnforced = False -%}
+ {%- endif -%}
+ {%- endif -%}
+ {%- endfor -%}
+
+ {%- if enforceCache.toBeEnforced == True -%}
+ {%- if cacheEntry.profile %}proxy_cache {{ cacheEntry.profile | replace(' ', '_') }};
+
+ {% if cacheEntry.key %}proxy_cache_key "{{ cacheEntry.key }}";{% endif %}
+ {% endif %}
+
+ {% if cacheEntry.validity -%}
+ {% for validity in cacheEntry.validity -%}
+ proxy_cache_valid {{ validity.code }} {{ validity.ttl }};
+ {% endfor %}
+ {% endif %}
+ {%- endif -%}
+ {%- endfor -%}
+
+ {%- endif %}
+
+ {%- if declaration.location.apigateway.api_gateway.strip_uri -%}
+ rewrite ^{% if declaration.location.uri != "/" %}{{ declaration.location.uri }}{% endif %}/(.*)$ /$1 break;
+ {%- endif %}
+
+{% if path.use_method_upstreams %}
+ proxy_set_header Host $apigw_host_{{ path.var_suffix }};
+{% if path.any_ssl_name %}
+ proxy_ssl_server_name on;
+ proxy_ssl_name $apigw_ssl_name_{{ path.var_suffix }};
+{% endif %}
+
+ proxy_pass $apigw_scheme_{{ path.var_suffix }}://$apigw_upstream_{{ path.var_suffix }}$apigw_base_path_{{ path.var_suffix }}$uri$is_args$args;
+{% else %}
+{% set current_upstream = path.upstream if path.upstream is defined and path.upstream else declaration.upstream %}
+{% if current_upstream.host_header %}
+ proxy_set_header Host {{ current_upstream.host_header }};
+{% endif %}
+{% if current_upstream.ssl_name %}
+ proxy_ssl_server_name on;
+ proxy_ssl_name {{ current_upstream.ssl_name }};
+{% endif %}
+
+ proxy_pass {{ current_upstream.scheme }}://{{ current_upstream.name }}{{ current_upstream.base_path }}$uri$is_args$args;
+{% endif %}
+}
+
+{% endif %}
+{% endfor %}
+{% endif %}
diff --git a/templates/v5.7/apigateway/apigateway-upstreams.tmpl b/templates/v5.7/apigateway/apigateway-upstreams.tmpl
new file mode 100644
index 00000000..fc43ba92
--- /dev/null
+++ b/templates/v5.7/apigateway/apigateway-upstreams.tmpl
@@ -0,0 +1,23 @@
+# API Gateway upstream file - server {{ server }}
+# OpenAPI version: {{ declaration.version | replace('\n',' ') }}
+# Base URI: {{ declaration.location.uri | replace('\n',' ') }}
+{% set upstreams_list = declaration.upstreams if declaration.upstreams is defined and declaration.upstreams else ([declaration.upstream] if declaration.upstream else []) %}
+{% for u in upstreams_list %}
+{% if u and u.name and (u.servers or u.origin) %}
+
+# Destination server: {{ u.destination_server | replace('\n',' ') }}
+upstream {{ u.name }} {
+ zone {{ u.name }} 64k;
+{% if u.servers %}
+{% for s in u.servers %}
+ server {{ s.origin }}{% if s.resolve %} resolve{% endif %};
+{% endfor %}
+{% elif u.origin %}
+ server {{ u.origin }}{% if u.resolve %} resolve{% endif %};
+{% endif %}
+{% if u.resolver %}
+ include "{{ ncgconfig.nms.resolver_dir }}/{{ u.resolver | replace(" ", "_") }}.conf";
+{% endif %}
+}
+{% endif %}
+{% endfor %}
diff --git a/templates/v5.7/apigateway.tmpl b/templates/v5.7/apigateway/apigateway.tmpl
similarity index 72%
rename from templates/v5.7/apigateway.tmpl
rename to templates/v5.7/apigateway/apigateway.tmpl
index 75fd8fb7..3ec5e50e 100644
--- a/templates/v5.7/apigateway.tmpl
+++ b/templates/v5.7/apigateway/apigateway.tmpl
@@ -26,7 +26,7 @@ location {% if '{' not in path.path %}={% else %}~{% endif %} {% if declaration.
}
{% endif %}
- {%- if declaration.location.apigateway.api_gateway.enforce_response_codes -%}
+ {%- if declaration.location.apigateway.api_gateway.enforce_response_codes and not path.body_validation_enabled -%}
proxy_intercept_errors on;
{% endif %}
@@ -41,22 +41,22 @@ location {% if '{' not in path.path %}={% else %}~{% endif %} {% if declaration.
{%- set allParams = namespace(missing = '') -%}
{% for parm in method.parameters -%}
{% if parm.required | lower == "true" and ( parm.in | lower == "query" or parm.in | lower == "header" ) %}
- {% set allParams.missing = allParams.missing + "$missing_" + method.method + "_" + server | replace('.','_') + declaration.location.uri | replace('/','_') + path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') + "_" + parm.name %}
+ {% set allParams.missing = allParams.missing + "$missing_" + method.method | replace('-','_') | replace('.','_') + "_" + server | replace('.','_') + declaration.location.uri | replace('/','_') + path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') + "_" + parm.name %}
{% endif %}
{% endfor %}
{% if allParams.missing != '' -%}
- if ( $any_missing_{{ method.method }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') }}{{ path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} ) {
- return 422 '{"code":422,"message":"Missing required parameters [$required_params_{{ method.method }}_{{ server | replace('.','_') | replace('-','_') }}{{ declaration.location.uri | replace('-','_') | replace('/','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}]"}';
+ if ( $any_missing_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') }}{{ path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} ) {
+ return 422 '{"code":422,"message":"Missing required parameters [$required_params_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') | replace('-','_') }}{{ declaration.location.uri | replace('-','_') | replace('/','_') }}{{ path.path | replace('-','_') | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }}]"}';
}
- if ( $any_values_invalid_{{ method.method }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') }}{{ path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} ) {
+ if ( $any_values_invalid_{{ method.method | replace('-','_') | replace('.','_') }}_{{ server | replace('.','_') }}{{ declaration.location.uri | replace('/','_') }}{{ path.path | replace('/','_') | replace('.','_') | replace('{','_') | replace('}','_') }} ) {
return 422 '{"code":422,"message":"Invalid parameter value"}';
}
{%- endif %}
{% endif -%}
{# --- HTTP response codes enforcement --- -#}
- {%- if declaration.location.apigateway.api_gateway.enforce_response_codes -%}
+ {%- if declaration.location.apigateway.api_gateway.enforce_response_codes and not path.body_validation_enabled -%}
# Disallowed HTTP Response Codes
if ( $request_method = "{{ method.method | upper }}" ) {
error_page {{ method.details.disallowedResponseCodes | join(' ') }} =500 @apigw-error-page-500;
@@ -65,9 +65,9 @@ location {% if '{' not in path.path %}={% else %}~{% endif %} {% if declaration.
{% endfor -%}
- {% if declaration.location.apigateway.log.access %}access_log {{ declaration.location.apigateway.log.access.destination }}{% if declaration.location.apigateway.log.access.format %} {{ declaration.location.apigateway.log.access.format }}{% endif %}{% if declaration.location.apigateway.log.access.condition %} if={{ declaration.location.apigateway.log.access.condition }}{% endif %};{% endif %}
+ {% if declaration.location.apigateway.log and declaration.location.apigateway.log.access %}access_log {{ declaration.location.apigateway.log.access.destination }}{% if declaration.location.apigateway.log.access.format %} {{ declaration.location.apigateway.log.access.format }}{% endif %}{% if declaration.location.apigateway.log.access.condition %} if={{ declaration.location.apigateway.log.access.condition }}{% endif %};{% endif %}
- {% if declaration.location.apigateway.log.error %}error_log {{ declaration.location.apigateway.log.error.destination }}{% if declaration.location.apigateway.log.error.level %} {{ declaration.location.apigateway.log.error.level }}{% endif %};{% endif %}
+ {% if declaration.location.apigateway.log and declaration.location.apigateway.log.error %}error_log {{ declaration.location.apigateway.log.error.destination }}{% if declaration.location.apigateway.log.error.level %} {{ declaration.location.apigateway.log.error.level }}{% endif %};{% endif %}
{% if declaration.location.apigateway.api_gateway.enforce_methods -%}
@@ -160,6 +160,11 @@ location {% if '{' not in path.path %}={% else %}~{% endif %} {% if declaration.
{# --- Authorization end --- #}
+ {% if path.body_validation_enabled -%}
+ {# --- Request body schema enforcement via njs --- -#}
+ client_body_in_single_buffer on;
+ js_content {{ declaration.body_validation_njs_profile }}.{{ path.body_validation_js_func }};
+ {% else -%}
{# --- Cache --- #}
{%- if declaration.location.apigateway.cache -%}
{%- for cacheEntry in declaration.location.apigateway.cache %}
@@ -199,20 +204,32 @@ location {% if '{' not in path.path %}={% else %}~{% endif %} {% if declaration.
rewrite ^{% if declaration.location.uri != "/" %}{{ declaration.location.uri }}{% endif %}/(.*)$ /$1 break;
{%- endif %}
-{% if declaration.upstream.host_header %}
- proxy_set_header Host {{ declaration.upstream.host_header }};
+{% if path.use_method_upstreams %}
+ proxy_set_header Host $apigw_host_{{ path.var_suffix }};
+{% if path.any_ssl_name %}
+ proxy_ssl_server_name on;
+ proxy_ssl_name $apigw_ssl_name_{{ path.var_suffix }};
+{% endif %}
+
+ proxy_pass $apigw_scheme_{{ path.var_suffix }}://$apigw_upstream_{{ path.var_suffix }}$apigw_base_path_{{ path.var_suffix }}$uri$is_args$args;
+{% else %}
+{% set current_upstream = path.upstream if path.upstream is defined and path.upstream else declaration.upstream %}
+{% if current_upstream.host_header %}
+ proxy_set_header Host {{ current_upstream.host_header }};
{% endif %}
-{% if declaration.upstream.ssl_name %}
+{% if current_upstream.ssl_name %}
proxy_ssl_server_name on;
- proxy_ssl_name {{ declaration.upstream.ssl_name }};
+ proxy_ssl_name {{ current_upstream.ssl_name }};
{% endif %}
- proxy_pass {{ declaration.upstream.scheme }}://{{ declaration.upstream.name }}{{ declaration.upstream.base_path }}$uri$is_args$args;
+ proxy_pass {{ current_upstream.scheme }}://{{ current_upstream.name }}{{ current_upstream.base_path }}$uri$is_args$args;
+{% endif %}
+ {%- endif %}
}
{% endfor %}
-{% if declaration.location.apigateway.developer_portal.enabled == True -%}
+{% if declaration.location.apigateway.developer_portal and declaration.location.apigateway.developer_portal.enabled == True -%}
{% if declaration.location.apigateway.developer_portal.type.lower() == "redocly" %}
location = {% if declaration.location.uri != "/" %}{{ declaration.location.uri }}{% endif %}{{ declaration.location.apigateway.developer_portal.redocly.uri }} {
rewrite ^{% if declaration.location.uri != "/" %}{{ declaration.location.uri }}{% endif %}/(.*)$ /$1 break;
diff --git a/templates/v5.7/http.tmpl b/templates/v5.7/http.tmpl
index a547aa97..5d0d9532 100644
--- a/templates/v5.7/http.tmpl
+++ b/templates/v5.7/http.tmpl
@@ -1,11 +1,14 @@
# NGINX configuration file - HTTP servers - generated by https://github.com/f5devcentral/NGINX-Declarative-API
{# --- njs import section --- #}
-{% if declaration.http.njs_profiles %}
+{% if declaration.http.njs_profiles or apigw_njs_profiles %}
js_path "{{ ncgconfig.nms.njs_dir }}";
{% for njsp in declaration.http.njs_profiles %}
js_import {{ njsp.name | replace(" ", "_") }} from {{ njsp.name | replace(" ", "_") }}.js;
{% endfor %}
+{% for apigw_njsp in apigw_njs_profiles %}
+js_import {{ apigw_njsp }} from {{ apigw_njsp }}.js;
+{% endfor %}
{% endif %}
{# --- njs functions section - HTTP level --- #}
diff --git a/templates/v5.7/misc/server-http.tmpl b/templates/v5.7/misc/server-http.tmpl
index 294076b0..d5092c25 100644
--- a/templates/v5.7/misc/server-http.tmpl
+++ b/templates/v5.7/misc/server-http.tmpl
@@ -348,6 +348,12 @@ server {
}
{% endfor %}
+ {% for loc in s.locations %}
+ {%- if loc.apigateway and loc.apigateway.api_gateway.enabled == True and loc.apigateway.api_gateway.enforce_bodies -%}
+ include "{{ ncgconfig.nms.apigw_dir }}/{{ s.names[0] if s.names else s.name }}{{ loc.uri }}_proxy*.conf";
+ {% endif -%}
+ {% endfor %}
+
location @apigw-error-page-500 {
return 500;
}
diff --git a/tests/test_openapi_parser.py b/tests/test_openapi_parser.py
index d2ccceaa..982ca891 100644
--- a/tests/test_openapi_parser.py
+++ b/tests/test_openapi_parser.py
@@ -7,9 +7,11 @@
import v5_5.OpenAPIParser as oap_module
import v5_6.OpenAPIParser as oap_v56_module
+import v5_7.OpenAPIParser as oap_v57_module
OpenAPIParser = oap_module.OpenAPIParser
OpenAPIParser_v56 = oap_v56_module.OpenAPIParser
+OpenAPIParser_v57 = oap_v57_module.OpenAPIParser
# ---------------------------------------------------------------------------
@@ -212,3 +214,319 @@ def test_v56_paths(self):
parser = OpenAPIParser_v56(OPENAPI_3_SCHEMA)
paths = parser.paths()
assert any(p['path'] == '/users' for p in paths)
+
+
+# ---------------------------------------------------------------------------
+# v5.7 servers and variables tests
+# ---------------------------------------------------------------------------
+
+class TestOpenAPIServersV57:
+ def test_v57_servers_variables_substitution(self):
+ schema = {
+ 'openapi': '3.0.0',
+ 'servers': [
+ {
+ 'name': 'Production',
+ 'url': 'https://{username}.server.com:{port}/{version}',
+ 'description': 'Main server',
+ 'variables': {
+ 'username': {'default': 'demo', 'description': 'Username'},
+ 'port': {'default': '8443', 'enum': ['8443', '443']},
+ 'version': {'default': 'v1'},
+ },
+ },
+ {'url': 'https://secondary.server.com'},
+ ],
+ }
+ parser = OpenAPIParser_v57(schema)
+ servers = parser.servers()
+ assert len(servers) == 2
+ assert servers[0]['name'] == 'Production'
+ assert servers[0]['url'] == 'https://demo.server.com:8443/v1'
+ assert servers[0]['description'] == 'Main server'
+ assert servers[1]['url'] == 'https://secondary.server.com'
+
+ def test_v57_paths_servers(self):
+ schema = {
+ 'openapi': '3.0.0',
+ 'paths': {
+ '/items': {
+ 'servers': [
+ {'url': 'https://items1.server.com'},
+ {
+ 'url': 'https://{region}.items2.server.com',
+ 'variables': {'region': {'default': 'us-west'}},
+ },
+ ],
+ 'get': {'summary': 'List items'},
+ },
+ '/status': {
+ 'get': {'summary': 'Status check'},
+ },
+ },
+ }
+ parser = OpenAPIParser_v57(schema)
+ paths = parser.paths()
+ items_p = next(p for p in paths if p['path'] == '/items')
+ status_p = next(p for p in paths if p['path'] == '/status')
+
+ assert 'servers' in items_p
+ assert len(items_p['servers']) == 2
+ assert items_p['servers'][0]['url'] == 'https://items1.server.com'
+ assert items_p['servers'][1]['url'] == 'https://us-west.items2.server.com'
+
+ assert 'servers' not in status_p
+
+ def test_v57_operation_servers(self):
+ schema = {
+ 'openapi': '3.0.0',
+ 'servers': [{'url': 'https://server1.com'}],
+ 'paths': {
+ '/users': {
+ 'get': {
+ 'summary': 'List users',
+ 'servers': [
+ {
+ 'url': 'https://{region}.server2.com',
+ 'variables': {'region': {'default': 'eu'}},
+ }
+ ],
+ },
+ 'post': {'summary': 'Create user'},
+ },
+ },
+ }
+ parser = OpenAPIParser_v57(schema)
+ paths = parser.paths()
+ users_p = next(p for p in paths if p['path'] == '/users')
+ get_m = next(m for m in users_p['methods'] if m['method'] == 'get')
+ post_m = next(m for m in users_p['methods'] if m['method'] == 'post')
+
+ assert 'servers' in get_m
+ assert get_m['servers'][0]['url'] == 'https://eu.server2.com'
+ assert 'servers' not in post_m
+
+
+# ---------------------------------------------------------------------------
+# v5.7 OAS 2.0 (Swagger 2.0) tests
+# ---------------------------------------------------------------------------
+
+class TestSwagger2SupportV57:
+ def test_v57_swagger2_servers_from_host_basepath_schemes(self):
+ schema = {
+ 'swagger': '2.0',
+ 'info': {'title': 'Petstore v2', 'version': '2.0.0'},
+ 'host': 'petstore.swagger.io',
+ 'basePath': '/v2',
+ 'schemes': ['https', 'http'],
+ }
+ parser = OpenAPIParser_v57(schema)
+ assert parser.servers() == [{'url': 'https://petstore.swagger.io/v2'}]
+
+ def test_v57_swagger2_servers_http_and_default_scheme_and_relative_basepath(self):
+ schema_http = {
+ 'swagger': '2.0',
+ 'host': 'api.internal.lan:8080',
+ 'basePath': '/api/',
+ 'schemes': ['ws', 'http'],
+ }
+ assert OpenAPIParser_v57(schema_http).servers() == [{'url': 'http://api.internal.lan:8080/api'}]
+
+ schema_no_schemes_port = {
+ 'swagger': '2.0',
+ 'host': 'backend.local:9000',
+ }
+ assert OpenAPIParser_v57(schema_no_schemes_port).servers() == [{'url': 'http://backend.local:9000'}]
+
+ schema_relative = {
+ 'swagger': '2.0',
+ 'basePath': '/v2',
+ }
+ assert OpenAPIParser_v57(schema_relative).servers() == [{'url': '/v2'}]
+
+ def test_v57_swagger2_body_enforcement_in_body_and_consumes(self):
+ schema = {
+ 'swagger': '2.0',
+ 'info': {'title': 'Swagger Body API', 'version': '1.0'},
+ 'consumes': ['application/json', 'application/xml'],
+ 'paths': {
+ '/pets': {
+ 'post': {
+ 'operationId': 'addPet',
+ 'parameters': [
+ {'in': 'body', 'name': 'body', 'required': True, 'schema': {'$ref': '#/definitions/Pet'}},
+ ],
+ 'responses': {'200': {'description': 'ok'}, '405': {'description': 'invalid'}},
+ },
+ 'put': {
+ 'operationId': 'updatePet',
+ 'consumes': ['application/yaml'],
+ 'parameters': [
+ {'in': 'body', 'name': 'body', 'required': False, 'schema': {'$ref': '#/definitions/Pet'}},
+ ],
+ },
+ 'get': {
+ 'operationId': 'listPets',
+ },
+ }
+ },
+ }
+ parser = OpenAPIParser_v57(schema)
+ paths = parser.paths()
+ pets_p = next(p for p in paths if p['path'] == '/pets')
+ post_m = next(m for m in pets_p['methods'] if m['method'] == 'post')
+ put_m = next(m for m in pets_p['methods'] if m['method'] == 'put')
+ get_m = next(m for m in pets_p['methods'] if m['method'] == 'get')
+
+ assert post_m['details']['requestBodyRequired'] is True
+ assert post_m['details']['requestBodyContentType'] == ['application/json', 'application/xml']
+ assert '405' not in post_m['details']['disallowedResponseCodes']
+
+ assert put_m['details']['requestBodyRequired'] is False
+ assert put_m['details']['requestBodyContentType'] == ['application/yaml']
+
+ assert get_m['details']['requestBodyRequired'] is False
+ assert get_m['details']['requestBodyContentType'] == []
+
+ def test_v57_swagger2_parameter_direct_type_default_enum_and_array_items(self):
+ schema = {
+ 'swagger': '2.0',
+ 'info': {'title': 'Swagger Enum API', 'version': '1.0'},
+ 'paths': {
+ '/pets/findByStatus': {
+ 'get': {
+ 'operationId': 'findPetsByStatus',
+ 'parameters': [
+ {
+ 'name': 'format',
+ 'in': 'query',
+ 'required': True,
+ 'type': 'string',
+ 'default': 'json',
+ 'enum': ['json', 'xml'],
+ },
+ {
+ 'name': 'status',
+ 'in': 'query',
+ 'required': True,
+ 'type': 'array',
+ 'items': {
+ 'type': 'string',
+ 'enum': ['available', 'pending', 'sold'],
+ 'default': 'available',
+ },
+ },
+ {
+ 'name': 'X-Env',
+ 'in': 'header',
+ 'required': True,
+ 'type': 'string',
+ 'enum': ['prod', 'staging'],
+ },
+ ],
+ }
+ }
+ },
+ }
+ parser = OpenAPIParser_v57(schema)
+ paths = parser.paths()
+ get_m = paths[0]['methods'][0]
+
+ fmt_param = next(p for p in get_m['parameters'] if p['name'] == 'format')
+ assert fmt_param['schema'] == {'type': 'string', 'default': 'json', 'enum': ['json', 'xml']}
+
+ status_param = next(p for p in get_m['parameters'] if p['name'] == 'status')
+ assert status_param['schema'] == {
+ 'type': 'array',
+ 'default': 'available',
+ 'enum': ['available', 'pending', 'sold'],
+ }
+
+ hdr_param = next(p for p in get_m['parameters'] if p['name'] == 'X-Env')
+ assert hdr_param['schema'] == {'type': 'string', 'default': '', 'enum': ['prod', 'staging']}
+
+
+# ---------------------------------------------------------------------------
+# v5.7 OAS 3.2.x support tests (additionalOperations, QUERY ignored)
+# ---------------------------------------------------------------------------
+
+class TestOAS32SupportV57:
+ def test_v57_oas32_query_method_ignored(self):
+ schema = {
+ 'openapi': '3.2.0',
+ 'info': {'title': 'OAS 3.2 Search API', 'version': '1.0.0'},
+ 'servers': [{'name': 'Primary', 'url': 'https://api.example.com'}],
+ 'paths': {
+ '/search': {
+ 'query': {
+ 'operationId': 'searchItems',
+ 'summary': 'Query items with a body',
+ 'responses': {'200': {'description': 'OK'}},
+ },
+ 'additionalOperations': {
+ 'QUERY': {
+ 'operationId': 'additionalQueryItems',
+ 'responses': {'200': {'description': 'OK'}},
+ },
+ },
+ }
+ },
+ }
+ parser = OpenAPIParser_v57(schema)
+ assert parser.version() == '3.2.0'
+ assert parser.servers() == [{'url': 'https://api.example.com', 'name': 'Primary'}]
+
+ paths = parser.paths()
+ assert len(paths) == 1
+ assert paths[0]['methods'] == []
+
+ def test_v57_oas32_additional_operations_parsed(self):
+ schema = {
+ 'openapi': '3.2.0',
+ 'info': {'title': 'OAS 3.2 Extended Methods API', 'version': '1.0.0'},
+ 'paths': {
+ '/items': {
+ 'parameters': [
+ {
+ 'name': 'tenant',
+ 'in': 'header',
+ 'required': True,
+ 'schema': {'type': 'string', 'enum': ['acme', 'globex']},
+ }
+ ],
+ 'get': {
+ 'operationId': 'listItems',
+ 'responses': {'200': {'description': 'OK'}},
+ },
+ 'additionalOperations': {
+ 'PURGE': {
+ 'operationId': 'purgeItems',
+ 'responses': {'204': {'description': 'Purged'}},
+ },
+ 'M-SEARCH': {
+ 'operationId': 'msearchItems',
+ 'servers': [{'name': 'Search Backend', 'url': 'https://search.example.com'}],
+ 'responses': {'200': {'description': 'OK'}},
+ },
+ # Duplicate top-level method and malformed token should be skipped
+ 'get': {'operationId': 'dupGet'},
+ 'INVALID METHOD': {'operationId': 'badToken'},
+ },
+ }
+ },
+ }
+ parser = OpenAPIParser_v57(schema)
+ paths = parser.paths()
+ methods_by_name = {m['method']: m for m in paths[0]['methods']}
+ assert set(methods_by_name.keys()) == {'get', 'PURGE', 'M-SEARCH'}
+
+ assert methods_by_name['get']['details']['operationId'] == 'listItems'
+ purge_m = methods_by_name['PURGE']
+ assert purge_m['details']['operationId'] == 'purgeItems'
+ assert '204' not in purge_m['details']['disallowedResponseCodes']
+ assert purge_m['parameters'][0]['name'] == 'tenant'
+ assert purge_m['parameters'][0]['schema']['enum'] == ['acme', 'globex']
+
+ msearch_m = methods_by_name['M-SEARCH']
+ assert msearch_m['details']['operationId'] == 'msearchItems'
+ assert msearch_m['servers'] == [{'url': 'https://search.example.com', 'name': 'Search Backend'}]
diff --git a/tests/test_v5_7_apigateway_servers.py b/tests/test_v5_7_apigateway_servers.py
new file mode 100644
index 00000000..8953dfec
--- /dev/null
+++ b/tests/test_v5_7_apigateway_servers.py
@@ -0,0 +1,476 @@
+"""
+Unit tests for v5.7 API Gateway upstreams and OpenAPI servers specification support.
+"""
+import base64
+import json
+import os
+import pytest
+
+from NcgConfig import NcgConfig
+import V5_7_CreateConfig
+from V5_7_ConfigBuilder import ConfigBuildContext, build_config_files
+
+REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+
+
+@pytest.fixture(autouse=True)
+def setup_ncg_config():
+ NcgConfig._instance = None
+ NcgConfig(os.path.join(REPO_ROOT, "etc", "config.yaml"))
+ NcgConfig.config['templates']['root_dir'] = os.path.join(REPO_ROOT, 'templates')
+
+
+def _build_test_declaration(
+ openapi_schema: dict,
+ server_url: str = "https://fallback.example.com",
+ with_resolver: bool = False,
+) -> dict:
+ b64_schema = base64.b64encode(json.dumps(openapi_schema).encode()).decode()
+ decl = {
+ 'output': {'type': 'nms'},
+ 'declaration': {
+ 'http': {
+ 'servers': [
+ {
+ 'name': 'test_apigw',
+ 'names': ['test_apigw.example.com'],
+ 'resolver': 'Google' if with_resolver else '',
+ 'log': None,
+ 'locations': [
+ {
+ 'uri': '/gw',
+ 'log': None,
+ 'apigateway': {
+ 'api_gateway': {
+ 'enabled': True,
+ 'strip_uri': True,
+ 'server_url': server_url,
+ },
+ 'openapi_schema': {
+ 'content': b64_schema,
+ },
+ },
+ }
+ ],
+ }
+ ]
+ }
+ },
+ }
+ if with_resolver:
+ decl['declaration']['resolvers'] = [
+ {
+ 'name': 'Google',
+ 'address': '8.8.8.8',
+ 'ipv4': True,
+ 'ipv6': False,
+ 'timeout': '30s',
+ }
+ ]
+ return decl
+
+
+class TestV57ApiGatewayServers:
+ def test_root_servers_multiple_entries(self):
+ schema = {
+ 'openapi': '3.0.0',
+ 'info': {'title': 'Root Multi-Servers API', 'version': '1.0.0'},
+ 'servers': [
+ {'url': 'https://srv1.example.com'},
+ {'url': 'https://srv2.example.com'},
+ {'url': 'https://srv3.example.com:8443'},
+ ],
+ 'paths': {
+ '/items': {'get': {'summary': 'List items'}},
+ },
+ }
+ decl = _build_test_declaration(schema)
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ upstreams_file = next(f for f in ctx.configFiles['files'] if 'upstream' in f['name'].lower())
+ content = base64.b64decode(upstreams_file['contents']).decode()
+
+ assert 'upstream apigw_test_apigw_gw {' in content
+ assert 'zone apigw_test_apigw_gw 64k;' in content
+ assert 'server srv1.example.com:443;' in content
+ assert 'server srv2.example.com:443;' in content
+ assert 'server srv3.example.com:8443;' in content
+
+ def test_per_path_servers_override(self):
+ schema = {
+ 'openapi': '3.0.0',
+ 'info': {'title': 'Per-Path Servers API', 'version': '1.0.0'},
+ 'servers': [
+ {'url': 'https://default.example.com'},
+ ],
+ 'paths': {
+ '/standard': {
+ 'get': {'summary': 'Standard path'},
+ },
+ '/dedicated': {
+ 'servers': [
+ {'url': 'https://dedicated1.example.com'},
+ {'url': 'https://dedicated2.example.com'},
+ ],
+ 'get': {'summary': 'Dedicated path'},
+ },
+ },
+ }
+ decl = _build_test_declaration(schema)
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ upstreams_file = next(f for f in ctx.configFiles['files'] if 'upstream' in f['name'].lower())
+ upstreams_content = base64.b64decode(upstreams_file['contents']).decode()
+
+ # Both the default upstream and the dedicated path upstream must exist
+ assert 'upstream apigw_test_apigw_gw {' in upstreams_content
+ assert 'zone apigw_test_apigw_gw 64k;' in upstreams_content
+ assert 'server default.example.com:443;' in upstreams_content
+
+ assert 'upstream apigw_test_apigw_gw_dedicated {' in upstreams_content
+ assert 'zone apigw_test_apigw_gw_dedicated 64k;' in upstreams_content
+ assert 'server dedicated1.example.com:443;' in upstreams_content
+ assert 'server dedicated2.example.com:443;' in upstreams_content
+
+ # Location file routing checks
+ location_file = next(
+ f for f in ctx.configFiles['files']
+ if 'apigateway' in f['name'].lower() and 'upstreams' not in f['name'].lower() and 'maps' not in f['name'].lower()
+ )
+ location_content = base64.b64decode(location_file['contents']).decode()
+
+ assert 'proxy_pass https://apigw_test_apigw_gw$uri$is_args$args;' in location_content
+ assert 'proxy_pass https://apigw_test_apigw_gw_dedicated$uri$is_args$args;' in location_content
+
+ def test_open_meteo_path_only_servers_overrides_server_url(self):
+ schema = {
+ 'openapi': '3.0.0',
+ 'info': {'title': 'Open-Meteo APIs', 'version': '1.0'},
+ 'paths': {
+ '/v1/forecast': {
+ 'servers': [
+ {'url': 'https://api.open-meteo.com'},
+ {'url': 'https://customer-api.open-meteo.com'},
+ ],
+ 'get': {'summary': '7 day weather forecast for coordinates'},
+ },
+ },
+ }
+ decl = _build_test_declaration(schema, server_url='https://fallback.open-meteo.com', with_resolver=True)
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ upstreams_file = next(f for f in ctx.configFiles['files'] if 'upstream' in f['name'].lower())
+ upstreams_content = base64.b64decode(upstreams_file['contents']).decode()
+
+ assert 'upstream apigw_test_apigw_gw_v1_forecast {' in upstreams_content
+ assert 'zone apigw_test_apigw_gw_v1_forecast 64k;' in upstreams_content
+ assert 'server api.open-meteo.com:443 resolve;' in upstreams_content
+ assert 'server customer-api.open-meteo.com:443 resolve;' in upstreams_content
+ assert 'fallback.open-meteo.com' not in upstreams_content
+
+ location_file = next(
+ f for f in ctx.configFiles['files']
+ if 'apigateway' in f['name'].lower() and 'upstreams' not in f['name'].lower() and 'maps' not in f['name'].lower()
+ )
+ location_content = base64.b64decode(location_file['contents']).decode()
+ assert 'proxy_pass https://apigw_test_apigw_gw_v1_forecast$uri$is_args$args;' in location_content
+
+ def test_server_variables_substitution(self):
+ schema = {
+ 'openapi': '3.0.0',
+ 'info': {'title': 'Variables API', 'version': '1.0.0'},
+ 'servers': [
+ {
+ 'url': 'https://{env}.api.example.com:{port}/{version}',
+ 'variables': {
+ 'env': {'default': 'prod'},
+ 'port': {'default': '8443'},
+ 'version': {'default': 'v1'},
+ },
+ },
+ ],
+ 'paths': {
+ '/status': {
+ 'get': {'summary': 'Status path'},
+ },
+ '/data': {
+ 'servers': [
+ {
+ 'url': 'https://{region}.data.example.com:{port}',
+ 'variables': {
+ 'region': {'default': 'us-east'},
+ 'port': {'default': '9443'},
+ },
+ },
+ ],
+ 'get': {'summary': 'Data path'},
+ },
+ },
+ }
+ decl = _build_test_declaration(schema)
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ upstreams_file = next(f for f in ctx.configFiles['files'] if 'upstream' in f['name'].lower())
+ upstreams_content = base64.b64decode(upstreams_file['contents']).decode()
+
+ # Root server resolved variables
+ assert 'upstream apigw_test_apigw_gw {' in upstreams_content
+ assert 'zone apigw_test_apigw_gw 64k;' in upstreams_content
+ assert 'server prod.api.example.com:8443;' in upstreams_content
+
+ # Dedicated path upstream resolved variables
+ assert 'upstream apigw_test_apigw_gw_data {' in upstreams_content
+ assert 'zone apigw_test_apigw_gw_data 64k;' in upstreams_content
+ assert 'server us-east.data.example.com:9443;' in upstreams_content
+
+ location_file = next(
+ f for f in ctx.configFiles['files']
+ if 'apigateway' in f['name'].lower() and 'upstreams' not in f['name'].lower() and 'maps' not in f['name'].lower()
+ )
+ location_content = base64.b64decode(location_file['contents']).decode()
+ assert 'proxy_pass https://apigw_test_apigw_gw/v1$uri$is_args$args;' in location_content
+ assert 'proxy_pass https://apigw_test_apigw_gw_data$uri$is_args$args;' in location_content
+
+ def test_operation_level_servers_single_and_multi_method(self):
+ schema = {
+ 'openapi': '3.0.0',
+ 'info': {'title': 'Operation Servers API', 'version': '1.0.0'},
+ 'servers': [{'url': 'https://server1.example.com'}],
+ 'paths': {
+ '/single': {
+ 'get': {
+ 'summary': 'Single method override',
+ 'servers': [{'url': 'https://server2.example.com'}],
+ },
+ },
+ '/users': {
+ 'get': {
+ 'summary': 'Read users',
+ 'servers': [{'url': 'https://read.example.com/v2'}],
+ },
+ 'post': {
+ 'summary': 'Write users',
+ },
+ },
+ },
+ }
+ decl = _build_test_declaration(schema)
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ upstreams_file = next(f for f in ctx.configFiles['files'] if 'upstream' in f['name'].lower())
+ upstreams_content = base64.b64decode(upstreams_file['contents']).decode()
+ assert 'upstream apigw_test_apigw_gw {' in upstreams_content
+ assert 'server server1.example.com:443;' in upstreams_content
+ assert 'upstream apigw_test_apigw_gw_single_get {' in upstreams_content
+ assert 'server server2.example.com:443;' in upstreams_content
+ assert 'upstream apigw_test_apigw_gw_users_get {' in upstreams_content
+ assert 'server read.example.com:443;' in upstreams_content
+
+ maps_file = next(f for f in ctx.configFiles['files'] if 'maps' in f['name'].lower())
+ maps_content = base64.b64decode(maps_file['contents']).decode()
+ assert 'map $request_method $apigw_upstream_' in maps_content
+ assert '"GET" "apigw_test_apigw_gw_users_get";' in maps_content
+ assert '"POST" "apigw_test_apigw_gw";' in maps_content
+
+ location_file = next(
+ f for f in ctx.configFiles['files']
+ if 'apigateway' in f['name'].lower() and 'upstreams' not in f['name'].lower() and 'maps' not in f['name'].lower()
+ )
+ location_content = base64.b64decode(location_file['contents']).decode()
+ assert 'proxy_pass https://apigw_test_apigw_gw_single_get$uri$is_args$args;' in location_content
+ assert 'proxy_pass $apigw_scheme_' in location_content
+
+ def test_relative_server_urls_and_unresolved_variable_error(self):
+ schema_rel = {
+ 'openapi': '3.0.0',
+ 'info': {'title': 'Relative Servers API', 'version': '1.0.0'},
+ 'servers': [{'url': '/v1'}],
+ 'paths': {
+ '/ping': {'get': {'summary': 'Ping'}},
+ '/dot': {'servers': [{'url': '.'}], 'get': {'summary': 'Dot'}},
+ },
+ }
+ decl = _build_test_declaration(schema_rel, server_url='https://api.example.com')
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ location_file = next(
+ f for f in ctx.configFiles['files']
+ if 'apigateway' in f['name'].lower() and 'upstreams' not in f['name'].lower() and 'maps' not in f['name'].lower()
+ )
+ location_content = base64.b64decode(location_file['contents']).decode()
+ assert 'proxy_pass https://apigw_test_apigw_gw/v1$uri$is_args$args;' in location_content
+ assert 'proxy_pass https://apigw_test_apigw_gw_dot$uri$is_args$args;' in location_content
+
+ schema_bad = {
+ 'openapi': '3.0.0',
+ 'info': {'title': 'Bad Var API', 'version': '1.0.0'},
+ 'servers': [{'url': 'https://{missing_var}.example.com'}],
+ 'paths': {'/ping': {'get': {'summary': 'Ping'}}},
+ }
+ ctx_bad = ConfigBuildContext(_build_test_declaration(schema_bad), 'v5.7')
+ err_bad = build_config_files(ctx_bad)
+ assert err_bad is not None
+ assert err_bad['status_code'] == 422
+
+ def test_swagger2_end_to_end_upstream_body_and_enum_maps(self):
+ schema_swagger2 = {
+ 'swagger': '2.0',
+ 'info': {'title': 'Swagger Petstore v2', 'version': '1.0.6'},
+ 'host': 'petstore.swagger.io',
+ 'basePath': '/v2',
+ 'schemes': ['https', 'http'],
+ 'consumes': ['application/json', 'application/xml'],
+ 'paths': {
+ '/pet': {
+ 'post': {
+ 'operationId': 'addPet',
+ 'parameters': [
+ {'in': 'body', 'name': 'body', 'required': True, 'schema': {'$ref': '#/definitions/Pet'}},
+ ],
+ 'responses': {'200': {'description': 'OK'}, '405': {'description': 'Invalid input'}},
+ }
+ },
+ '/pet/findByStatus': {
+ 'get': {
+ 'operationId': 'findPetsByStatus',
+ 'parameters': [
+ {
+ 'name': 'status',
+ 'in': 'query',
+ 'required': True,
+ 'type': 'array',
+ 'items': {
+ 'type': 'string',
+ 'enum': ['available', 'pending', 'sold'],
+ 'default': 'available',
+ },
+ },
+ {
+ 'name': 'X-Tier',
+ 'in': 'header',
+ 'required': True,
+ 'type': 'string',
+ 'enum': ['gold', 'silver'],
+ },
+ ],
+ 'responses': {'200': {'description': 'OK'}},
+ }
+ },
+ },
+ }
+ # Explicitly omit apigateway.api_gateway.server_url to verify host/basePath/schemes resolution
+ decl = _build_test_declaration(schema_swagger2, server_url='')
+ apigw_cfg = decl['declaration']['http']['servers'][0]['locations'][0]['apigateway']['api_gateway']
+ apigw_cfg['enforce_bodies'] = True
+ apigw_cfg['enforce_parameters'] = True
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ upstreams_file = next(f for f in ctx.configFiles['files'] if 'upstream' in f['name'].lower())
+ upstreams_content = base64.b64decode(upstreams_file['contents']).decode()
+ assert 'upstream apigw_test_apigw_gw {' in upstreams_content
+ assert 'server petstore.swagger.io:443;' in upstreams_content
+
+ location_file = next(
+ f for f in ctx.configFiles['files']
+ if 'apigateway' in f['name'].lower() and 'upstreams' not in f['name'].lower() and 'maps' not in f['name'].lower()
+ )
+ location_content = base64.b64decode(location_file['contents']).decode()
+ assert 'proxy_pass https://apigw_test_apigw_gw/v2$uri$is_args$args;' in location_content
+ assert '$is_request_body_check_' in location_content
+ assert '$any_values_invalid_get_' in location_content
+
+ maps_file = next(f for f in ctx.configFiles['files'] if 'maps' in f['name'].lower())
+ maps_content = base64.b64decode(maps_file['contents']).decode()
+ assert 'application/json' in maps_content
+ assert 'application/xml' in maps_content
+ assert 'GETtest_apigw.example.com/gw/pet/findByStatus-available' in maps_content
+ assert 'GETtest_apigw.example.com/gw/pet/findByStatus-pending' in maps_content
+ assert 'GETtest_apigw.example.com/gw/pet/findByStatus-sold' in maps_content
+ assert 'GETtest_apigw.example.com/gw/pet/findByStatus-gold' in maps_content
+
+ def test_oas32_additional_operations_end_to_end(self):
+ schema_oas32 = {
+ 'openapi': '3.2.0',
+ 'info': {'title': 'OAS 3.2 API', 'version': '1.0.0'},
+ 'servers': [{'name': 'DefaultOrigin', 'url': 'https://origin.example.com'}],
+ 'paths': {
+ '/records': {
+ 'parameters': [
+ {
+ 'name': 'mode',
+ 'in': 'query',
+ 'required': True,
+ 'schema': {'type': 'string', 'enum': ['fast', 'deep']},
+ }
+ ],
+ 'query': {
+ 'operationId': 'queryRecords',
+ 'responses': {'200': {'description': 'OK'}},
+ },
+ 'post': {
+ 'operationId': 'createRecord',
+ 'requestBody': {
+ 'required': True,
+ 'content': {'application/json': {'schema': {'type': 'object'}}},
+ },
+ 'responses': {'201': {'description': 'Created'}},
+ },
+ 'additionalOperations': {
+ 'PURGE': {
+ 'operationId': 'purgeRecords',
+ 'responses': {'204': {'description': 'Purged'}},
+ },
+ 'M-SEARCH': {
+ 'operationId': 'msearchRecords',
+ 'servers': [{'name': 'SearchPool', 'url': 'https://search.example.com'}],
+ 'responses': {'200': {'description': 'OK'}},
+ },
+ },
+ }
+ },
+ }
+ decl = _build_test_declaration(schema_oas32, server_url='')
+ apigw_cfg = decl['declaration']['http']['servers'][0]['locations'][0]['apigateway']['api_gateway']
+ apigw_cfg['enforce_methods'] = True
+ apigw_cfg['enforce_bodies'] = True
+ apigw_cfg['enforce_parameters'] = True
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ location_file = next(
+ f for f in ctx.configFiles['files']
+ if 'apigateway' in f['name'].lower() and 'upstreams' not in f['name'].lower() and 'maps' not in f['name'].lower()
+ )
+ location_content = base64.b64decode(location_file['contents']).decode()
+ assert '# OpenAPI version: 3.2.0' in location_content
+ assert 'queryRecords' not in location_content
+ assert '# POST - operationId: createRecord' in location_content
+ assert '# PURGE - operationId: purgeRecords' in location_content
+ assert '# M-SEARCH - operationId: msearchRecords' in location_content
+ assert 'limit_except POST PURGE M-SEARCH { deny all; }' in location_content
+ assert '$any_missing_M_SEARCH_' in location_content
+ assert '$any_values_invalid_M_SEARCH_' in location_content
+ assert '$any_missing_M-SEARCH_' not in location_content
+
+ maps_file = next(f for f in ctx.configFiles['files'] if 'maps' in f['name'].lower())
+ maps_content = base64.b64decode(maps_file['contents']).decode()
+ assert 'POST-test_apigw.example.com-/gw/records-' in maps_content
+ assert 'POSTtest_apigw.example.com/gw/records-fast' in maps_content
+ assert 'PURGEtest_apigw.example.com/gw/records-deep' in maps_content
+ assert '$wrongvalue_M_SEARCH_' in maps_content
+ assert '"M-SEARCH" "apigw_test_apigw_gw_records_m-search";' in maps_content
diff --git a/tests/test_v5_7_request_body_schema.py b/tests/test_v5_7_request_body_schema.py
new file mode 100644
index 00000000..c4897444
--- /dev/null
+++ b/tests/test_v5_7_request_body_schema.py
@@ -0,0 +1,912 @@
+"""Tests for v5.7 API Gateway OpenAPI request body schema enforcement."""
+
+import base64
+import copy
+import json
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+
+import pytest
+
+REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+SRC_DIR = os.path.join(REPO_ROOT, 'src')
+if SRC_DIR not in sys.path:
+ sys.path.insert(0, SRC_DIR)
+
+from NcgConfig import NcgConfig # noqa: E402
+from V5_7_ConfigBuilder import ( # noqa: E402
+ ConfigBuildContext,
+ _render_main_configs,
+ build_config_files,
+)
+from v5_7.NGINXOneOutput import ( # noqa: E402
+ _build_rendered_config_files as n1_build_rendered_config_files,
+)
+from v5_7.NIMOutput import ( # noqa: E402
+ _build_rendered_config_files as nim_build_rendered_config_files,
+)
+from v5_7.OpenAPIParser import OpenAPIParser # noqa: E402
+
+
+@pytest.fixture(autouse=True)
+def setup_ncg_config():
+ NcgConfig._instance = None
+ NcgConfig(os.path.join(REPO_ROOT, 'etc', 'config.yaml'))
+ NcgConfig.config['templates']['root_dir'] = os.path.join(REPO_ROOT, 'templates')
+
+
+def _build_test_declaration(
+ openapi_schema: dict,
+ server_url: str = 'https://backend.example.com',
+ enforce_bodies: bool = True,
+ modules=None,
+ output_type: str = 'nms',
+) -> dict:
+ b64_schema = base64.b64encode(json.dumps(openapi_schema).encode('utf-8')).decode('utf-8')
+ out_cfg = {'type': output_type}
+ if modules is not None:
+ out_cfg['nms'] = {'modules': list(modules)}
+ return {
+ 'output': out_cfg,
+ 'declaration': {
+ 'http': {
+ 'servers': [
+ {
+ 'name': 'test_apigw',
+ 'names': ['test_apigw.example.com'],
+ 'resolver': '',
+ 'log': None,
+ 'locations': [
+ {
+ 'uri': '/gw',
+ 'log': None,
+ 'apigateway': {
+ 'api_gateway': {
+ 'enabled': True,
+ 'strip_uri': True,
+ 'server_url': server_url,
+ 'enforce_bodies': enforce_bodies,
+ 'enforce_response_codes': True,
+ },
+ 'openapi_schema': {
+ 'content': b64_schema,
+ },
+ },
+ }
+ ],
+ }
+ ]
+ }
+ },
+ }
+
+
+def _decode_b64(text: str) -> str:
+ return base64.urlsafe_b64decode(text.encode('utf-8')).decode('utf-8')
+
+
+def _find_file(container: dict, predicate) -> dict:
+ return next(f for f in container['files'] if predicate(f))
+
+
+# ---------------------------------------------------------------------------
+# OpenAPIParser requestBodySchemas & schema_defs tests
+# ---------------------------------------------------------------------------
+
+
+class TestOpenAPIParserRequestBodySchemas:
+ def test_oas30_inline_and_ref_and_request_body_ref(self):
+ doc = {
+ 'openapi': '3.0.3',
+ 'components': {
+ 'schemas': {
+ 'Address': {
+ 'type': 'object',
+ 'required': ['city'],
+ 'properties': {'city': {'type': 'string'}},
+ },
+ 'User': {
+ 'type': 'object',
+ 'required': ['name'],
+ 'properties': {
+ 'name': {'type': 'string'},
+ 'address': {'$ref': '#/components/schemas/Address'},
+ },
+ },
+ },
+ 'requestBodies': {
+ 'UserBody': {
+ 'required': True,
+ 'content': {
+ 'application/json': {
+ 'schema': {'$ref': '#/components/schemas/User'}
+ }
+ },
+ }
+ },
+ },
+ 'paths': {
+ '/users': {
+ 'post': {
+ 'requestBody': {'$ref': '#/components/requestBodies/UserBody'},
+ 'responses': {'201': {'description': 'Created'}},
+ }
+ },
+ '/items': {
+ 'put': {
+ 'requestBody': {
+ 'required': False,
+ 'content': {
+ 'application/json': {
+ 'schema': {
+ 'type': 'object',
+ 'properties': {'qty': {'type': 'integer'}},
+ }
+ }
+ },
+ },
+ 'responses': {'200': {'description': 'OK'}},
+ }
+ },
+ '/health': {
+ 'get': {'responses': {'200': {'description': 'OK'}}}
+ },
+ },
+ }
+
+ parser = OpenAPIParser(doc)
+ parsed_paths = parser.paths()
+ by_path = {p['path']: p for p in parsed_paths}
+
+ post_details = by_path['/users']['methods'][0]['details']
+ assert post_details['requestBodyRequired'] is True
+ assert post_details['requestBodyContentType'] == ['application/json']
+ assert post_details['requestBodySchemas'] == {
+ 'application/json': {'$ref': '#/components/schemas/User'}
+ }
+
+ put_details = by_path['/items']['methods'][0]['details']
+ assert put_details['requestBodyRequired'] is False
+ assert put_details['requestBodySchemas']['application/json']['type'] == 'object'
+
+ get_details = by_path['/health']['methods'][0]['details']
+ assert get_details['requestBodySchemas'] == {}
+
+ schema_defs = parser.request_body_schema_defs(parsed_paths)
+ assert '#/components/schemas/User' in schema_defs
+ assert '#/components/schemas/Address' in schema_defs
+ assert schema_defs['#/components/schemas/Address']['required'] == ['city']
+
+ def test_oas31_defs_boolean_schemas_type_array_and_cyclic_ref(self):
+ doc = {
+ 'openapi': '3.1.0',
+ '$defs': {
+ 'Node': {
+ 'type': 'object',
+ 'required': ['id'],
+ 'properties': {
+ 'id': {'type': ['string', 'integer']},
+ 'next': {'$ref': '#/$defs/Node'},
+ },
+ 'additionalProperties': False,
+ }
+ },
+ 'paths': {
+ '/tree': {
+ 'post': {
+ 'requestBody': {
+ 'required': True,
+ 'content': {
+ 'application/json': {
+ 'schema': {
+ 'type': 'object',
+ 'properties': {
+ 'root': {'$ref': '#/$defs/Node'},
+ 'tuple': {
+ 'type': 'array',
+ 'prefixItems': [
+ {'type': 'string'},
+ {'type': 'number'},
+ ],
+ 'items': False,
+ },
+ },
+ }
+ }
+ },
+ },
+ 'responses': {'200': {'description': 'OK'}},
+ }
+ }
+ },
+ }
+
+ parser = OpenAPIParser(doc)
+ parsed_paths = parser.paths()
+ schema_defs = parser.request_body_schema_defs(parsed_paths)
+
+ assert '#/$defs/Node' in schema_defs
+ assert parsed_paths[0]['methods'][0]['details']['requestBodySchemas']['application/json']['properties']['tuple']['items'] is False
+
+ def test_swagger2_body_parameter_consumes_and_unresolved_ref(self):
+ doc = {
+ 'swagger': '2.0',
+ 'host': 'api.example.com',
+ 'basePath': '/v2',
+ 'consumes': ['application/json'],
+ 'definitions': {
+ 'Order': {
+ 'type': 'object',
+ 'required': ['sku'],
+ 'properties': {'sku': {'type': 'string'}},
+ }
+ },
+ 'paths': {
+ '/orders': {
+ 'post': {
+ 'parameters': [
+ {
+ 'name': 'body',
+ 'in': 'body',
+ 'required': True,
+ 'schema': {'$ref': '#/definitions/Order'},
+ }
+ ],
+ 'responses': {'200': {'description': 'OK'}},
+ }
+ },
+ '/wild': {
+ 'post': {
+ 'consumes': [],
+ 'parameters': [
+ {
+ 'name': 'body',
+ 'in': 'body',
+ 'required': True,
+ 'schema': {'type': 'object', 'required': ['x']},
+ }
+ ],
+ 'responses': {'200': {'description': 'OK'}},
+ }
+ },
+ '/dangling': {
+ 'post': {
+ 'parameters': [
+ {
+ 'name': 'body',
+ 'in': 'body',
+ 'required': True,
+ 'schema': {'$ref': '#/definitions/DoesNotExist'},
+ }
+ ],
+ 'responses': {'200': {'description': 'OK'}},
+ }
+ },
+ },
+ }
+
+ parser = OpenAPIParser(doc)
+ parsed_paths = parser.paths()
+ by_path = {p['path']: p for p in parsed_paths}
+
+ orders_details = by_path['/orders']['methods'][0]['details']
+ assert orders_details['requestBodySchemas'] == {
+ 'application/json': {'$ref': '#/definitions/Order'}
+ }
+
+ # Wild path inherits root consumes ['application/json'] in _effective_consumes if empty?
+ # Ensure at least fallback '*/*' or inherited consumes holds the schema safely.
+ wild_details = by_path['/wild']['methods'][0]['details']
+ assert wild_details['requestBodySchemas']
+
+ # Dangling $ref is skipped cleanly rather than emitting broken rules
+ dangling_details = by_path['/dangling']['methods'][0]['details']
+ assert dangling_details['requestBodySchemas'] == {}
+
+ # Swagger 2.0 with omitted consumes anywhere defaults to */*
+ no_consumes_doc = {
+ 'swagger': '2.0',
+ 'paths': {
+ '/any': {
+ 'post': {
+ 'parameters': [
+ {
+ 'name': 'body',
+ 'in': 'body',
+ 'required': True,
+ 'schema': {'type': 'object', 'properties': {'a': {'type': 'string'}}},
+ }
+ ],
+ 'responses': {'200': {'description': 'OK'}},
+ }
+ }
+ },
+ }
+ p2 = OpenAPIParser(no_consumes_doc)
+ assert p2.paths()[0]['methods'][0]['details']['requestBodySchemas'] == {
+ '*/*': {'type': 'object', 'properties': {'a': {'type': 'string'}}}
+ }
+
+
+# ---------------------------------------------------------------------------
+# ConfigBuilder + Template + Output tests
+# ---------------------------------------------------------------------------
+
+
+class TestConfigRenderingAndModuleWiring:
+ def _sample_oas(self) -> dict:
+ return {
+ 'openapi': '3.0.3',
+ 'components': {
+ 'schemas': {
+ 'Pet': {
+ 'type': 'object',
+ 'required': ['name', 'age'],
+ 'properties': {
+ 'name': {'type': 'string', 'minLength': 2},
+ 'age': {'type': 'integer', 'minimum': 0},
+ },
+ 'additionalProperties': False,
+ }
+ }
+ },
+ 'paths': {
+ '/pets': {
+ 'get': {'responses': {'200': {'description': 'OK'}}},
+ 'post': {
+ 'requestBody': {
+ 'required': True,
+ 'content': {
+ 'application/json': {
+ 'schema': {'$ref': '#/components/schemas/Pet'}
+ }
+ },
+ },
+ 'responses': {'201': {'description': 'Created'}},
+ },
+ },
+ '/ping': {
+ 'get': {'responses': {'200': {'description': 'Pong'}}}
+ },
+ },
+ }
+
+ def test_end_to_end_nginx_configs_and_js_rendered(self):
+ decl = _build_test_declaration(self._sample_oas(), enforce_bodies=True, modules=[])
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ b64_http, b64_stream = _render_main_configs(ctx)
+ http_conf = _decode_b64(b64_http)
+
+ # NJS module generated in auxFiles
+ njs_file = _find_file(ctx.auxFiles, lambda f: f['name'].startswith('/etc/nginx/njs/apigw_body_'))
+ njs_src = _decode_b64(njs_file['contents'])
+ assert 'export default {' in njs_src
+ assert 'validate_req_body_0_pets' in njs_src
+ assert '"#/components/schemas/Pet"' in njs_src
+
+ # http.conf declares js_path / js_import
+ assert 'js_path "/etc/nginx/njs";' in http_conf
+ assert 'js_import apigw_body_test_apigw_example_com_gw from apigw_body_test_apigw_example_com_gw.js;' in http_conf
+
+ # Server block includes _proxy*.conf at server {} level
+ server_conf = _decode_b64(
+ _find_file(ctx.configFiles, lambda f: f['name'] == '/etc/nginx/servers/http/test_apigw.conf')['contents']
+ )
+ assert 'include "/etc/nginx/apigateway/test_apigw.example.com/gw_proxy*.conf";' in server_conf
+
+ # Main apigateway location conf uses js_content for /pets and direct proxy_pass for /ping
+ apigw_conf = _decode_b64(
+ _find_file(
+ ctx.configFiles,
+ lambda f: '/etc/nginx/apigateway/' in f['name'] and '_proxy' not in f['name'],
+ )['contents']
+ )
+ assert 'client_body_in_single_buffer on;' in apigw_conf
+ assert 'js_content apigw_body_test_apigw_example_com_gw.validate_req_body_0_pets;' in apigw_conf
+ assert 'location = /gw/ping {' in apigw_conf
+
+ # Server-level named internal proxy location rendered in _proxy.conf
+ proxy_conf = _decode_b64(
+ _find_file(ctx.configFiles, lambda f: f['name'].endswith('_proxy.conf'))['contents']
+ )
+ assert 'location @apigw_proxy_test_apigw_example_com_gw_0_pets {' in proxy_conf
+ assert 'rewrite ^/gw/(.*)$ /$1 break;' in proxy_conf
+ assert 'proxy_intercept_errors on;' in proxy_conf
+ assert 'proxy_pass https://apigw_test_apigw_gw$uri$is_args$args;' in proxy_conf
+
+ # Both NIMOutput and NGINXOneOutput auto-inject ngx_http_js_module without duplicating
+ for builder in (nim_build_rendered_config_files, n1_build_rendered_config_files):
+ err_out, _, staged = builder(
+ copy.deepcopy(decl),
+ 'v5.7',
+ b64_http,
+ b64_stream,
+ copy.deepcopy(ctx.configFiles),
+ copy.deepcopy(ctx.auxFiles),
+ )
+ assert err_out is None
+ cfg_container = staged['configFiles'] if 'configFiles' in staged else staged['configs'][0]
+ nginx_conf = _decode_b64(
+ _find_file(cfg_container, lambda f: f['name'].endswith('/nginx.conf'))['contents']
+ )
+ assert nginx_conf.count('load_module modules/ngx_http_js_module.so;') == 1
+
+ # Already specified -> no duplicate
+ decl_with_mod = _build_test_declaration(
+ self._sample_oas(),
+ enforce_bodies=True,
+ modules=['ngx_http_js_module'],
+ )
+ err_out2, _, staged2 = builder(
+ decl_with_mod,
+ 'v5.7',
+ b64_http,
+ b64_stream,
+ copy.deepcopy(ctx.configFiles),
+ copy.deepcopy(ctx.auxFiles),
+ )
+ assert err_out2 is None
+ cfg_container2 = staged2['configFiles'] if 'configFiles' in staged2 else staged2['configs'][0]
+ nginx_conf2 = _decode_b64(
+ _find_file(cfg_container2, lambda f: f['name'].endswith('/nginx.conf'))['contents']
+ )
+ assert nginx_conf2.count('load_module modules/ngx_http_js_module.so;') == 1
+
+ def test_enforce_bodies_false_skips_njs_validation(self):
+ decl = _build_test_declaration(self._sample_oas(), enforce_bodies=False, modules=[])
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ b64_http, b64_stream = _render_main_configs(ctx)
+ http_conf = _decode_b64(b64_http)
+
+ server_conf = _decode_b64(
+ _find_file(ctx.configFiles, lambda f: f['name'] == '/etc/nginx/servers/http/test_apigw.conf')['contents']
+ )
+
+ assert not any('apigw_body_' in f['name'] for f in ctx.auxFiles['files'])
+ assert not any('_proxy.conf' in f['name'] for f in ctx.configFiles['files'])
+ assert 'js_import' not in http_conf
+ assert '_proxy*.conf' not in server_conf
+
+ _, _, staged = nim_build_rendered_config_files(
+ decl, 'v5.7', b64_http, b64_stream, ctx.configFiles, ctx.auxFiles
+ )
+ nginx_conf = _decode_b64(
+ _find_file(staged['configFiles'], lambda f: f['name'].endswith('/nginx.conf'))['contents']
+ )
+ assert 'ngx_http_js_module' not in nginx_conf
+
+
+# ---------------------------------------------------------------------------
+# Node.js runtime execution of rendered njs schema validator
+# ---------------------------------------------------------------------------
+
+
+def _run_validator_cases(openapi_schema: dict, cases: list) -> list:
+ """Renders the njs validator via ConfigBuilder and executes cases under Node."""
+ node_bin = shutil.which('node')
+ if not node_bin:
+ pytest.skip('node binary not available in PATH')
+
+ decl = _build_test_declaration(openapi_schema, enforce_bodies=True)
+ ctx = ConfigBuildContext(decl, 'v5.7')
+ err = build_config_files(ctx)
+ assert err is None
+
+ njs_file = _find_file(ctx.auxFiles, lambda f: f['name'].startswith('/etc/nginx/njs/apigw_body_'))
+ njs_src = _decode_b64(njs_file['contents'])
+
+ runner_js = f"""
+import mod from './validator.mjs';
+
+const validator = mod.default || mod;
+const cases = {json.dumps(cases)};
+const results = [];
+
+for (const tc of cases) {{
+ const res = {{ name: tc.name, status: null, body: null, redirect: null, headersOut: {{}} }};
+ const r = {{
+ method: tc.method || 'POST',
+ headersIn: tc.headers || {{}},
+ requestText: tc.body !== undefined ? tc.body : '',
+ variables: {{}},
+ headersOut: res.headersOut,
+ return(code, body) {{
+ res.status = code;
+ res.body = body || null;
+ }},
+ internalRedirect(loc) {{
+ res.redirect = loc;
+ }},
+ }};
+ const fn = validator[tc.func || 'validate_req_body_0_test'];
+ if (typeof fn !== 'function') {{
+ throw new Error('Missing validator function: ' + (tc.func || 'validate_req_body_0_test'));
+ }}
+ fn(r);
+ results.push(res);
+}}
+
+process.stdout.write(JSON.stringify(results));
+"""
+ with tempfile.TemporaryDirectory() as tmpdir:
+ validator_path = os.path.join(tmpdir, 'validator.mjs')
+ runner_path = os.path.join(tmpdir, 'runner.mjs')
+ with open(validator_path, 'w', encoding='utf-8') as f:
+ f.write(njs_src)
+ with open(runner_path, 'w', encoding='utf-8') as f:
+ f.write(runner_js)
+ proc = subprocess.run(
+ [node_bin, runner_path],
+ capture_output=True,
+ text=True,
+ timeout=30,
+ check=False,
+ )
+ assert proc.returncode == 0, f'Node failed:\nSTDOUT: {proc.stdout}\nSTDERR: {proc.stderr}'
+ return json.loads(proc.stdout)
+
+
+class TestRenderedValidatorRuntime:
+ def test_comprehensive_json_schema_and_oas_keywords(self):
+ schema_doc = {
+ 'openapi': '3.1.0',
+ 'components': {
+ 'schemas': {
+ 'TreeNode': {
+ 'type': 'object',
+ 'required': ['value'],
+ 'properties': {
+ 'value': {'type': 'integer', 'minimum': 1},
+ 'child': {'$ref': '#/components/schemas/TreeNode'},
+ },
+ 'additionalProperties': False,
+ }
+ }
+ },
+ 'paths': {
+ '/complex': {
+ 'get': {'responses': {'200': {'description': 'OK'}}},
+ 'post': {
+ 'requestBody': {
+ 'required': True,
+ 'content': {
+ 'application/json': {
+ 'schema': {
+ 'type': 'object',
+ 'required': ['id', 'serverId', 'name', 'score', 'tags', 'kind'],
+ 'properties': {
+ 'id': {'type': 'string', 'format': 'uuid'},
+ # readOnly must NOT be required in request bodies per OAS
+ 'serverId': {'type': 'string', 'readOnly': True},
+ 'name': {'type': 'string', 'minLength': 2, 'maxLength': 10, 'pattern': '^[A-Za-z0-9_]+$'},
+ 'nick': {'type': 'string', 'nullable': True},
+ 'email': {'type': 'string', 'format': 'email'},
+ 'createdDate': {'type': 'string', 'format': 'date'},
+ 'createdAt': {'type': 'string', 'format': 'date-time'},
+ 'ip4': {'type': 'string', 'format': 'ipv4'},
+ 'ip6': {'type': 'string', 'format': 'ipv6'},
+ 'homepage': {'type': 'string', 'format': 'uri'},
+ 'score': {
+ 'type': 'number',
+ 'exclusiveMinimum': 0,
+ 'maximum': 10,
+ 'multipleOf': 0.1,
+ },
+ 'tags': {
+ 'type': 'array',
+ 'items': {'type': 'string'},
+ 'minItems': 1,
+ 'maxItems': 3,
+ 'uniqueItems': True,
+ },
+ 'tuple': {
+ 'type': 'array',
+ 'prefixItems': [
+ {'type': 'string'},
+ {'type': 'integer'},
+ ],
+ 'items': False,
+ },
+ 'kind': {'enum': ['A', 'B']},
+ 'version': {'const': 2},
+ 'tree': {'$ref': '#/components/schemas/TreeNode'},
+ 'choice': {
+ 'oneOf': [
+ {'type': 'object', 'required': ['a'], 'properties': {'a': {'type': 'string'}}},
+ {'type': 'object', 'required': ['b'], 'properties': {'b': {'type': 'integer'}}},
+ ]
+ },
+ 'country': {'type': 'string'},
+ 'postalCode': {'type': 'string'},
+ },
+ 'patternProperties': {
+ '^x-': {'type': 'string'}
+ },
+ 'additionalProperties': False,
+ 'propertyNames': {'pattern': '^[a-zA-Z0-9_-]+$'},
+ 'dependentRequired': {
+ 'postalCode': ['country']
+ },
+ 'if': {
+ 'properties': {'country': {'const': 'US'}},
+ 'required': ['country'],
+ },
+ 'then': {
+ 'required': ['postalCode'],
+ },
+ }
+ },
+ '*+json': {
+ 'schema': {
+ 'type': 'object',
+ 'required': ['title'],
+ 'properties': {'title': {'type': 'string'}},
+ }
+ },
+ },
+ },
+ 'responses': {'200': {'description': 'OK'}},
+ },
+ },
+ '/optional': {
+ 'post': {
+ 'requestBody': {
+ 'required': False,
+ 'content': {
+ 'application/json': {
+ 'schema': {
+ 'type': 'object',
+ 'required': ['flag'],
+ 'properties': {'flag': {'type': 'boolean'}},
+ }
+ }
+ },
+ },
+ 'responses': {'200': {'description': 'OK'}},
+ }
+ },
+ '/form-and-text': {
+ 'post': {
+ 'requestBody': {
+ 'required': True,
+ 'content': {
+ 'application/x-www-form-urlencoded': {
+ 'schema': {
+ 'type': 'object',
+ 'required': ['count', 'active'],
+ 'properties': {
+ 'count': {'type': 'integer', 'minimum': 1},
+ 'active': {'type': 'boolean'},
+ },
+ }
+ },
+ 'text/plain': {
+ 'schema': {'type': 'string', 'minLength': 3, 'pattern': '^hi'}
+ },
+ },
+ },
+ 'responses': {'200': {'description': 'OK'}},
+ }
+ },
+ },
+ }
+
+ valid_payload = {
+ 'id': '550e8400-e29b-41d4-a716-446655440000',
+ 'name': 'Alice_1',
+ 'nick': None,
+ 'email': 'alice@example.com',
+ 'createdDate': '2026-05-01',
+ 'createdAt': '2026-05-01T12:30:00Z',
+ 'ip4': '192.168.1.10',
+ 'ip6': '2001:db8::1',
+ 'homepage': 'https://example.com/docs',
+ 'score': 0.3,
+ 'tags': ['alpha', 'beta'],
+ 'tuple': ['ok', 42],
+ 'kind': 'A',
+ 'version': 2,
+ 'tree': {'value': 1, 'child': {'value': 2}},
+ 'choice': {'a': 'yes'},
+ 'country': 'US',
+ 'postalCode': '94105',
+ 'x-trace': 'abc',
+ }
+
+ def _mut(**updates):
+ d = copy.deepcopy(valid_payload)
+ for k, v in updates.items():
+ if v is None and k in d and k != 'nick':
+ del d[k]
+ else:
+ d[k] = v
+ return json.dumps(d)
+
+ cases = [
+ {
+ 'name': 'get_passes_through_to_internal_redirect',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'GET',
+ 'headers': {},
+ 'body': '',
+ },
+ {
+ 'name': 'valid_complex_json_with_charset',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json; charset=utf-8'},
+ 'body': json.dumps(valid_payload),
+ },
+ {
+ 'name': 'required_missing_fails',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(name=None),
+ },
+ {
+ 'name': 'bad_uuid_format_fails',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(id='not-a-uuid'),
+ },
+ {
+ 'name': 'exclusive_minimum_zero_fails',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(score=0),
+ },
+ {
+ 'name': 'multiple_of_mismatch_fails',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(score=0.35),
+ },
+ {
+ 'name': 'unique_items_violation_fails',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(tags=['dup', 'dup']),
+ },
+ {
+ 'name': 'tuple_extra_item_fails',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(tuple=['ok', 42, 'extra']),
+ },
+ {
+ 'name': 'oneof_both_matched_fails',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(choice={'a': 'x', 'b': 1}),
+ },
+ {
+ 'name': 'cyclic_ref_nested_invalid_fails',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(tree={'value': 1, 'child': {'value': 0}}),
+ },
+ {
+ 'name': 'additional_property_rejected',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(unexpected='nope'),
+ },
+ {
+ 'name': 'if_then_country_us_requires_postal',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': _mut(postalCode=None),
+ },
+ {
+ 'name': 'malformed_json_fails_400',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': '{"broken": ',
+ },
+ {
+ 'name': 'empty_required_body_fails_400',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': '',
+ },
+ {
+ 'name': 'structured_suffix_plus_json_valid',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/problem+json'},
+ 'body': json.dumps({'title': 'Bad Gateway'}),
+ },
+ {
+ 'name': 'structured_suffix_plus_json_invalid',
+ 'func': 'validate_req_body_0_complex',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/problem+json'},
+ 'body': json.dumps({'detail': 'missing title'}),
+ },
+ {
+ 'name': 'optional_empty_body_passes',
+ 'func': 'validate_req_body_1_optional',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': '',
+ },
+ {
+ 'name': 'optional_nonempty_invalid_body_fails',
+ 'func': 'validate_req_body_1_optional',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/json'},
+ 'body': json.dumps({'flag': 'not-bool'}),
+ },
+ {
+ 'name': 'form_urlencoded_valid_coerced',
+ 'func': 'validate_req_body_2_form_and_text',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/x-www-form-urlencoded'},
+ 'body': 'count=5&active=true',
+ },
+ {
+ 'name': 'form_urlencoded_invalid_integer_fails',
+ 'func': 'validate_req_body_2_form_and_text',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'application/x-www-form-urlencoded'},
+ 'body': 'count=0&active=true',
+ },
+ {
+ 'name': 'text_plain_valid',
+ 'func': 'validate_req_body_2_form_and_text',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'text/plain'},
+ 'body': 'hi there',
+ },
+ {
+ 'name': 'text_plain_pattern_fails',
+ 'func': 'validate_req_body_2_form_and_text',
+ 'method': 'POST',
+ 'headers': {'Content-Type': 'text/plain'},
+ 'body': 'bye there',
+ },
+ ]
+
+ results = {r['name']: r for r in _run_validator_cases(schema_doc, cases)}
+
+ expected_pass = [
+ 'get_passes_through_to_internal_redirect',
+ 'valid_complex_json_with_charset',
+ 'structured_suffix_plus_json_valid',
+ 'optional_empty_body_passes',
+ 'form_urlencoded_valid_coerced',
+ 'text_plain_valid',
+ ]
+ for name in expected_pass:
+ assert results[name]['status'] is None, f"{name} unexpectedly failed: {results[name]}"
+ assert results[name]['redirect'].startswith('@apigw_proxy_'), name
+
+ for tc in cases:
+ if tc['name'] not in expected_pass:
+ assert results[tc['name']]['status'] == 400, f"{tc['name']} unexpectedly passed: {results[tc['name']]}"
+ assert results[tc['name']]['redirect'] is None, tc['name']
+ assert results[tc['name']]['headersOut'].get('Content-Type') == 'application/json'
+ err_payload = json.loads(results[tc['name']]['body'])
+ assert err_payload['code'] == 400
+ assert isinstance(err_payload['message'], str) and len(err_payload['message']) > 0
diff --git a/webui/package-lock.json b/webui/package-lock.json
index 6a8f5f0e..919bc8b3 100644
--- a/webui/package-lock.json
+++ b/webui/package-lock.json
@@ -9,9 +9,9 @@
"version": "1.0.0",
"dependencies": {
"@monaco-editor/react": "^4.7.0",
- "@rjsf/core": "6.4.2",
- "@rjsf/utils": "6.4.1",
- "@rjsf/validator-ajv8": "6.4.2",
+ "@rjsf/core": "6.11.1",
+ "@rjsf/utils": "6.11.1",
+ "@rjsf/validator-ajv8": "6.11.1",
"@types/trusted-types": "2.0.7",
"lucide-react": "^1.70.0",
"react": "^19.2.4",
@@ -20,7 +20,7 @@
"react-router-dom": "^7.13.2"
},
"devDependencies": {
- "@testing-library/jest-dom": "^6.9.1",
+ "@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.8",
"@types/react": "^19.0.0",
@@ -30,12 +30,12 @@
"@vitejs/plugin-react": "^6.0.1",
"@vitest/coverage-v8": "^5.1.0",
"@vitest/ui": "^5.1.0",
- "eslint": "^9.39.5",
+ "eslint": "^10.15.0",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.5.7",
"jsdom": "^31.0.0",
"prettier": "^3.2.4",
- "typescript": "^7.0.2",
+ "typescript": "^6.0.0",
"vite": "^8.0.3",
"vitest": "^5.1.0"
}
@@ -306,6 +306,30 @@
"node": ">=18"
}
},
+ "node_modules/@cacheable/memory": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz",
+ "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@cacheable/utils": "^2.5.0",
+ "@keyv/bigmap": "^1.3.1",
+ "hookified": "^1.15.1",
+ "keyv": "^5.6.0"
+ }
+ },
+ "node_modules/@cacheable/utils": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz",
+ "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hashery": "^1.5.1",
+ "keyv": "^5.6.0"
+ }
+ },
"node_modules/@emnapi/core": {
"version": "2.0.0-beta.2",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz",
@@ -365,185 +389,85 @@
}
},
"node_modules/@eslint/config-array": {
- "version": "0.21.2",
- "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz",
- "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==",
+ "version": "0.23.6",
+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.6.tgz",
+ "integrity": "sha512-WrTH7nioI9QPY4NZGnsywmecswJdgeq4BCM76qok9VgjTO29ZgUzUvcuJLVPYVQM4uDbaPBU0M33R9DIxI8X3w==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
- "@eslint/object-schema": "^2.1.7",
+ "@eslint/object-schema": "^3.0.5",
"debug": "^4.3.1",
- "minimatch": "^3.1.5"
+ "minimatch": "^11.0.5"
},
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
- }
- },
- "node_modules/@eslint/config-array/node_modules/balanced-match": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
- "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
- "dev": true
- },
- "node_modules/@eslint/config-array/node_modules/brace-expansion": {
- "version": "1.1.22",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.22.tgz",
- "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==",
- "dev": true,
- "dependencies": {
- "balanced-match": "^1.0.0",
- "concat-map": "0.0.1"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@eslint/config-array/node_modules/minimatch": {
- "version": "3.1.5",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
- "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
+ "version": "11.0.8",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.8.tgz",
+ "integrity": "sha512-nFQuYSTVrGvysVBps5Ih+0BdnYFN/Cj3C816r6+p7yK+FHrVLGE4O4N9AFwykrlNlvM2HYt+Rad1Uiro6h88Ig==",
"dev": true,
+ "license": "BlueOak-1.0.0",
"dependencies": {
- "brace-expansion": "^1.1.7"
+ "@isaacs/nonrecursive-glob-match": "^1.1.0",
+ "brace-expansion": "^5.0.12"
},
"engines": {
- "node": "*"
+ "node": "20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/@eslint/config-helpers": {
- "version": "0.4.2",
- "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz",
- "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz",
+ "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
- "@eslint/core": "^0.17.0"
+ "@eslint/core": "^1.2.1"
},
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@eslint/core": {
- "version": "0.17.0",
- "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",
- "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz",
+ "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
"@types/json-schema": "^7.0.15"
},
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
- }
- },
- "node_modules/@eslint/eslintrc": {
- "version": "3.3.7",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.7.tgz",
- "integrity": "sha512-F42g89Qd5oAWtp0k0nnSrjziAKza7w8SVT4mStc18LZMaRb4J1HQAHLCalEtDCxrTuksx7NU9qsmeLwpOfPqWw==",
- "dev": true,
- "dependencies": {
- "ajv": "^6.14.0",
- "debug": "^4.3.2",
- "espree": "^10.0.1",
- "globals": "^14.0.0",
- "ignore": "^5.2.0",
- "import-fresh": "^3.2.1",
- "js-yaml": "^4.3.2",
- "minimatch": "^3.1.5",
- "strip-json-comments": "^3.1.1"
- },
- "engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
- },
- "funding": {
- "url": "https://opencollective.com/eslint"
- }
- },
- "node_modules/@eslint/eslintrc/node_modules/ajv": {
- "version": "6.15.0",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
- "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
- "dev": true,
- "dependencies": {
- "fast-deep-equal": "^3.1.1",
- "fast-json-stable-stringify": "^2.0.0",
- "json-schema-traverse": "^0.4.1",
- "uri-js": "^4.2.2"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/epoberezkin"
- }
- },
- "node_modules/@eslint/eslintrc/node_modules/balanced-match": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
- "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
- "dev": true
- },
- "node_modules/@eslint/eslintrc/node_modules/brace-expansion": {
- "version": "1.1.22",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.22.tgz",
- "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==",
- "dev": true,
- "dependencies": {
- "balanced-match": "^1.0.0",
- "concat-map": "0.0.1"
- }
- },
- "node_modules/@eslint/eslintrc/node_modules/ignore": {
- "version": "5.3.2",
- "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
- "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
- "dev": true,
- "engines": {
- "node": ">= 4"
- }
- },
- "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
- "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
- "dev": true
- },
- "node_modules/@eslint/eslintrc/node_modules/minimatch": {
- "version": "3.1.5",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
- "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
- "dev": true,
- "dependencies": {
- "brace-expansion": "^1.1.7"
- },
- "engines": {
- "node": "*"
- }
- },
- "node_modules/@eslint/js": {
- "version": "9.39.5",
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.5.tgz",
- "integrity": "sha512-QywQuszQh77pIXCsq998c8hbhSTI/azTty1Z6N53dmAudKHhy573j3yvRLsX2BSp8YpLtoCEG8E9DJe+8zUh4A==",
- "dev": true,
- "engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
- },
- "funding": {
- "url": "https://eslint.org/donate"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@eslint/object-schema": {
- "version": "2.1.7",
- "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz",
- "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==",
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz",
+ "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@eslint/plugin-kit": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz",
- "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",
+ "version": "0.7.3",
+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz",
+ "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
- "@eslint/core": "^0.17.0",
+ "@eslint/core": "^1.2.1",
"levn": "^0.4.1"
},
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
}
},
"node_modules/@exodus/bytes": {
@@ -624,6 +548,13 @@
"url": "https://github.com/sponsors/nzakas"
}
},
+ "node_modules/@isaacs/nonrecursive-glob-match": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz",
+ "integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==",
+ "dev": true,
+ "license": "BlueOak-1.0.0"
+ },
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.13",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
@@ -669,6 +600,30 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
+ "node_modules/@keyv/bigmap": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz",
+ "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hashery": "^1.4.0",
+ "hookified": "^1.15.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "keyv": "^5.6.0"
+ }
+ },
+ "node_modules/@keyv/serialize": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz",
+ "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@monaco-editor/loader": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.7.0.tgz",
@@ -727,33 +682,31 @@
"dev": true
},
"node_modules/@rjsf/core": {
- "version": "6.4.2",
- "resolved": "https://registry.npmjs.org/@rjsf/core/-/core-6.4.2.tgz",
- "integrity": "sha512-TsN2PNqsO92d6/Tt+Sq4XgXtpXgzNRShL/pYYrnAluwf3n87TvE1huJpHgH6c/wD7eRFOYT4e7I0GxqiVos/VQ==",
+ "version": "6.11.1",
+ "resolved": "https://registry.npmjs.org/@rjsf/core/-/core-6.11.1.tgz",
+ "integrity": "sha512-2kH39lspUUQf552l+vSTj9vnwdv1gSOyDKqSDmFuTo16+92zbJ381knrQpk3KKowjp/sbxu4qPiBptgXH6i4UQ==",
+ "license": "Apache-2.0",
"dependencies": {
- "lodash": "^4.17.23",
- "lodash-es": "^4.17.23",
- "markdown-to-jsx": "^8.0.0",
- "prop-types": "^15.8.1"
+ "markdown-to-jsx": "^9.10.3"
},
"engines": {
"node": ">=20"
},
"peerDependencies": {
- "@rjsf/utils": "^6.4.x",
+ "@rjsf/utils": "^6.11.1",
"react": ">=18"
}
},
"node_modules/@rjsf/utils": {
- "version": "6.4.1",
- "resolved": "https://registry.npmjs.org/@rjsf/utils/-/utils-6.4.1.tgz",
- "integrity": "sha512-5NL3jwt3rIS5/WRTrKt++y40FS/ScKGVwYJ3jIrHSQHSwBdLnd4cHf2zcnA97L1Klj8I6tvS/ugh+blf/Diwuw==",
- "dependencies": {
- "@x0k/json-schema-merge": "^1.0.2",
- "fast-uri": "^3.1.0",
+ "version": "6.11.1",
+ "resolved": "https://registry.npmjs.org/@rjsf/utils/-/utils-6.11.1.tgz",
+ "integrity": "sha512-rHQ4jNkhws3YUjvM/6RyW78l0mVfnt6w2j3/giUcS5F0cendCLYykFuSnE2fQxBwmknv4ANMOugwXOgcIbfvnA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@x0k/json-schema-merge": "^1.1.0",
+ "fast-equals": "^6.0.4",
+ "fast-uri": "^4.2.1",
"jsonpointer": "^5.0.1",
- "lodash": "^4.17.23",
- "lodash-es": "^4.17.23",
"react-is": "^18.3.1"
},
"engines": {
@@ -763,21 +716,36 @@
"react": ">=18"
}
},
+ "node_modules/@rjsf/utils/node_modules/fast-uri": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-4.2.3.tgz",
+ "integrity": "sha512-I1PXwP5eAhlNlcdpjt9CgB59op2ZvZfxw+BkqGFVIUOgNpCVTcTqp3HhTX7brxj5vsip+nSY4nTvff+eIA76hg==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "BSD-3-Clause"
+ },
"node_modules/@rjsf/validator-ajv8": {
- "version": "6.4.2",
- "resolved": "https://registry.npmjs.org/@rjsf/validator-ajv8/-/validator-ajv8-6.4.2.tgz",
- "integrity": "sha512-zbLuT5nlgjrw2GkDqp+BtCeNQS/okM8oa5ltc3wiuoEqjVqskl1+WvHidQ6Uu4qAU/VfHCh8MwZg9sIsj89YiQ==",
+ "version": "6.11.1",
+ "resolved": "https://registry.npmjs.org/@rjsf/validator-ajv8/-/validator-ajv8-6.11.1.tgz",
+ "integrity": "sha512-LV7ibrep/kaRzkwzhLAmJY9SHOIZuX9fQO+0VCfm0FOGXneGU9xQEJvHft7R84uqtDTTQZqRq40HcQjqY0rsyw==",
+ "license": "Apache-2.0",
"dependencies": {
- "ajv": "^8.17.1",
- "ajv-formats": "^2.1.1",
- "lodash": "^4.17.23",
- "lodash-es": "^4.17.23"
+ "ajv": "^8.20.0",
+ "ajv-formats": "^2.1.1"
},
"engines": {
"node": ">=20"
},
"peerDependencies": {
- "@rjsf/utils": "^6.4.x"
+ "@rjsf/utils": "^6.11.1"
}
},
"node_modules/@rolldown/binding-android-arm-eabi": {
@@ -1065,10 +1033,11 @@
}
},
"node_modules/@testing-library/jest-dom": {
- "version": "6.9.1",
- "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.9.1.tgz",
- "integrity": "sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA==",
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-7.0.1.tgz",
+ "integrity": "sha512-oMDTC3oA+6CXSO2JZnvOI7CA6oVub6kij5ggk9ohwye5slmkwxYDXcPOVxgMw/RQlticjtO0C1RZkR97HgrWMw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"@adobe/css-tools": "^4.4.0",
"aria-query": "^5.0.0",
@@ -1078,9 +1047,18 @@
"redent": "^3.0.0"
},
"engines": {
- "node": ">=14",
+ "node": ">=22",
"npm": ">=6",
"yarn": ">=1"
+ },
+ "peerDependencies": {
+ "@testing-library/dom": ">=10 <11",
+ "vitest": ">= 0.32"
+ },
+ "peerDependenciesMeta": {
+ "vitest": {
+ "optional": true
+ }
}
},
"node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": {
@@ -1162,6 +1140,13 @@
"integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
"dev": true
},
+ "node_modules/@types/esrecurse": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz",
+ "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/estree": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz",
@@ -1359,383 +1344,63 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- },
- "peerDependencies": {
- "typescript": ">=4.8.4 <6.1.0"
- }
- },
- "node_modules/@typescript-eslint/utils": {
- "version": "8.72.2",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.72.2.tgz",
- "integrity": "sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==",
- "dev": true,
- "dependencies": {
- "@eslint-community/eslint-utils": "^4.9.1",
- "@typescript-eslint/scope-manager": "8.72.2",
- "@typescript-eslint/types": "8.72.2",
- "@typescript-eslint/typescript-estree": "8.72.2"
- },
- "engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- },
- "peerDependencies": {
- "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
- "typescript": ">=4.8.4 <6.1.0"
- }
- },
- "node_modules/@typescript-eslint/visitor-keys": {
- "version": "8.72.2",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.2.tgz",
- "integrity": "sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==",
- "dev": true,
- "dependencies": {
- "@typescript-eslint/types": "8.72.2",
- "eslint-visitor-keys": "^5.0.0"
- },
- "engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- }
- },
- "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
- "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
- "dev": true,
- "engines": {
- "node": "^20.19.0 || ^22.13.0 || >=24"
- },
- "funding": {
- "url": "https://opencollective.com/eslint"
- }
- },
- "node_modules/@typescript/typescript-aix-ppc64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",
- "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",
- "cpu": [
- "ppc64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "aix"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-darwin-arm64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",
- "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-darwin-x64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",
- "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-freebsd-arm64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",
- "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "freebsd"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-freebsd-x64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",
- "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "freebsd"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-linux-arm": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",
- "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",
- "cpu": [
- "arm"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-linux-arm64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",
- "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-linux-loong64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",
- "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",
- "cpu": [
- "loong64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-linux-mips64el": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",
- "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",
- "cpu": [
- "mips64el"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-linux-ppc64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",
- "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",
- "cpu": [
- "ppc64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-linux-riscv64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",
- "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",
- "cpu": [
- "riscv64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-linux-s390x": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",
- "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",
- "cpu": [
- "s390x"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-linux-x64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",
- "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-netbsd-arm64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",
- "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "netbsd"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-netbsd-x64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",
- "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "netbsd"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-openbsd-arm64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",
- "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",
- "cpu": [
- "arm64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "openbsd"
- ],
- "engines": {
- "node": ">=16.20.0"
- }
- },
- "node_modules/@typescript/typescript-openbsd-x64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",
- "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",
- "cpu": [
- "x64"
- ],
- "dev": true,
- "optional": true,
- "os": [
- "openbsd"
- ],
- "engines": {
- "node": ">=16.20.0"
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "typescript": ">=4.8.4 <6.1.0"
}
},
- "node_modules/@typescript/typescript-sunos-x64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",
- "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",
- "cpu": [
- "x64"
- ],
+ "node_modules/@typescript-eslint/utils": {
+ "version": "8.72.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.72.2.tgz",
+ "integrity": "sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==",
"dev": true,
- "optional": true,
- "os": [
- "sunos"
- ],
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.9.1",
+ "@typescript-eslint/scope-manager": "8.72.2",
+ "@typescript-eslint/types": "8.72.2",
+ "@typescript-eslint/typescript-estree": "8.72.2"
+ },
"engines": {
- "node": ">=16.20.0"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
+ "typescript": ">=4.8.4 <6.1.0"
}
},
- "node_modules/@typescript/typescript-win32-arm64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",
- "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",
- "cpu": [
- "arm64"
- ],
+ "node_modules/@typescript-eslint/visitor-keys": {
+ "version": "8.72.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.2.tgz",
+ "integrity": "sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==",
"dev": true,
- "optional": true,
- "os": [
- "win32"
- ],
+ "dependencies": {
+ "@typescript-eslint/types": "8.72.2",
+ "eslint-visitor-keys": "^5.0.0"
+ },
"engines": {
- "node": ">=16.20.0"
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
}
},
- "node_modules/@typescript/typescript-win32-x64": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",
- "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",
- "cpu": [
- "x64"
- ],
+ "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
+ "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
"dev": true,
- "optional": true,
- "os": [
- "win32"
- ],
"engines": {
- "node": ">=16.20.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
}
},
"node_modules/@vitejs/plugin-react": {
@@ -1911,6 +1576,7 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz",
"integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==",
"dev": true,
+ "license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
@@ -1923,6 +1589,7 @@
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
"integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
"dev": true,
+ "license": "MIT",
"peerDependencies": {
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
@@ -1968,27 +1635,6 @@
"node": ">=8"
}
},
- "node_modules/ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
- "dev": true,
- "dependencies": {
- "color-convert": "^2.0.1"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
- }
- },
- "node_modules/argparse": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
- "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
- "dev": true
- },
"node_modules/aria-query": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
@@ -2115,13 +1761,18 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
}
},
- "node_modules/callsites": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
- "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "node_modules/cacheable": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz",
+ "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==",
"dev": true,
- "engines": {
- "node": ">=6"
+ "license": "MIT",
+ "dependencies": {
+ "@cacheable/memory": "^2.2.0",
+ "@cacheable/utils": "^2.5.0",
+ "hookified": "^1.15.0",
+ "keyv": "^5.6.0",
+ "qified": "^0.10.1"
}
},
"node_modules/caniuse-lite": {
@@ -2153,46 +1804,6 @@
"node": ">=18"
}
},
- "node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "dev": true,
- "dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
- "node_modules/color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
- "dev": true,
- "dependencies": {
- "color-name": "~1.1.4"
- },
- "engines": {
- "node": ">=7.0.0"
- }
- },
- "node_modules/color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
- "dev": true
- },
- "node_modules/concat-map": {
- "version": "0.0.1",
- "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
- "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
- "dev": true
- },
"node_modules/convert-source-map": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
@@ -2358,44 +1969,43 @@
}
},
"node_modules/eslint": {
- "version": "9.39.5",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.5.tgz",
- "integrity": "sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw==",
- "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
+ "version": "10.15.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.15.0.tgz",
+ "integrity": "sha512-+5Wg4p+ze3sG1WErYgUO/3H1IQIfFBymVUA0Fo/XTeBOLS6UQIUekpSJ8sdRkn7O7wjh84b55w/roqavH2aScg==",
"dev": true,
+ "license": "MIT",
+ "workspaces": [
+ "packages/*"
+ ],
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
- "@eslint-community/regexpp": "^4.12.1",
- "@eslint/config-array": "^0.21.2",
- "@eslint/config-helpers": "^0.4.2",
- "@eslint/core": "^0.17.0",
- "@eslint/eslintrc": "^3.3.6",
- "@eslint/js": "9.39.5",
- "@eslint/plugin-kit": "^0.4.1",
- "@humanfs/node": "^0.16.6",
+ "@eslint-community/regexpp": "^4.12.2",
+ "@eslint/config-array": "^0.23.6",
+ "@eslint/config-helpers": "^0.7.0",
+ "@eslint/core": "^1.2.1",
+ "@eslint/plugin-kit": "^0.7.3",
+ "@humanfs/node": "^0.16.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@humanwhocodes/retry": "^0.4.2",
"@types/estree": "^1.0.6",
"ajv": "^6.14.0",
- "chalk": "^4.0.0",
"cross-spawn": "^7.0.6",
"debug": "^4.3.2",
"escape-string-regexp": "^4.0.0",
- "eslint-scope": "^8.4.0",
- "eslint-visitor-keys": "^4.2.1",
- "espree": "^10.4.0",
- "esquery": "^1.5.0",
+ "eslint-scope": "^9.1.2",
+ "eslint-visitor-keys": "^5.0.1",
+ "espree": "^11.2.0",
+ "esquery": "^1.7.0",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
- "file-entry-cache": "^8.0.0",
+ "file-entry-cache": "11.1.5 || >11.1.6 <12",
"find-up": "^5.0.0",
"glob-parent": "^6.0.2",
"ignore": "^5.2.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
- "lodash.merge": "^4.6.2",
- "minimatch": "^3.1.5",
+ "minimatch": "^11.0.5",
"natural-compare": "^1.4.0",
"optionator": "^0.9.3"
},
@@ -2403,7 +2013,7 @@
"eslint": "bin/eslint.js"
},
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
},
"funding": {
"url": "https://eslint.org/donate"
@@ -2446,16 +2056,19 @@
}
},
"node_modules/eslint-scope": {
- "version": "8.4.0",
- "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
- "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
+ "version": "9.1.2",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz",
+ "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==",
"dev": true,
+ "license": "BSD-2-Clause",
"dependencies": {
+ "@types/esrecurse": "^4.3.1",
+ "@types/estree": "^1.0.8",
"esrecurse": "^4.3.0",
"estraverse": "^5.2.0"
},
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
},
"funding": {
"url": "https://opencollective.com/eslint"
@@ -2489,29 +2102,14 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
- "node_modules/eslint/node_modules/balanced-match": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
- "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
- "dev": true
- },
- "node_modules/eslint/node_modules/brace-expansion": {
- "version": "1.1.22",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.22.tgz",
- "integrity": "sha512-CKLDTuSsN0+r1ThM0WkzzBI7dnPI6xEGfa/JnVYIK9JNBA1N1NyPwXVHor//NKD/y3sDxp764sZdLhFK7pH8XQ==",
- "dev": true,
- "dependencies": {
- "balanced-match": "^1.0.0",
- "concat-map": "0.0.1"
- }
- },
"node_modules/eslint/node_modules/eslint-visitor-keys": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
- "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
+ "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
},
"funding": {
"url": "https://opencollective.com/eslint"
@@ -2533,41 +2131,48 @@
"dev": true
},
"node_modules/eslint/node_modules/minimatch": {
- "version": "3.1.5",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
- "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
+ "version": "11.0.8",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.8.tgz",
+ "integrity": "sha512-nFQuYSTVrGvysVBps5Ih+0BdnYFN/Cj3C816r6+p7yK+FHrVLGE4O4N9AFwykrlNlvM2HYt+Rad1Uiro6h88Ig==",
"dev": true,
+ "license": "BlueOak-1.0.0",
"dependencies": {
- "brace-expansion": "^1.1.7"
+ "@isaacs/nonrecursive-glob-match": "^1.1.0",
+ "brace-expansion": "^5.0.12"
},
"engines": {
- "node": "*"
+ "node": "20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/espree": {
- "version": "10.4.0",
- "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
- "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
+ "version": "11.2.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz",
+ "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==",
"dev": true,
+ "license": "BSD-2-Clause",
"dependencies": {
- "acorn": "^8.15.0",
+ "acorn": "^8.16.0",
"acorn-jsx": "^5.3.2",
- "eslint-visitor-keys": "^4.2.1"
+ "eslint-visitor-keys": "^5.0.1"
},
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/espree/node_modules/eslint-visitor-keys": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
- "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
+ "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
- "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ "node": "^20.19.0 || ^22.13.0 || >=24"
},
"funding": {
"url": "https://opencollective.com/eslint"
@@ -2590,6 +2195,7 @@
"resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
"dev": true,
+ "license": "BSD-2-Clause",
"dependencies": {
"estraverse": "^5.2.0"
},
@@ -2638,6 +2244,15 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
+ "node_modules/fast-equals": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-6.2.2.tgz",
+ "integrity": "sha512-n+XqoarWCgcar0O3om3DeNYx6xTuLWGTUF1bRZ9iuO00tsPepzP1L4V7rqtxxZ4PEya34UCESReimFvxmEVwIA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
"node_modules/fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@@ -2689,15 +2304,13 @@
"dev": true
},
"node_modules/file-entry-cache": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
- "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",
+ "version": "11.1.5",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz",
+ "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "flat-cache": "^4.0.0"
- },
- "engines": {
- "node": ">=16.0.0"
+ "flat-cache": "^6.1.23"
}
},
"node_modules/find-up": {
@@ -2717,16 +2330,15 @@
}
},
"node_modules/flat-cache": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",
- "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",
+ "version": "6.1.23",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz",
+ "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "flatted": "^3.2.9",
- "keyv": "^4.5.4"
- },
- "engines": {
- "node": ">=16"
+ "cacheable": "^2.5.0",
+ "flatted": "^3.4.2",
+ "hookified": "^1.15.0"
}
},
"node_modules/flatted": {
@@ -2770,18 +2382,6 @@
"node": ">=10.13.0"
}
},
- "node_modules/globals": {
- "version": "14.0.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
- "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
- "dev": true,
- "engines": {
- "node": ">=18"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/goober": {
"version": "2.1.19",
"resolved": "https://registry.npmjs.org/goober/-/goober-2.1.19.tgz",
@@ -2790,13 +2390,17 @@
"csstype": "^3.0.10"
}
},
- "node_modules/has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "node_modules/hashery": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz",
+ "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==",
"dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hookified": "^1.15.0"
+ },
"engines": {
- "node": ">=8"
+ "node": ">=20"
}
},
"node_modules/hermes-estree": {
@@ -2814,6 +2418,13 @@
"hermes-estree": "0.25.1"
}
},
+ "node_modules/hookified": {
+ "version": "1.15.1",
+ "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz",
+ "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/html-encoding-sniffer": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz",
@@ -2835,22 +2446,6 @@
"node": ">= 4"
}
},
- "node_modules/import-fresh": {
- "version": "3.3.1",
- "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
- "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
- "dev": true,
- "dependencies": {
- "parent-module": "^1.0.0",
- "resolve-from": "^4.0.0"
- },
- "engines": {
- "node": ">=6"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/imurmurhash": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
@@ -2939,29 +2534,8 @@
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
- "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
- },
- "node_modules/js-yaml": {
- "version": "4.3.2",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
- "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/puzrin"
- },
- {
- "type": "github",
- "url": "https://github.com/sponsors/nodeca"
- }
- ],
- "dependencies": {
- "argparse": "^2.0.1"
- },
- "bin": {
- "js-yaml": "bin/js-yaml.js"
- }
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "dev": true
},
"node_modules/jsdom": {
"version": "31.0.1",
@@ -3021,12 +2595,6 @@
"node": ">=6"
}
},
- "node_modules/json-buffer": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
- "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
- "dev": true
- },
"node_modules/json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
@@ -3059,12 +2627,13 @@
}
},
"node_modules/keyv": {
- "version": "4.5.4",
- "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
- "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz",
+ "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "json-buffer": "3.0.1"
+ "@keyv/serialize": "^1.1.1"
}
},
"node_modules/levn": {
@@ -3344,33 +2913,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/lodash": {
- "version": "4.18.1",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
- "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q=="
- },
- "node_modules/lodash-es": {
- "version": "4.18.1",
- "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz",
- "integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A=="
- },
- "node_modules/lodash.merge": {
- "version": "4.6.2",
- "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
- "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
- "dev": true
- },
- "node_modules/loose-envify": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
- "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
- "dependencies": {
- "js-tokens": "^3.0.0 || ^4.0.0"
- },
- "bin": {
- "loose-envify": "cli.js"
- }
- },
"node_modules/lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
@@ -3425,18 +2967,30 @@
}
},
"node_modules/markdown-to-jsx": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-8.0.0.tgz",
- "integrity": "sha512-hWEaRxeCDjes1CVUQqU+Ov0mCqBqkGhLKjL98KdbwHSgEWZZSJQeGlJQatVfeZ3RaxrfTrZZ3eczl2dhp5c/pA==",
+ "version": "9.10.6",
+ "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-9.10.6.tgz",
+ "integrity": "sha512-vvd4cMAAK6RDCzklzRYykG8Tos1Wyid8IoxenyiSAnGb1JIX2fTzn6MuU5QBu9Kb4BdjOCnKlbs84NQRVsaaVA==",
+ "license": "MIT",
"engines": {
- "node": ">= 10"
+ "node": ">= 18"
},
"peerDependencies": {
- "react": ">= 0.14.0"
+ "react": ">= 16.0.0",
+ "solid-js": ">=1.0.0",
+ "vue": ">=3.0.0"
},
"peerDependenciesMeta": {
"react": {
"optional": true
+ },
+ "react-native": {
+ "optional": true
+ },
+ "solid-js": {
+ "optional": true
+ },
+ "vue": {
+ "optional": true
}
}
},
@@ -3534,14 +3088,6 @@
"node": ">=18"
}
},
- "node_modules/object-assign": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
- "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/obug": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz",
@@ -3602,18 +3148,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/parent-module": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
- "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
- "dev": true,
- "dependencies": {
- "callsites": "^3.0.0"
- },
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/parse5": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-8.1.1.tgz",
@@ -3767,21 +3301,6 @@
"dev": true,
"peer": true
},
- "node_modules/prop-types": {
- "version": "15.8.1",
- "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
- "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
- "dependencies": {
- "loose-envify": "^1.4.0",
- "object-assign": "^4.1.1",
- "react-is": "^16.13.1"
- }
- },
- "node_modules/prop-types/node_modules/react-is": {
- "version": "16.13.1",
- "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
- "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
- },
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@@ -3791,6 +3310,26 @@
"node": ">=6"
}
},
+ "node_modules/qified": {
+ "version": "0.10.1",
+ "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz",
+ "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hookified": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/qified/node_modules/hookified": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz",
+ "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/react": {
"version": "19.3.1",
"resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz",
@@ -3898,15 +3437,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/resolve-from": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
- "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
- "dev": true,
- "engines": {
- "node": ">=4"
- }
- },
"node_modules/rolldown": {
"version": "1.2.19",
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.19.tgz",
@@ -4042,30 +3572,6 @@
"node": ">=8"
}
},
- "node_modules/strip-json-comments": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
- "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
- "dev": true,
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
- "dev": true,
- "dependencies": {
- "has-flag": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/tinybench": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.3.tgz",
@@ -4192,37 +3698,16 @@
}
},
"node_modules/typescript": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",
- "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==",
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
+ "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
"dev": true,
"bin": {
- "tsc": "bin/tsc"
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
},
"engines": {
- "node": ">=16.20.0"
- },
- "optionalDependencies": {
- "@typescript/typescript-aix-ppc64": "7.0.2",
- "@typescript/typescript-darwin-arm64": "7.0.2",
- "@typescript/typescript-darwin-x64": "7.0.2",
- "@typescript/typescript-freebsd-arm64": "7.0.2",
- "@typescript/typescript-freebsd-x64": "7.0.2",
- "@typescript/typescript-linux-arm": "7.0.2",
- "@typescript/typescript-linux-arm64": "7.0.2",
- "@typescript/typescript-linux-loong64": "7.0.2",
- "@typescript/typescript-linux-mips64el": "7.0.2",
- "@typescript/typescript-linux-ppc64": "7.0.2",
- "@typescript/typescript-linux-riscv64": "7.0.2",
- "@typescript/typescript-linux-s390x": "7.0.2",
- "@typescript/typescript-linux-x64": "7.0.2",
- "@typescript/typescript-netbsd-arm64": "7.0.2",
- "@typescript/typescript-netbsd-x64": "7.0.2",
- "@typescript/typescript-openbsd-arm64": "7.0.2",
- "@typescript/typescript-openbsd-x64": "7.0.2",
- "@typescript/typescript-sunos-x64": "7.0.2",
- "@typescript/typescript-win32-arm64": "7.0.2",
- "@typescript/typescript-win32-x64": "7.0.2"
+ "node": ">=14.17"
}
},
"node_modules/undici": {
diff --git a/webui/package.json b/webui/package.json
index 1ddc4ce9..c6c3172a 100644
--- a/webui/package.json
+++ b/webui/package.json
@@ -16,9 +16,9 @@
},
"dependencies": {
"@monaco-editor/react": "^4.7.0",
- "@rjsf/core": "6.4.2",
- "@rjsf/utils": "6.4.1",
- "@rjsf/validator-ajv8": "6.4.2",
+ "@rjsf/core": "6.11.1",
+ "@rjsf/utils": "6.11.1",
+ "@rjsf/validator-ajv8": "6.11.1",
"@types/trusted-types": "2.0.7",
"lucide-react": "^1.70.0",
"react": "^19.2.4",
@@ -27,7 +27,7 @@
"react-router-dom": "^7.13.2"
},
"devDependencies": {
- "@testing-library/jest-dom": "^6.9.1",
+ "@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.8",
"@types/react": "^19.0.0",
@@ -37,18 +37,18 @@
"@vitejs/plugin-react": "^6.0.1",
"@vitest/coverage-v8": "^5.1.0",
"@vitest/ui": "^5.1.0",
- "eslint": "^9.39.5",
+ "eslint": "^10.15.0",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.5.7",
"jsdom": "^31.0.0",
"prettier": "^3.2.4",
- "typescript": "^7.0.2",
+ "typescript": "^6.0.0",
"vite": "^8.0.3",
"vitest": "^5.1.0"
},
"overrides": {
"dompurify": "^3.3.3",
"flatted": "^3.4.2",
- "typescript": "^7.0.2"
+ "typescript": "^6.0.0"
}
}
diff --git a/webui/vite.config.ts b/webui/vite.config.ts
index 5df15471..2a3048f9 100644
--- a/webui/vite.config.ts
+++ b/webui/vite.config.ts
@@ -10,7 +10,7 @@ export default defineConfig({
plugins: [react()],
resolve: {
alias: {
- '@': path.resolve(__dirname, './src'),
+ '@': path.resolve(import.meta.dirname, './src'),
},
},
server: {