Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public partial interface IImageClient
int? randomSeed = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.ImageSize? size = default,
global::Recraft.ImageStyle? style = default,
string? style = default,
global::System.Guid? styleId = default,
global::Recraft.ImageSubStyle? substyle = default,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public partial interface IImageClient
string? negativePrompt = default,
int? randomSeed = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.ImageStyle? style = default,
string? style = default,
global::System.Guid? styleId = default,
global::Recraft.ImageSubStyle? substyle = default,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public partial interface IImageClient
string? negativePrompt = default,
int? randomSeed = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.ImageStyle? style = default,
string? style = default,
global::System.Guid? styleId = default,
global::Recraft.ImageSubStyle? substyle = default,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ partial void ProcessGenerateImageResponseContent(
int? randomSeed = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.ImageSize? size = default,
global::Recraft.ImageStyle? style = default,
string? style = default,
global::System.Guid? styleId = default,
global::Recraft.ImageSubStyle? substyle = default,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ partial void ProcessImageToImageResponseContent(
if (request.Style != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.Style?.ToValueString()}"),
content: new global::System.Net.Http.StringContent($"{request.Style}"),
name: "style");
}
if (request.StyleId != default)
Expand Down Expand Up @@ -293,7 +293,7 @@ partial void ProcessImageToImageResponseContent(
string? negativePrompt = default,
int? randomSeed = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.ImageStyle? style = default,
string? style = default,
global::System.Guid? styleId = default,
global::Recraft.ImageSubStyle? substyle = default,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ partial void ProcessReplaceBackgroundResponseContent(
if (request.Style != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.Style?.ToValueString()}"),
content: new global::System.Net.Http.StringContent($"{request.Style}"),
name: "style");
}
if (request.StyleId != default)
Expand Down Expand Up @@ -280,7 +280,7 @@ partial void ProcessReplaceBackgroundResponseContent(
string? negativePrompt = default,
int? randomSeed = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.ImageStyle? style = default,
string? style = default,
global::System.Guid? styleId = default,
global::Recraft.ImageSubStyle? substyle = default,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ public sealed partial class GenerateImageRequest
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("style")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Recraft.JsonConverters.ImageStyleJsonConverter))]
public global::Recraft.ImageStyle? Style { get; set; }
public string? Style { get; set; }

/// <summary>
///
Expand Down Expand Up @@ -152,7 +151,7 @@ public GenerateImageRequest(
int? randomSeed,
global::Recraft.ResponseFormat? responseFormat,
global::Recraft.ImageSize? size,
global::Recraft.ImageStyle? style,
string? style,
global::System.Guid? styleId,
global::Recraft.ImageSubStyle? substyle,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ public sealed partial class ImageToImageRequest
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("style")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Recraft.JsonConverters.ImageStyleJsonConverter))]
public global::Recraft.ImageStyle? Style { get; set; }
public string? Style { get; set; }

/// <summary>
///
Expand Down Expand Up @@ -170,7 +169,7 @@ public ImageToImageRequest(
string? negativePrompt,
int? randomSeed,
global::Recraft.ResponseFormat? responseFormat,
global::Recraft.ImageStyle? style,
string? style,
global::System.Guid? styleId,
global::Recraft.ImageSubStyle? substyle,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ public sealed partial class TransformImageRequest
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("style")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Recraft.JsonConverters.ImageStyleJsonConverter))]
public global::Recraft.ImageStyle? Style { get; set; }
public string? Style { get; set; }

/// <summary>
///
Expand Down Expand Up @@ -153,7 +152,7 @@ public TransformImageRequest(
string? negativePrompt,
int? randomSeed,
global::Recraft.ResponseFormat? responseFormat,
global::Recraft.ImageStyle? style,
string? style,
global::System.Guid? styleId,
global::Recraft.ImageSubStyle? substyle,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout)
Expand Down
6 changes: 3 additions & 3 deletions src/libs/Recraft/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ components:
size:
$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

style_id:
type: string
format: uuid
Expand Down Expand Up @@ -671,7 +671,7 @@ components:
strength:
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.

style_id:
type: string
format: uuid
Expand Down Expand Up @@ -817,7 +817,7 @@ components:
response_format:
$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.

style_id:
type: string
format: uuid
Expand Down
Loading