Skip to content

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Aug 14, 2025

Summary by CodeRabbit

  • New Features

    • Image generation, image-to-image, and transform endpoints now accept free-form style values (strings), enabling custom styles beyond the previous predefined list.
    • Backward compatible: existing predefined styles continue to work.
    • Fewer validation errors when experimenting with new or custom style names.
  • Chores

    • Updated API specification to reflect relaxed style validation for the affected endpoints.

@coderabbitai
Copy link

coderabbitai bot commented Aug 14, 2025

Walkthrough

Updated the OpenAPI spec to change the style property from an enum reference to a plain string in three request schemas: GenerateImageRequest, ImageToImageRequest, and TransformImageRequest. No other components, including the ImageStyle enum, were modified.

Changes

Cohort / File(s) Summary of changes
OpenAPI request schema adjustments
src/libs/Recraft/openapi.yaml
In GenerateImageRequest, ImageToImageRequest, and TransformImageRequest, changed style from $ref: '#/components/schemas/ImageStyle' to type: string. ImageStyle enum remains unchanged elsewhere.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

I twitch my whiskers, specs align,
Three styles unbound, now strings in line.
The enum waits, still standing by—
While requests hop freely, my oh my!
Thump-thump! Ship it; watch it fly. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ 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_202508141511

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 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.

@github-actions github-actions bot merged commit 3cf488c into main Aug 14, 2025
3 of 4 checks passed
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:OpenAPI: change style property from enum to string in image requests Aug 14, 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: 3

📜 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 settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 86a2598 and 7bf2f0b.

⛔ Files ignored due to path filters (9)
  • src/libs/Recraft/Generated/Recraft.IImageClient.GenerateImage.g.cs is excluded by !**/generated/**
  • src/libs/Recraft/Generated/Recraft.IImageClient.ImageToImage.g.cs is excluded by !**/generated/**
  • src/libs/Recraft/Generated/Recraft.IImageClient.ReplaceBackground.g.cs is excluded by !**/generated/**
  • src/libs/Recraft/Generated/Recraft.ImageClient.GenerateImage.g.cs is excluded by !**/generated/**
  • src/libs/Recraft/Generated/Recraft.ImageClient.ImageToImage.g.cs is excluded by !**/generated/**
  • src/libs/Recraft/Generated/Recraft.ImageClient.ReplaceBackground.g.cs is excluded by !**/generated/**
  • src/libs/Recraft/Generated/Recraft.Models.GenerateImageRequest.g.cs is excluded by !**/generated/**
  • src/libs/Recraft/Generated/Recraft.Models.ImageToImageRequest.g.cs is excluded by !**/generated/**
  • src/libs/Recraft/Generated/Recraft.Models.TransformImageRequest.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/Recraft/openapi.yaml (3 hunks)

$ref: '#/components/schemas/ImageSize'
style:
$ref: '#/components/schemas/ImageStyle'
type: string
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

Avoid losing validation for style: reference a shared StyleInput (oneOf enum|string) instead of plain string

Switching to a bare string removes all validation and weakens SDK typings. Recommend keeping known values via enum while allowing future/custom strings via oneOf. Also keeps requests consistent across endpoints.

Apply this minimal change at this location:

-          type: string
+          $ref: '#/components/schemas/StyleInput'

Then add this schema under components.schemas (outside this hunk):

StyleInput:
  description: Accepts any of the predefined ImageStyle enum values or a custom style string for forward compatibility.
  oneOf:
    - $ref: '#/components/schemas/ImageStyle'
    - type: string

Verification script to surface any other request properties that still use the enum directly (adjust if you adopt StyleInput):


🏁 Script executed:

#!/bin/bash
# Show all style occurrences with their immediate definition lines
rg -n -A 2 $'^\\s*style:\\s*$' src/libs/Recraft/openapi.yaml

Length of output: 570


Replace bare style: type: string with a shared StyleInput (preserve ImageStyle enum + allow custom strings)

Bare strings remove validation and weaken SDK typings. Replace plain type: string occurrences for style with a shared StyleInput schema that oneOfs the existing ImageStyle enum and string.

Files/locations to update in src/libs/Recraft/openapi.yaml:

  • Replace plain string occurrences:
    • lines 434-436 (style: type: string)
    • lines 673-675 (style: type: string)
    • lines 819-821 (style: type: string)
  • Already using ImageStyle (optional to migrate for consistency):
    • lines 358-360, 375-377, 756-758

Apply this minimal change at each plain-string location:

-          type: string
+          $ref: '#/components/schemas/StyleInput'

Add this schema under components.schemas:

StyleInput:
  description: Accepts any of the predefined ImageStyle enum values or a custom style string for forward compatibility.
  oneOf:
    - $ref: '#/components/schemas/ImageStyle'
    - type: string

Suggested verification (already run once — repeat after edits):

rg -n -A 2 $'^\s*style:\s*$' src/libs/Recraft/openapi.yaml

type: number
style:
$ref: '#/components/schemas/ImageStyle'
type: string
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Keep request-style validation while allowing custom values

Mirror the same approach here to avoid weakening schema guarantees and generated client typings.

Apply:

-          type: string
+          $ref: '#/components/schemas/StyleInput'

Note: This keeps ImageToImageRequest aligned with GenerateImageRequest and prevents divergence in client SDKs.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type: string
$ref: '#/components/schemas/StyleInput'
🤖 Prompt for AI Agents
In src/libs/Recraft/openapi.yaml around line 674 the property is declared as a
bare "type: string", which weakens validation and will diverge client typings;
replace this simple string with the same schema pattern used by
GenerateImageRequest (i.e., a oneOf/anyOf that includes the strict enum/ref
version and a permissive string variant) so the request keeps enum validation
but still allows custom values, and update the reference to the shared
enum/schema name so ImageToImageRequest stays aligned with GenerateImageRequest
and generated SDK types remain consistent.

$ref: '#/components/schemas/ResponseFormat'
style:
$ref: '#/components/schemas/ImageStyle'
type: string
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

Align TransformImageRequest.style with shared StyleInput for consistency

Consistent schema across all three request types reduces client confusion and prevents type drift vs. BasicStyle/CreateStyle/Style responses that still use ImageStyle.

Apply:

-          type: string
+          $ref: '#/components/schemas/StyleInput'

Optional follow-up: If both style and style_id can be provided, consider documenting precedence or enforcing mutual exclusivity at the object level with oneOf variants. I can draft that if desired.


🏁 Script executed:

#!/bin/bash
set -euo pipefail
file="src/libs/Recraft/openapi.yaml"
if [ ! -f "$file" ]; then
  echo "MISSING_FILE"
  exit 0
fi

echo "===== Showing lines 760-900 ====="
sed -n '760,900p' "$file" || true

echo
echo "===== Grep for style-related symbols ====="
rg -n "TransformImageRequest|StyleInput|ImageStyle|CreateStyle|BasicStyle|style_id|style:" "$file" || true

echo
for sym in StyleInput ImageStyle TransformImageRequest CreateStyle BasicStyle; do
  echo "===== Context for $sym ====="
  rg -n -A 12 -B 4 "$sym" "$file" || true
  echo
done

Length of output: 12906


Align TransformImageRequest.style with existing ImageStyle enum (not a nonexistent StyleInput)

TransformImageRequest currently uses a raw string for style while other schemas use ImageStyle. I couldn't find a StyleInput schema in the repo — use the existing enum to avoid type drift.

  • File: src/libs/Recraft/openapi.yaml — components.schemas.TransformImageRequest.properties.style (≈ line 819)

Apply:

-          type: string
+          $ref: '#/components/schemas/ImageStyle'

Optional: If both style and style_id can be provided, document precedence or enforce mutual exclusivity (oneOf) at the object level. I can draft that if you want.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type: string
$ref: '#/components/schemas/ImageStyle'
🤖 Prompt for AI Agents
In src/libs/Recraft/openapi.yaml around line 820, the
TransformImageRequest.properties.style is defined as a plain string but should
use the existing ImageStyle enum; change the schema for style to reference the
ImageStyle component (e.g. $ref: '#/components/schemas/ImageStyle') so it
matches other schemas and prevents type drift, and optionally add a oneOf or
clear precedence/mutual-exclusivity rule between style and style_id at the
object level if both may be provided.

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