From ab577ac531fa1f03a5e9997d17fdd937e7f2fded Mon Sep 17 00:00:00 2001 From: Master Date: Thu, 19 Dec 2024 18:54:41 +0530 Subject: [PATCH 1/2] Fix Latest page (#5833) fixes --- tyk-docs/data/releases/helm.json | 8 ++++++-- tyk-docs/data/releases/operator.json | 8 ++++++-- tyk-docs/data/releases/pump.json | 7 ++++++- tyk-docs/data/releases/sync.json | 6 +++++- tyk-docs/data/releases/tib.json | 9 +++++++-- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/tyk-docs/data/releases/helm.json b/tyk-docs/data/releases/helm.json index e0f6979823..f2524afb50 100644 --- a/tyk-docs/data/releases/helm.json +++ b/tyk-docs/data/releases/helm.json @@ -1,8 +1,12 @@ { "home": "deployment-and-operations/tyk-self-managed/deployment-lifecycle/installations/kubernetes/tyk-helm-tyk-stack", "licensed": false, - "latest": "2.1.0", - "releaseNotesPath": "product-stack/tyk-charts/release-notes/version-2.1", + "latest": "2.2.0", + "releaseNotesPath": "product-stack/tyk-charts/release-notes/version-2.2", + "2.2.0": { + "date": "9/12/2024", + "tag": "https://github.com/TykTechnologies/tyk-charts/releases/tag/v2.2.0" + }, "2.1.0": { "date": "10/10/2024", "tag": "https://github.com/TykTechnologies/tyk-charts/releases/tag/v2.1.0" diff --git a/tyk-docs/data/releases/operator.json b/tyk-docs/data/releases/operator.json index 0e9c167c6f..389b35502f 100644 --- a/tyk-docs/data/releases/operator.json +++ b/tyk-docs/data/releases/operator.json @@ -1,8 +1,12 @@ { "home": "tyk-operator", "licensed": true, - "latest": "1.0.0", - "releaseNotesPath": "product-stack/tyk-operator/release-notes/operator-1.0", + "latest": "1.1.0", + "releaseNotesPath": "product-stack/tyk-operator/release-notes/operator-1.1", + "1.1.0": { + "date": "9/12/2024", + "docker": "https://hub.docker.com/r/tykio/tyk-operator/tags?page=1&name=1.1.0" + }, "1.0.0": { "date": "10/10/2024", "docker": "https://hub.docker.com/r/tykio/tyk-operator/tags?page=1&name=1.0.0" diff --git a/tyk-docs/data/releases/pump.json b/tyk-docs/data/releases/pump.json index 19bda8e749..fb5cbda87c 100644 --- a/tyk-docs/data/releases/pump.json +++ b/tyk-docs/data/releases/pump.json @@ -1,8 +1,13 @@ { "home": "tyk-pump", "licensed": false, - "latest": "1.11.0", + "latest": "1.11.1", "releaseNotesPath": "product-stack/tyk-pump/release-notes/pump-1.11", + "1.11.1": { + "date": "4/12/2024", + "tag": "https://github.com/TykTechnologies/tyk-pump/releases/tag/v1.11.1", + "docker": "https://hub.docker.com/r/tykio/tyk-pump-docker-pub/tags?page=1&name=v1.11.1" + }, "1.11.0": { "date": "13/08/2024", "tag": "https://github.com/TykTechnologies/tyk-pump/releases/tag/v1.11.0", diff --git a/tyk-docs/data/releases/sync.json b/tyk-docs/data/releases/sync.json index b81c62fd48..595f12840d 100644 --- a/tyk-docs/data/releases/sync.json +++ b/tyk-docs/data/releases/sync.json @@ -1,8 +1,12 @@ { "home": "tyk-sync", "licensed": true, - "latest": "2.0", + "latest": "2.0.1", "releaseNotesPath": "product-stack/tyk-sync/release-notes/sync-2.0", + "2.0.1": { + "date": "5/12/2024", + "docker": "https://hub.docker.com/r/tykio/tyk-sync/tags?page=1&name=v2.0.1" + }, "2.0": { "date": "10/10/2024", "docker": "https://hub.docker.com/r/tykio/tyk-sync/tags?page=1&name=v2.0" diff --git a/tyk-docs/data/releases/tib.json b/tyk-docs/data/releases/tib.json index 259dc68f63..5f1d4a333d 100644 --- a/tyk-docs/data/releases/tib.json +++ b/tyk-docs/data/releases/tib.json @@ -1,8 +1,13 @@ { "home": "tyk-identity-broker", "licensed": false, - "latest": "1.5.1", - "releaseNotesPath": "https://github.com/TykTechnologies/tyk-identity-broker/releases", + "latest": "1.6.1", + "releaseNotesPath": "developer-support/release-notes/tib#16-release-notes", + "1.6.1": { + "date": "5/11/2024", + "tag": "https://github.com/TykTechnologies/tyk-identity-broker/releases/tag/v1.6.1", + "docker": "https://hub.docker.com/r/tykio/tyk-identity-broker/tags?page=1&name=1.6.1" + }, "1.5.1": { "date": "9/2/2024", "tag": "https://github.com/TykTechnologies/tyk-identity-broker/releases/tag/v1.5.1", From 4aad425ad656e2358de1e2640543662a6d6c4bd1 Mon Sep 17 00:00:00 2001 From: itachi sasuke <8012032+yurisasuke@users.noreply.github.com> Date: Thu, 19 Dec 2024 19:56:55 +0300 Subject: [PATCH 2/2] change swagger to add batch request (#5835) * change swagger to add batch request --- tyk-docs/assets/others/gateway-swagger.yml | 303 ++++++++++++++++++++- 1 file changed, 296 insertions(+), 7 deletions(-) diff --git a/tyk-docs/assets/others/gateway-swagger.yml b/tyk-docs/assets/others/gateway-swagger.yml index 9abac6f6ff..bd1c184851 100644 --- a/tyk-docs/assets/others/gateway-swagger.yml +++ b/tyk-docs/assets/others/gateway-swagger.yml @@ -85,6 +85,187 @@ tags: - description: | Manage OAuth clients, and manage their tokens name: OAuth +- description: | + Tyk supports batch requests, so a client makes a single request to the API but gets a compound response object back. + + This is especially handy if clients have complex requests that have multiple synchronous dependencies and do not wish to have the entire request / response cycle running for each event. + + To enable batch request support, set the `enable_batch_request_support` value to `true` + + Batch requests that come into Tyk are *run through the whole Tyk machinery* and *use a relative path to prevent spamming*. This means that a batch request to Tyk for three resources with the same API key will have three requests applied to their session quota and request limiting could become active if they are being throttled. + + Tyk reconstructs the API request based on the data in the batch request. This is to ensure that Tyk is not being used to proxy requests to other hosts outside of the upstream API being accessed. + + Batch requests are created by POSTING to the `/{listen_path}/tyk/batch/` endpoint. These requests **do not require a valid key**, but their request list does. + +

Sample Request

+ + ```{json} + { + "requests": [ + { + "method": "GET", + "headers": { + "x-tyk-test": "1", + "x-tyk-version": "1.2", + "authorization": "1dbc83b9c431649d7698faa9797e2900f" + }, + "body": "", + "relative_url": "get" + }, + { + "method": "GET", + "headers": { + "x-tyk-test": "2", + "x-tyk-version": "1.2", + "authorization": "1dbc83b9c431649d7698faa9797e2900f" + }, + "body": "", + "relative_url": "get" + } + ], + "suppress_parallel_execution": false + } + ``` + + The response will be a structured reply that encapsulates the responses for each of the outbound requests. If `suppress_parallel_execution` is set to `true`, requests will be made synchronously. If set to `false` then they will run in parallel and the response order is not guaranteed. + +

Sample Response

+ + ``` + [ + { + "relative_url": "get", + "code": 200, + "headers": { + "Access-Control-Allow-Credentials": [ + "true" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Length": [ + "497" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Wed, 12 Nov 2014 15:32:43 GMT" + ], + "Server": [ + "gunicorn/18.0" + ], + "Via": [ + "1.1 vegur" + ] + }, + "body": "{ + "args": {}, + "headers": { + "Accept-Encoding": "gzip", + "Authorization": "1dbc83b9c431649d7698faa9797e2900f", + "Connect-Time": "2", + "Connection": "close", + "Host": "httpbin.org", + "Total-Route-Time": "0", + "User-Agent": "Go 1.1 package http", + "Via": "1.1 vegur", + "X-Request-Id": "6a22499a-2776-4aa1-80c0-686581a8be4d", + "X-Tyk-Test": "2", + "X-Tyk-Version": "1.2" + }, + "origin": "127.0.0.1, 62.232.114.250", + "url": "http://httpbin.org/get" + }" + }, + { + "relative_url": "get", + "code": 200, + "headers": { + "Access-Control-Allow-Credentials": [ + "true" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Content-Length": [ + "497" + ], + "Content-Type": [ + "application/json" + ], + "Date": [ + "Wed, 12 Nov 2014 15:32:43 GMT" + ], + "Server": [ + "gunicorn/18.0" + ], + "Via": [ + "1.1 vegur" + ] + }, + "body": "{ + "args": {}, + "headers": { + "Accept-Encoding": "gzip", + "Authorization": "1dbc83b9c431649d7698faa9797e2900f", + "Connect-Time": "7", + "Connection": "close", + "Host": "httpbin.org", + "Total-Route-Time": "0", + "User-Agent": "Go 1.1 package http", + "Via": "1.1 vegur", + "X-Request-Id": "1ab61f50-51ff-4828-a7e2-17240385a6d2", + "X-Tyk-Test": "1", + "X-Tyk-Version": "1.2" + }, + "origin": "127.0.0.1, 62.232.114.250", + "url": "http://httpbin.org/get" + }" + } + ] + ``` + With the body for each request string encoded in the `body` field. + + * `expire_analytics_after`: If you are running a busy API, you may want to ensure that your MongoDB database does not overflow with old data. Set the `expire_analytics_after` value to the number of seconds you would like the data to last for. Setting this flag to anything above `0` will set an `expireAt` field for each record that is written to the database. + + **Important:** Tyk will not create the expiry index for you. In order to implement data expiry for your analytics data, ensure that the index is created This is easily achieved using the [MongoDB command line interface](https://docs.mongodb.com/getting-started/shell/client/). + + * `dont_set_quota_on_create`: This setting defaults to `false`, but if set to `true`, when the API is used to edit, create or add keys, the quota cache in Redis will not be re-set. By default, all updates or creates to Keys that have Quotas set will re-set the quota (This has been the default behaviour since 1.0). + + This behaviour can be bypassed on a case-by-case basis by using the `suppress_reset` parameter when making a REST API request. This is the advised mode of operation as it allows for manual, granular control over key quotas and reset timings. + + * `cache_options`: This section enables you to configure the caching behaviour of Tyk and to enable or disable the caching middleware for your API. + + * `cache_options.enable_cache`: Set this value to `true` if the cache should be enabled for this endpoint, setting it to false will stop all caching behaviour. + + * `cache_options.cache_timeout`: The amount of time, in seconds, to keep cached objects, defaults to `60` seconds. + + * `cache_options.cache_all_safe_requests`: Set this to `true` if you want all *safe* requests (GET, HEAD, OPTIONS) to be cached. This is a blanket setting for APIs where caching is required but you don't want to set individual paths up in the definition. + + * `cache_options.enable_upstream_cache_control`: Set this to `true` if you want your application to control the cache options for Tyk (TTL and whether to cache or not). See [Caching](/docs/basic-config-and-security/reduce-latency/caching/) for more details. + + * `response_processors`: Response processors need to be specifically defined so they are loaded on API creation, otherwise the middleware will not fire. In order to have the two main response middleware components fire, the following configuration object should be supplied. + + ```{json} + "response_processors": [ + { + "name": "header_injector", + "options": { + "add_headers": {"name": "value"}, + "remove_headers": ["name"] + } + }, + { + "name": "response_body_transform", + "options": {} + } + ] + ``` + + The options for the `header_injector` are global, and will apply to all outbound requests. + name: "Batch requests" paths: /hello: get: @@ -563,7 +744,7 @@ paths: schema: items: allOf: - - $ref: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json + - $ref: https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json - $ref: '#/components/schemas/XTykAPIGateway' type: array description: List of API definitions in Tyk OAS format. @@ -664,7 +845,7 @@ paths: url: https://localhost:8080 schema: allOf: - - $ref: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json + - $ref: https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json - $ref: '#/components/schemas/XTykAPIGateway' responses: "200": @@ -802,7 +983,7 @@ paths: $ref: '#/components/examples/oasExample' schema: allOf: - - $ref: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json + - $ref: https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json - $ref: '#/components/schemas/XTykAPIGateway' description: OK headers: @@ -912,7 +1093,7 @@ paths: upstream: url: https://localhost:8080 schema: - $ref: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json + $ref: https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json responses: "200": content: @@ -1025,7 +1206,7 @@ paths: url: https://localhost:8080 schema: allOf: - - $ref: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json + - $ref: https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json - $ref: '#/components/schemas/XTykAPIGateway' responses: "200": @@ -1334,7 +1515,7 @@ paths: servers: - url: https://localhost:8080 schema: - $ref: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json + $ref: https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json responses: "200": content: @@ -4231,6 +4412,79 @@ paths: summary: Hot-reload a group of Tyk nodes. tags: - Hot Reload + /{listen_path}/tyk/batch: + post: + description: Endpoint to run batch request. + operationId: batch + parameters: + - description: API listen path + example: get + in: path + name: listen_path + required: true + schema: + type: string + requestBody: + content: + application/json: + example: + requests: + - body: "" + headers: + authorization: 1dbc83b9c431649d7698faa9797e2900f + x-tyk-test: "1" + x-tyk-version: "1.2" + method: GET + relative_url: get + - body: "" + headers: + authorization: 1dbc83b9c431649d7698faa9797e2900f + x-tyk-test: "2" + x-tyk-version: "1.2" + method: GET + relative_url: get + suppress_parallel_execution: false + schema: + $ref: '#/components/schemas/BatchRequestStructure' + responses: + "200": + content: + application/json: + example: + - body: '{"message": "success"}' + code: 200 + headers: + Access-Control-Allow-Credentials: + - "true" + Content-Type: + - application/json + relative_url: get + schema: + items: + $ref: '#/components/schemas/BatchReplyUnit' + type: array + description: Success. + "400": + content: + application/json: + example: + message: Batch request malformed + status: error + schema: + $ref: '#/components/schemas/ApiStatusMessage' + description: Bad Request + "403": + content: + application/json: + example: + message: Attempted administrative access with invalid or missing key! + status: error + schema: + $ref: '#/components/schemas/ApiStatusMessage' + description: Forbidden + summary: Run batch request. + tags: + - Batch requests /tyk/schema: get: description: Get OAS schema definition using a version. @@ -5284,6 +5538,41 @@ components: password: type: string type: object + BatchReplyUnit: + properties: + body: + type: string + code: + type: integer + headers: + $ref: '#/components/schemas/HttpHeader' + relative_url: + type: string + type: object + BatchRequestStructure: + properties: + requests: + items: + $ref: '#/components/schemas/RequestDefinition' + nullable: true + type: array + suppress_parallel_execution: + type: boolean + type: object + RequestDefinition: + properties: + body: + type: string + headers: + additionalProperties: + type: string + nullable: true + type: object + method: + type: string + relative_url: + type: string + type: object BooleanQueryParam: enum: - true @@ -7853,4 +8142,4 @@ components: description: Api key in: header name: X-Tyk-Authorization - type: apiKey + type: apiKey \ No newline at end of file