From 8588974821b80a98756d9d57ccb9ca3588718183 Mon Sep 17 00:00:00 2001 From: 70335265 Date: Tue, 17 Apr 2018 15:16:06 +0900 Subject: [PATCH] avoid s2i-builder errors --- .../policy/rate_limit/apicast-policy.json | 166 ++++++++++++------ 1 file changed, 109 insertions(+), 57 deletions(-) diff --git a/gateway/src/apicast/policy/rate_limit/apicast-policy.json b/gateway/src/apicast/policy/rate_limit/apicast-policy.json index 8318fe02a..be933890b 100644 --- a/gateway/src/apicast/policy/rate_limit/apicast-policy.json +++ b/gateway/src/apicast/policy/rate_limit/apicast-policy.json @@ -11,7 +11,7 @@ "description": "List of limiters to be applied", "type": "array", "items": { - "oneOf": [{ + "anyOf": [{ "type": "object", "properties": { "name": { @@ -19,12 +19,36 @@ "enum": ["connections"], "description": "Limiting request concurrency (or concurrent connections)" }, - "$ref": "#/definitions/key", + "key": { + "description": "The key corresponding to the limiter object", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the key, must be unique in the scope" + }, + "scope": { + "type": "string", + "description": "Scope of the key", + "default": "global", + "oneOf": [{ + "enum": ["global"], + "description": "Global scope, affecting to all services" + }, { + "enum": ["service"], + "description": "Service scope, affecting to one service" + }] + }, + "service_name": { + "type": "string", + "description": "Name of service, necessary for service scope" + } + } + }, "conn": { "type": "integer", "description": "The maximum number of concurrent requests allowed", - "minimum": 0, - "exclusiveMinimum": true + "exclusiveminimum": 0 }, "burst": { "type": "integer", @@ -34,8 +58,7 @@ "delay": { "type": "number", "description": "The default processing latency of a typical connection (or request)", - "minimum": 0, - "exclusiveMinimum": true + "exclusiveMinimum": 0 } } }, { @@ -46,12 +69,36 @@ "enum": ["leaky_bucket"], "description": "Limiting request rate" }, - "$ref": "#/definitions/key", + "key": { + "description": "The key corresponding to the limiter object", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the key, must be unique in the scope" + }, + "scope": { + "type": "string", + "description": "Scope of the key", + "default": "global", + "oneOf": [{ + "enum": ["global"], + "description": "Global scope, affecting to all services" + }, { + "enum": ["service"], + "description": "Service scope, affecting to one service" + }] + }, + "service_name": { + "type": "string", + "description": "Name of service, necessary for service scope" + } + } + }, "rate": { "type": "integer", "description": "The specified request rate (number per second) threshold", - "minimum": 0, - "exclusiveMinimum": true + "exclusiveMinimum": 0 }, "burst": { "type": "integer", @@ -67,18 +114,41 @@ "enum": ["fixed_window"], "description": "Limiting request counts" }, - "$ref": "#/definitions/key", + "key": { + "description": "The key corresponding to the limiter object", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the key, must be unique in the scope" + }, + "scope": { + "type": "string", + "description": "Scope of the key", + "default": "global", + "oneOf": [{ + "enum": ["global"], + "description": "Global scope, affecting to all services" + }, { + "enum": ["service"], + "description": "Service scope, affecting to one service" + }] + }, + "service_name": { + "type": "string", + "description": "Name of service, necessary for service scope" + } + } + }, "count": { "type": "integer", "description": "The specified number of requests threshold", - "minimum": 0, - "exclusiveMinimum": true + "exclusiveMinimum": 0 }, "window": { "type": "integer", "description": "The time window in seconds before the request count is reset", - "minimum": 0, - "exclusiveMinimum": true + "exclusiveMinimum": 0 } } }] @@ -92,7 +162,7 @@ "description": "List of error settings", "type": "array", "items": { - "oneOf": [{ + "anyOf": [{ "type": "object", "properties": { "type": { @@ -105,7 +175,18 @@ "description": "The status code when requests over the limit", "default": 429 }, - "$ref": "#/definitions/error_handling" + "error_handling": { + "type": "string", + "description": "How to handle an error", + "default": "exit", + "oneOf": [{ + "enum": ["exit"], + "description": "Respond with an error" + }, { + "enum": ["log"], + "description": "Let the request go through and only output logs" + }] + } } }, { "type": "object", @@ -120,51 +201,22 @@ "description": "The status code when there is some configuration issue", "default": 500 }, - "$ref": "#/definitions/error_handling" + "error_handling": { + "type": "string", + "description": "How to handle an error", + "default": "exit", + "oneOf": [{ + "enum": ["exit"], + "description": "Respond with an error" + }, { + "enum": ["log"], + "description": "Let the request go through and only output logs" + }] + } } }] } } - }, - "definitions": { - "key": { - "description": "The key corresponding to the limiter object", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the key, must be unique in the scope" - }, - "scope": { - "type": "string", - "description": "Scope of the key", - "default": "global", - "oneOf": [{ - "enum": ["global"], - "description": "Global scope, affecting to all services" - }, { - "enum": ["service"], - "description": "Service scope, affecting to one service" - }] - }, - "service_name": { - "type": "string", - "description": "Name of service, necessary for service scope" - } - } - }, - "error_handling": { - "type": "string", - "description": "How to handle an error", - "default": "exit", - "oneOf": [{ - "enum": ["exit"], - "description": "Respond with an error" - }, { - "enum": ["log"], - "description": "Let the request go through and only output logs" - }] - } } } }