Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TT-13761] add batch request to the latest open api specs #6797

Merged
merged 7 commits into from
Dec 22, 2024

Conversation

yurisasuke
Copy link
Member

@yurisasuke yurisasuke commented Dec 19, 2024

TT-13761
Summary add batch request to the latest open api specs
Type Story Story
Status In Code Review
Points N/A
Labels -

When the new Gateway Open Api spec was created. The Batch request endpoint was left out .This should be added to the gateway OAS.

This pr also fixes an issue where the external OAS Url we were using now return error 404. This pr changes that to use a local copy of the external oas . I.e we have changed from : https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json to https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json

Link: https://tyk.io/docs/5.5/tyk-gateway-api/

TT-13761

@buger
Copy link
Member

buger commented Dec 19, 2024

I'm a bot and I 👍 this PR title. 🤖

Copy link
Contributor

github-actions bot commented Dec 19, 2024

Swagger Changes






  
  
  
  
  
  
  
  
  
  
  
  
    
    
    
    
    
    
    
    
    
    
     _        __  __
    /{listen_path}/tyk/batch:
    BatchReplyUnit:
    BatchRequestStructure:
    RequestDefinition:
   _| |_   _ / _|/ _|  between swagger-prev.yml
  + one list entry added:
  + one list entry added:
  + one list entry added:
  + one list entry added:
  + one list entry added:
  + one map entry added:
  + three map entries added:
  - one list entry removed:
  - one list entry removed:
  - one list entry removed:
  - one list entry removed:
  ± value change
  ± value change
 / _' | | | | |_| |_       and swagger-current.yml
 \__,_|\__, |_| |_|   returned nine differences
components.schemas
paths
paths./tyk/apis/oas.get.responses.200.content.application/json.schema.items.allOf
paths./tyk/apis/oas.post.requestBody.content.application/json.schema.allOf
paths./tyk/apis/oas/import.post.requestBody.content.application/json.schema.$ref
paths./tyk/apis/oas/{apiID}.get.responses.200.content.application/json.schema.allOf
paths./tyk/apis/oas/{apiID}.patch.requestBody.content.application/json.schema.$ref
paths./tyk/apis/oas/{apiID}.put.requestBody.content.application/json.schema.allOf
tags
| (_| | |_| |  _|  _|

Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Documentation Clarity
The added documentation for the "Batch requests" feature is comprehensive but could benefit from clearer formatting and consistency, especially in the sample request and response sections. Ensure the examples are easy to follow and free of redundancy.

Endpoint Definition
The new endpoint /{listen_path}/tyk/batch is defined, but its parameters and responses should be thoroughly validated to ensure they align with the intended functionality and do not introduce inconsistencies or errors.

Copy link
Contributor

API Changes

no api changes detected

Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Score
General
Fix a typo in the batch request documentation for improved accuracy

Correct the typo in the phrase "The response will will be" to ensure professional
and accurate documentation.

swagger.yml [133]

-The response will will be a structured reply that encapsulates the responses for each of the outbound requests.
+The response will be a structured reply that encapsulates the responses for each of the outbound requests.
Suggestion importance[1-10]: 8

Why: Correcting the typo improves the professionalism and accuracy of the documentation. This is a straightforward and necessary fix for maintaining high-quality documentation.

8
Eliminate redundant sentences in the batch request description for better clarity

Remove the duplicate sentence about the usefulness of batch requests to avoid
confusion and improve documentation clarity.

swagger.yml [91]

-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.
+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`.
Suggestion importance[1-10]: 6

Why: The suggestion improves documentation clarity by removing a redundant sentence. While it does not affect functionality, it enhances readability and avoids potential confusion.

6
Security
Add clarification or validation for the lack of authentication on the batch request endpoint to prevent misuse

Ensure that the Batch requests endpoint explicitly defines the required
authentication mechanism or clarifies if no authentication is needed to prevent
potential misuse or security vulnerabilities.

swagger.yml [101]

-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.
+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. Ensure proper validation mechanisms are in place to prevent unauthorized access.
Suggestion importance[1-10]: 7

Why: The suggestion highlights a potential security concern by recommending clarification or validation for the lack of authentication on the batch request endpoint. This is a valid and impactful improvement, though it does not provide a concrete implementation.

7

@yurisasuke yurisasuke changed the title [DX-1783] add batch request to the latest open api specs [TT-13761] add batch request to the latest open api specs Dec 19, 2024
@jeffy-mathew jeffy-mathew force-pushed the add-batch-request-endpoint-to-open-api-specs branch from a7a7fcf to 3d82228 Compare December 20, 2024 15:14
@buger
Copy link
Member

buger commented Dec 20, 2024

I'm a bot and I 👍 this PR title. 🤖

@lghiur lghiur merged commit 0276c06 into master Dec 22, 2024
43 checks passed
@lghiur lghiur deleted the add-batch-request-endpoint-to-open-api-specs branch December 22, 2024 08:29
@lghiur
Copy link
Member

lghiur commented Dec 22, 2024

/release to release-5.7

@lghiur
Copy link
Member

lghiur commented Dec 22, 2024

/release to release-5.7.1

Copy link

tykbot bot commented Dec 22, 2024

Working on it! Note that it can take a few minutes.

tykbot bot pushed a commit that referenced this pull request Dec 22, 2024
<details open>
<summary><a href="https://tyktech.atlassian.net/browse/TT-13761"
title="TT-13761" target="_blank">TT-13761</a></summary>
  <br />
  <table>
    <tr>
      <th>Summary</th>
      <td>add batch request to the latest open api specs</td>
    </tr>
    <tr>
      <th>Type</th>
      <td>
<img alt="Story"
src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium"
/>
        Story
      </td>
    </tr>
    <tr>
      <th>Status</th>
      <td>In Code Review</td>
    </tr>
    <tr>
      <th>Points</th>
      <td>N/A</td>
    </tr>
    <tr>
      <th>Labels</th>
      <td>-</td>
    </tr>
  </table>
</details>
<!--
  do not remove this marker as it will break jira-lint's functionality.
  added_by_jira_lint
-->

---


When the new Gateway Open Api spec was created. The Batch request
endpoint was left out .This should be added to the gateway OAS.

This pr also fixes an issue where the external OAS Url we were using now
return error 404. This pr changes that to use a local copy of the
external oas . I.e we have changed from :
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json
to
https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json

Link: https://tyk.io/docs/5.5/tyk-gateway-api/ 

[TT-13761]




[TT-13761]:
https://tyktech.atlassian.net/browse/TT-13761?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: itachi sasuke <[email protected]>

(cherry picked from commit 0276c06)
Copy link

tykbot bot commented Dec 22, 2024

Working on it! Note that it can take a few minutes.

Copy link

tykbot bot commented Dec 22, 2024

@lghiur Seems like there is conflict and it require manual merge.

tykbot bot pushed a commit that referenced this pull request Dec 22, 2024
<details open>
<summary><a href="https://tyktech.atlassian.net/browse/TT-13761"
title="TT-13761" target="_blank">TT-13761</a></summary>
  <br />
  <table>
    <tr>
      <th>Summary</th>
      <td>add batch request to the latest open api specs</td>
    </tr>
    <tr>
      <th>Type</th>
      <td>
<img alt="Story"
src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium"
/>
        Story
      </td>
    </tr>
    <tr>
      <th>Status</th>
      <td>In Code Review</td>
    </tr>
    <tr>
      <th>Points</th>
      <td>N/A</td>
    </tr>
    <tr>
      <th>Labels</th>
      <td>-</td>
    </tr>
  </table>
</details>
<!--
  do not remove this marker as it will break jira-lint's functionality.
  added_by_jira_lint
-->

---


When the new Gateway Open Api spec was created. The Batch request
endpoint was left out .This should be added to the gateway OAS.

This pr also fixes an issue where the external OAS Url we were using now
return error 404. This pr changes that to use a local copy of the
external oas . I.e we have changed from :
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json
to
https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json

Link: https://tyk.io/docs/5.5/tyk-gateway-api/ 

[TT-13761]




[TT-13761]:
https://tyktech.atlassian.net/browse/TT-13761?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: itachi sasuke <[email protected]>

(cherry picked from commit 0276c06)
Copy link

tykbot bot commented Dec 22, 2024

@lghiur Seems like there is conflict and it require manual merge.

lghiur pushed a commit that referenced this pull request Dec 22, 2024
…en api specs (#6797) (#6807)

### **User description**
[TT-13761] add batch request to the latest open api specs (#6797)

<details open>
<summary><a href="https://tyktech.atlassian.net/browse/TT-13761"
title="TT-13761" target="_blank">TT-13761</a></summary>
  <br />
  <table>
    <tr>
      <th>Summary</th>
      <td>add batch request to the latest open api specs</td>
    </tr>
    <tr>
      <th>Type</th>
      <td>
<img alt="Story"

src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium"
/>
        Story
      </td>
    </tr>
    <tr>
      <th>Status</th>
      <td>In Code Review</td>
    </tr>
    <tr>
      <th>Points</th>
      <td>N/A</td>
    </tr>
    <tr>
      <th>Labels</th>
      <td>-</td>
    </tr>
  </table>
</details>
<!--
  do not remove this marker as it will break jira-lint's functionality.
  added_by_jira_lint
-->

---


When the new Gateway Open Api spec was created. The Batch request
endpoint was left out .This should be added to the gateway OAS.

This pr also fixes an issue where the external OAS Url we were using now
return error 404. This pr changes that to use a local copy of the
external oas . I.e we have changed from :

https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json
to

https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json

Link: https://tyk.io/docs/5.5/tyk-gateway-api/ 

[TT-13761]




[TT-13761]:

https://tyktech.atlassian.net/browse/TT-13761?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: itachi sasuke
<[email protected]>

[TT-13761]:
https://tyktech.atlassian.net/browse/TT-13761?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[TT-13761]:
https://tyktech.atlassian.net/browse/TT-13761?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ


___

### **PR Type**
Enhancement, Bug fix


___

### **Description**
- Added support for batch requests in the OpenAPI specification. This
includes a new endpoint `/{listen_path}/tyk/batch` and detailed
documentation on its usage, request structure, and response format.
- Introduced new schemas (`BatchRequestStructure`, `BatchReplyUnit`, and
`RequestDefinition`) to support batch request functionality.
- Updated references to the OpenAPI schema URL to use a local copy
instead of an external URL, addressing a 404 error issue.



___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>.redocly.lint-ignore.yaml</strong><dd><code>Update
OpenAPI schema URL to local reference</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

.redocly.lint-ignore.yaml

<li>Updated the reference to the OpenAPI schema URL to use a local copy
<br>instead of an external URL.<br>


</details>


  </td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6807/files#diff-e4fbedb98d4b719f6be66946eec4e940438c123f2303c842b449c528ade31579">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>swagger.yml</strong><dd><code>Add batch request support
and update OpenAPI schema references</code></dd></summary>
<hr>

swagger.yml

<li>Added a new <code>Batch requests</code> section with detailed
descriptions and <br>examples.<br> <li> Introduced a new endpoint
<code>/{listen_path}/tyk/batch</code> for batch requests.<br> <li>
Defined new schemas for <code>BatchRequestStructure</code>,
<code>BatchReplyUnit</code>, and <br><code>RequestDefinition</code>.<br>
<li> Updated references to the OpenAPI schema URL to use a local
copy.<br>


</details>


  </td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6807/files#diff-8f3c4cb253eee09ae2401daa7279a8bbfbfd4168bb579c3ac0ee5c672d63bb2c">+295/-6</a>&nbsp;
</td>

</tr>
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull
request to receive relevant information

Co-authored-by: itachi sasuke <[email protected]>
lghiur pushed a commit that referenced this pull request Dec 22, 2024
…open api specs (#6797) (#6808)

### **User description**
[TT-13761] add batch request to the latest open api specs (#6797)

<details open>
<summary><a href="https://tyktech.atlassian.net/browse/TT-13761"
title="TT-13761" target="_blank">TT-13761</a></summary>
  <br />
  <table>
    <tr>
      <th>Summary</th>
      <td>add batch request to the latest open api specs</td>
    </tr>
    <tr>
      <th>Type</th>
      <td>
<img alt="Story"

src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium"
/>
        Story
      </td>
    </tr>
    <tr>
      <th>Status</th>
      <td>In Code Review</td>
    </tr>
    <tr>
      <th>Points</th>
      <td>N/A</td>
    </tr>
    <tr>
      <th>Labels</th>
      <td>-</td>
    </tr>
  </table>
</details>
<!--
  do not remove this marker as it will break jira-lint's functionality.
  added_by_jira_lint
-->

---


When the new Gateway Open Api spec was created. The Batch request
endpoint was left out .This should be added to the gateway OAS.

This pr also fixes an issue where the external OAS Url we were using now
return error 404. This pr changes that to use a local copy of the
external oas . I.e we have changed from :

https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json
to

https://raw.githubusercontent.com/TykTechnologies/tyk/refs/heads/master/apidef/oas/schema/3.0.json

Link: https://tyk.io/docs/5.5/tyk-gateway-api/ 

[TT-13761]




[TT-13761]:

https://tyktech.atlassian.net/browse/TT-13761?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: itachi sasuke
<[email protected]>

[TT-13761]:
https://tyktech.atlassian.net/browse/TT-13761?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[TT-13761]:
https://tyktech.atlassian.net/browse/TT-13761?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ


___

### **PR Type**
Enhancement, Bug fix


___

### **Description**
- Added a new "Batch requests" feature to the OpenAPI specification,
including a detailed description, examples, and a new endpoint
`/{listen_path}/tyk/batch`.
- Introduced new schemas (`BatchRequestStructure`, `BatchReplyUnit`, and
`RequestDefinition`) to support batch request functionality.
- Updated the OpenAPI schema reference URL from an external source to a
local copy hosted in the repository to resolve a 404 error issue.



___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>.redocly.lint-ignore.yaml</strong><dd><code>Update
OpenAPI schema reference URL to local copy</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

.redocly.lint-ignore.yaml

<li>Updated the reference URL for the OpenAPI schema from an external
<br>source to a local copy hosted in the repository.<br>


</details>


  </td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6808/files#diff-e4fbedb98d4b719f6be66946eec4e940438c123f2303c842b449c528ade31579">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>swagger.yml</strong><dd><code>Add batch request
endpoint and update OpenAPI schema references</code></dd></summary>
<hr>

swagger.yml

<li>Added a new "Batch requests" section to the OpenAPI specification
with <br>detailed descriptions and examples.<br> <li> Introduced a new
endpoint <code>/{listen_path}/tyk/batch</code> for handling batch
<br>requests.<br> <li> Defined new schemas for batch request and
response structures <br>(<code>BatchRequestStructure</code>,
<code>BatchReplyUnit</code>, and <code>RequestDefinition</code>).<br>
<li> Updated references to the OpenAPI schema URL to use a local
copy.<br>


</details>


  </td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6808/files#diff-8f3c4cb253eee09ae2401daa7279a8bbfbfd4168bb579c3ac0ee5c672d63bb2c">+295/-6</a>&nbsp;
</td>

</tr>
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull
request to receive relevant information

Co-authored-by: itachi sasuke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants