-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:OpenAPI: change style property from enum to string in image requests #62
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -432,7 +432,7 @@ components: | |||||
| size: | ||||||
| $ref: '#/components/schemas/ImageSize' | ||||||
| style: | ||||||
| $ref: '#/components/schemas/ImageStyle' | ||||||
| type: string | ||||||
| style_id: | ||||||
| type: string | ||||||
| format: uuid | ||||||
|
|
@@ -671,7 +671,7 @@ components: | |||||
| strength: | ||||||
| type: number | ||||||
| style: | ||||||
| $ref: '#/components/schemas/ImageStyle' | ||||||
| type: string | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
🤖 Prompt for AI Agents |
||||||
| style_id: | ||||||
| type: string | ||||||
| format: uuid | ||||||
|
|
@@ -817,7 +817,7 @@ components: | |||||
| response_format: | ||||||
| $ref: '#/components/schemas/ResponseFormat' | ||||||
| style: | ||||||
| $ref: '#/components/schemas/ImageStyle' | ||||||
| type: string | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainAlign 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
doneLength 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.
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
Suggested change
🤖 Prompt for AI Agents |
||||||
| style_id: | ||||||
| type: string | ||||||
| format: uuid | ||||||
|
|
||||||
There was a problem hiding this comment.
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:
Then add this schema under components.schemas (outside this hunk):
Verification script to surface any other request properties that still use the enum directly (adjust if you adopt StyleInput):
🏁 Script executed:
Length of output: 570
Replace bare
style: type: stringwith a shared StyleInput (preserve ImageStyle enum + allow custom strings)Bare strings remove validation and weaken SDK typings. Replace plain
type: stringoccurrences forstylewith a sharedStyleInputschema that oneOfs the existingImageStyleenum andstring.Files/locations to update in src/libs/Recraft/openapi.yaml:
Apply this minimal change at each plain-string location:
Add this schema under components.schemas:
Suggested verification (already run once — repeat after edits):
rg -n -A 2 $'^\s*style:\s*$' src/libs/Recraft/openapi.yaml