Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Aug 29, 2025

Summary by CodeRabbit

  • Refactor
    • Standardized image generation API requests to use JSON across relevant endpoints. Clients must now send application/json payloads for image generation requests, improving consistency and interoperability.
  • Chores
    • Removed legacy form-encoded request handling and associated deprecated request shapes for image generation. This cleans up outdated definitions and reduces ambiguity in request formats.

Note: If you integrate with the image generation endpoints, update your requests to JSON to avoid failures.

@coderabbitai
Copy link

coderabbitai bot commented Aug 29, 2025

Walkthrough

The OpenAPI spec updates two image generation endpoints to accept application/json bodies using the shared OpenAIImagesGenerationsIn schema. Legacy form-encoded request bodies and their dedicated Body_* schemas are removed. No other endpoints or components are modified.

Changes

Cohort / File(s) Summary of Changes
Endpoint request body content-type update
src/libs/DeepInfra/openapi.yaml
/v1/images/generations and /v1/openai/images/generations requestBody content switched from application/x-www-form-urlencoded to application/json. Payload schema reference updated to OpenAIImagesGenerationsIn.
Schema consolidation and cleanup
src/libs/DeepInfra/openapi.yaml
Removed Body_openai_images_generations_v1_images_generations_post and Body_openai_images_generations_v1_openai_images_generations_post from components/schemas; both endpoints now reuse OpenAIImagesGenerationsIn.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant API as DeepInfra API
  participant S as Image Generation Service

  rect rgba(200,200,255,0.2)
  note over C,API: Old (before change)
  C->>API: POST /v1/.../images/generations<br/>Content-Type: application/x-www-form-urlencoded
  API->>API: Parse form fields
  API->>S: Invoke generation(params)
  S-->>API: Image result
  API-->>C: 200 OK (image payload)
  end

  rect rgba(200,255,200,0.2)
  note over C,API: New (after change)
  C->>API: POST /v1/.../images/generations<br/>Content-Type: application/json<br/>Body: OpenAIImagesGenerationsIn
  API->>API: Validate JSON against OpenAIImagesGenerationsIn
  API->>S: Invoke generation(params)
  S-->>API: Image result
  API-->>C: 200 OK (image payload)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at JSON’s glow,
No more forms in fields to sow—
One schema burrow, neat and tight,
Two tunnels share the same moonlight.
I thump, I hop, I ship with cheer,
Clean specs ahead, the path is clear. 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202508292116

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HavenDV HavenDV enabled auto-merge (squash) August 29, 2025 21:17
@HavenDV HavenDV merged commit 2da937b into main Aug 29, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202508292116 branch August 29, 2025 21:18
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Switch image generation endpoints to JSON using OpenAIImagesGenerationsIn Aug 29, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a76c706 and 579f7e4.

⛔ Files ignored due to path filters (9)
  • src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.OpenaiImagesGenerations.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.OpenaiImagesGenerations2.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.OpenaiImagesGenerations.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.OpenaiImagesGenerations2.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.Models.BodyOpenaiImagesGenerationsV1ImagesGenerationsPost.Json.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.Models.BodyOpenaiImagesGenerationsV1ImagesGenerationsPost.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.Models.BodyOpenaiImagesGenerationsV1OpenaiImagesGenerationsPost.Json.g.cs is excluded by !**/generated/**
  • src/libs/DeepInfra/Generated/DeepInfra.Models.BodyOpenaiImagesGenerationsV1OpenaiImagesGenerationsPost.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/DeepInfra/openapi.yaml (2 hunks)
🔇 Additional comments (1)
src/libs/DeepInfra/openapi.yaml (1)

2183-2187: Ignore this suggestion: the primary /v1/images/generations endpoint only supports application/json, so adding application/x-www-form-urlencoded just on the alias /v1/openai/images/generations would introduce inconsistent behavior. Neither endpoint includes an examples block—if you want examples, add them to both, otherwise drop this diff.

Likely an incorrect or invalid review comment.

Comment on lines 2138 to 2142
content:
application/x-www-form-urlencoded:
application/json:
schema:
$ref: '#/components/schemas/Body_openai_images_generations_v1_images_generations_post'
$ref: '#/components/schemas/OpenAIImagesGenerationsIn'
required: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Breaking change: switched to JSON body — consider dual content-type or clear deprecation/versioning

Changing /v1/images/generations to application/json will break existing clients posting form-encoded bodies. Either (a) support both content types for a deprecation window, or (b) bump API version and publish migration notes.

Proposed minimal dual support + example:

       requestBody:
         content:
-          application/json:
+          application/json:
             schema:
               $ref: '#/components/schemas/OpenAIImagesGenerationsIn'
+            examples:
+              basic:
+                value:
+                  model: black-forest-labs/FLUX-1-schnell
+                  prompt: A photo of an astronaut riding a horse on Mars.
+                  n: 1
+                  response_format: b64_json
+                  size: 1024x1024
+          application/x-www-form-urlencoded:
+            schema:
+              $ref: '#/components/schemas/OpenAIImagesGenerationsIn'

To find impacted callers and docs:


🏁 Script executed:

#!/bin/bash
# Find form-encoded usage of images generations
rg -n -C2 -iP '/v1/(openai/)?images/generations' && rg -n -i 'application/x-www-form-urlencoded|multipart/form-data' -g '!**/node_modules/**' -g '!**/dist/**'

Length of output: 3071


🏁 Script executed:

#!/bin/bash
# Locate the /v1/images/generations endpoint and print its requestBody section
LINE=$(grep -n '^  /v1/images/generations:' src/libs/DeepInfra/openapi.yaml | cut -d: -f1)
echo "Endpoint defined at line $LINE"
sed -n "${LINE},$((LINE+50))p" src/libs/DeepInfra/openapi.yaml

Length of output: 1759


src/libs/DeepInfra/openapi.yaml – /v1/images/generations requestBody now only accepts application/json
This is a breaking change: existing clients posting form-encoded bodies will fail. Either restore support for application/x-www-form-urlencoded (and multipart/form-data) during a deprecation window, or bump the API version and publish migration notes.

🤖 Prompt for AI Agents
In src/libs/DeepInfra/openapi.yaml around lines 2138 to 2142 the requestBody for
the /v1/images/generations endpoint currently only lists application/json which
breaks clients sending form-encoded or multipart data; restore backward
compatibility by adding application/x-www-form-urlencoded and
multipart/form-data entries under content with appropriate schema refs (or a
form schema with properties matching OpenAIImagesGenerationsIn), mark the
JSON-only change as deprecated and document a deprecation window; alternatively,
if you intend to break compatibility, bump the API version in the spec and add
migration notes in the documentation and changelog explaining required client
changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants