Skip to content

Conversation

@buger
Copy link
Member

@buger buger commented Dec 5, 2025

User description

Summary

  • Fixed the OpenAPI requestBody content type for Streams API endpoints to use application/vnd.tyk.streams.oas instead of application/json
  • Affected endpoints: POST /api/apis/streams, PATCH /api/apis/streams/{apiId}, PUT /api/apis/streams/{apiId}
  • The Content-Type was already documented as a required header parameter but the requestBody section incorrectly used application/json

Related Jira

DX-2179 - Incorrect Content-Type for Streams API Not Documented

Related PRs

  • TykTechnologies/tyk-analytics#5129 (same fix in the source swagger.yml)

Test plan

  • Verify Swagger documentation correctly shows application/vnd.tyk.streams.oas as the expected Content-Type for request bodies
  • Verify existing curl examples in documentation still work with the documented Content-Type

🤖 Generated with Claude Code


PR Type

Documentation


Description

  • Fix Streams requestBody content type

  • Use application/vnd.tyk.streams.oas

  • Align requestBody with header parameter


Diagram Walkthrough

flowchart LR
  HeaderParam["Streams header parameter: vnd.tyk.streams.oas"] -- "align content type" --> RequestBody["requestBody content: vnd.tyk.streams.oas"]
  Endpoints["POST/PATCH/PUT /api/apis/streams"] -- "update media type keys" --> RequestBody
Loading

File Walkthrough

Relevant files
Documentation
dashboard-swagger.yml
Align Streams requestBody media type with required header

swagger/dashboard-swagger.yml

  • Replace application/json with application/vnd.tyk.streams.oas in
    requestBody.
  • Update for POST, PATCH, PUT Streams endpoints.
  • Keep examples and schemas unchanged.
+3/-3     

Update requestBody content type from 'application/json' to
'application/vnd.tyk.streams.oas' for all /api/apis/streams endpoints
to accurately reflect the required Content-Type header.

The Streams API endpoints require this specific Content-Type header
value, which was already documented as a parameter but was incorrectly
specified in the requestBody section.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

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

Consistency

Ensure all Streams API endpoints using request bodies consistently use the new media type and that no residual application/json entries remain elsewhere (including component examples’ schemas matching the new media type).

application/vnd.tyk.streams.oas:
  examples:
    StreamsAPIExample:
      $ref: "#/components/examples/streamsExample"
Validation

Verify that the referenced examples and schemas under the new media type are valid for the Streams OAS payloads and that tooling (Swagger UI/validators) renders them correctly with the custom vendor media type.

application/vnd.tyk.streams.oas:
  examples:
    PatchOASExample:
      $ref: "#/components/examples/streamsExample"
  schema:

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Define explicit schema type

Add an explicit schema and example media type attributes to prevent validation
issues in tools expecting a defined schema. At minimum, set the schema type to
object so the content is not treated as empty or invalid by OpenAPI validators.

swagger/dashboard-swagger.yml [1991-1998]

 requestBody:
   content:
     application/vnd.tyk.streams.oas:
+      schema:
+        type: object
       examples:
         StreamsAPIExample:
           $ref: "#/components/examples/streamsExample"
-      schema:
Suggestion importance[1-10]: 6

__

Why: Adding an explicit schema (e.g., type: object) for the media type can improve validator compatibility, and the snippet matches the new hunk structure. It's a moderate improvement, not critical.

Low
Require request body to match header

Ensure the Content-Type header parameter aligns with the requestBody media type by
marking the header as required: true wherever used. Inconsistencies can cause client
generation and runtime mismatches.

swagger/dashboard-swagger.yml [2243-2250]

 parameters:
   - $ref: '#/components/parameters/ContentTypeStreams'
 ...
 requestBody:
+  required: true
   content:
     application/vnd.tyk.streams.oas:
+      schema:
+        type: object
       examples:
         PatchOASExample:
           $ref: "#/components/examples/streamsExample"
-      schema:
Suggestion importance[1-10]: 4

__

Why: Recommending required flags and aligning header and body types is reasonable but partly speculative; the provided existing snippet includes an ellipsis and adds requirements beyond the diff context. Moderate, not critical.

Low

@sharadregoti sharadregoti changed the title docs: fix Content-Type in Swagger for Streams API endpoints (DX-2179) [DX-2179] docs: fix Content-Type in Swagger for Streams API endpoints Dec 5, 2025
@sharadregoti sharadregoti merged commit 44d4459 into main Dec 5, 2025
7 checks passed
@buger
Copy link
Member Author

buger commented Dec 5, 2025

/release to release-5.8

@buger
Copy link
Member Author

buger commented Dec 5, 2025

/release to release-5.10

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

✅ Cherry-pick successful. A PR was created and auto-merged (if allowed): #1120

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

✅ Cherry-pick successful. A PR was created and auto-merged (if allowed): #1121

buger added a commit that referenced this pull request Dec 5, 2025
…for Streams API endpoints (#1118)

[DX-2179] docs: fix Content-Type in Swagger for Streams API endpoints (#1118)
buger added a commit that referenced this pull request Dec 5, 2025
…or Streams API endpoints (#1118)

[DX-2179] docs: fix Content-Type in Swagger for Streams API endpoints (#1118)
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.

4 participants