From e6e8d1864b0fa4973877ff9cb3b85f8ebf134041 Mon Sep 17 00:00:00 2001 From: mehara-rothila Date: Thu, 11 Jun 2026 23:46:02 +0530 Subject: [PATCH 1/2] feat(platform-api): add upstreamDefinitions pool to the REST API OpenAPI schema Declare the API-level upstreamDefinitions pool (ReusableUpstream + UpstreamTimeout) so an upstream.ref can resolve against a named definition, mirroring the gateway's upstreamDefinitions shape. Schema only; model, converters, deployment-YAML emission, and validation follow. --- platform-api/src/resources/openapi.yaml | 59 +++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/platform-api/src/resources/openapi.yaml b/platform-api/src/resources/openapi.yaml index e6e43fb553..262adb26eb 100644 --- a/platform-api/src/resources/openapi.yaml +++ b/platform-api/src/resources/openapi.yaml @@ -6326,6 +6326,11 @@ components: example: "2023-10-12T10:30:00Z" upstream: $ref: "#/components/schemas/Upstream" + upstreamDefinitions: + type: array + description: List of reusable named upstream definitions. API-level upstream `ref` values resolve against entries here by name. + items: + $ref: '#/components/schemas/ReusableUpstream' lifeCycleStatus: type: string description: Current lifecycle status of the API @@ -8404,6 +8409,60 @@ components: description: Authentication value (API key, Bearer token, or Base64 encoded credentials for basic auth) example: my-api-key-value + ReusableUpstream: + title: Reusable Upstream + type: object + required: + - name + - upstreams + description: A reusable named upstream definition. Referenced by name from an API-level upstream.ref. + properties: + name: + type: string + description: Unique identifier for this upstream definition + minLength: 1 + maxLength: 100 + pattern: '^[a-zA-Z0-9\-_]+$' + example: my-upstream-1 + basePath: + type: string + description: Base path prefix prepended to all requests routed to this upstream (e.g., /api/v2) + example: /api/v2 + timeout: + $ref: '#/components/schemas/UpstreamTimeout' + upstreams: + type: array + description: List of backend targets with optional weights for load balancing + minItems: 1 + items: + type: object + additionalProperties: false + required: + - url + properties: + url: + type: string + format: uri + description: Backend URL (host and port only; path comes from basePath) + example: http://prod-backend-1:5000 + weight: + type: integer + description: Weight for load balancing (optional, default 100) + minimum: 0 + maximum: 100 + example: 80 + + UpstreamTimeout: + title: Upstream Timeout + type: object + description: Timeout configuration for upstream requests + properties: + connect: + type: string + description: Connection timeout duration (e.g., "5s", "500ms") + pattern: '^\d+(\.\d+)?(ms|s|m|h)$' + example: 5s + ExtractionIdentifier: type: object required: From 3cb7216abeceb1f89b1825ad684c199db5a27170 Mon Sep 17 00:00:00 2001 From: mehara-rothila Date: Tue, 7 Jul 2026 20:34:37 +0530 Subject: [PATCH 2/2] feat(platform-api): add per-operation upstream override to the OpenAPI schema --- platform-api/src/resources/openapi.yaml | 46 ++++++++++++++++++++----- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/platform-api/src/resources/openapi.yaml b/platform-api/src/resources/openapi.yaml index 262adb26eb..3ba1b12d5e 100644 --- a/platform-api/src/resources/openapi.yaml +++ b/platform-api/src/resources/openapi.yaml @@ -6328,7 +6328,7 @@ components: $ref: "#/components/schemas/Upstream" upstreamDefinitions: type: array - description: List of reusable named upstream definitions. API-level upstream `ref` values resolve against entries here by name. + description: List of reusable named upstream definitions, referenced by `ref` from both API-level and operation-level upstreams. items: $ref: '#/components/schemas/ReusableUpstream' lifeCycleStatus: @@ -6478,6 +6478,8 @@ components: description: List of policies to be applied on the operation items: $ref: "#/components/schemas/Policy" + upstream: + $ref: "#/components/schemas/OperationUpstream" ChannelRequest: title: Channel Request @@ -8389,6 +8391,39 @@ components: auth: $ref: '#/components/schemas/UpstreamAuth' + OperationUpstream: + title: Operation Upstream + type: object + additionalProperties: false + minProperties: 1 + description: Per-operation upstream override. Each sub-field must reference a named entry in upstreamDefinitions. Missing sub-fields fall back to the API-level upstream. At least one of main or sandbox must be set. + properties: + main: + type: object + additionalProperties: false + required: + - ref + properties: + ref: + $ref: '#/components/schemas/UpstreamReference' + sandbox: + type: object + additionalProperties: false + required: + - ref + properties: + ref: + $ref: '#/components/schemas/UpstreamReference' + + UpstreamReference: + title: Upstream Reference + type: string + description: Name of a ReusableUpstream entry in the API's upstreamDefinitions pool. Used by both API-level and operation-level upstream refs. + minLength: 1 + maxLength: 100 + pattern: '^[a-zA-Z0-9\-_]+$' + example: my-upstream-1 + UpstreamAuth: type: object description: Authentication configuration for upstream endpoints @@ -8415,15 +8450,10 @@ components: required: - name - upstreams - description: A reusable named upstream definition. Referenced by name from an API-level upstream.ref. + description: A reusable named upstream definition. Referenced by name from API-level and operation-level upstream refs. properties: name: - type: string - description: Unique identifier for this upstream definition - minLength: 1 - maxLength: 100 - pattern: '^[a-zA-Z0-9\-_]+$' - example: my-upstream-1 + $ref: '#/components/schemas/UpstreamReference' basePath: type: string description: Base path prefix prepended to all requests routed to this upstream (e.g., /api/v2)