feat:Expand OpenAPI specification with comprehensive schemas#256
feat:Expand OpenAPI specification with comprehensive schemas#256
Conversation
WalkthroughExpands the OpenAPI specification with comprehensive schemas for responses, streaming events, webhooks, messages, content parts, organizational management, tools, and configurations. Adds definitions for error handling, status tracking, and multi-modal content support. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/libs/tryAGI.OpenAI/openapi.yaml`:
- Around line 37213-37215: The extension "seconds" bodies claim allowed values
4, 8, 12, 16, 20 but the shared VideoSeconds schema only enumerates 4 and 12
(and the diff shows '8' and '12' entries being inconsistent); reconcile by
either (A) creating a dedicated enum for the extension (e.g., a new schema like
VideoSecondsExtension or seconds enum) that includes 4, 8, 12, 16, 20 and point
the extension bodies to that new schema, or (B) update the prose in the
extension bodies to exactly match the existing VideoSeconds schema values; apply
the same reconciliation for the other instances referenced around the file (the
other extension bodies at the locations noted: ~37368-37370 and ~37388-37390) so
consumers follow a single authoritative enum.
- Around line 9094-9100: The POST operations for the video endpoints currently
omit requestBody.required, causing a mismatch with the schemas that declare
required fields; update each operation under the paths /videos,
/videos/characters, /videos/edits, and /videos/extensions to include
requestBody.required: true (i.e., inside each operation's requestBody object set
"required": true) so the OpenAPI spec correctly marks the body as mandatory for
CreateVideoMultipartBody and CreateVideoJsonBody schemas.
- Around line 9189-9192: The examples are missing required imports and a
constructor: in the Node.js snippets that call fs.createReadStream(...) (e.g.,
in the character and video examples) add an import for the fs module (import fs
from 'fs';) after the OpenAI import so fs is defined, and in the Java examples
that instantiate ByteArrayInputStream for video data (e.g.,
CharacterCreateParams/video edit examples) use the Java constructor with new
(new ByteArrayInputStream(...)) so the code compiles; update the example
snippets that reference fs.createReadStream and ByteArrayInputStream
accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d3e7fb7b-a9da-4152-a8f6-c6719f96c209
⛔ Files ignored due to path filters (34)
src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideo.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoCharacter.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoEdit.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoExtend.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.GetVideoCharacter.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoCharacterBody.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoCharacterBody.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoEditJsonBody.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoEditJsonBody.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoEditMultipartBody.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoEditMultipartBody.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoExtendJsonBody.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoExtendJsonBody.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoExtendMultipartBody.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoExtendMultipartBody.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoJsonBody.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoJsonBody.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoMultipartBody.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CreateVideoMultipartBody.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VideoCharacterResource.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VideoCharacterResource.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VideoCharacterResourceId.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VideoCharacterResourceId.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VideoCharacterResourceName.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VideoCharacterResourceName.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VideoReferenceInputParam.Json.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.VideoReferenceInputParam.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideo.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoCharacter.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoEdit.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoExtend.g.csis excluded by!**/generated/**src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.GetVideoCharacter.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/tryAGI.OpenAI/openapi.yaml
| content: | ||
| multipart/form-data: | ||
| schema: | ||
| $ref: '#/components/schemas/CreateVideoBody' | ||
| $ref: '#/components/schemas/CreateVideoMultipartBody' | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/CreateVideoBody' | ||
| $ref: '#/components/schemas/CreateVideoJsonBody' |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Check if file exists and get line count
ls -la src/libs/tryAGI.OpenAI/openapi.yaml 2>&1 && wc -l src/libs/tryAGI.OpenAI/openapi.yamlRepository: tryAGI/OpenAI
Length of output: 186
🏁 Script executed:
# Extract the specific sections mentioned in the review
echo "=== Lines 9094-9100 (first endpoint) ===" && sed -n '9094,9100p' src/libs/tryAGI.OpenAI/openapi.yaml
echo -e "\n=== Lines 9173-9177 (second endpoint) ===" && sed -n '9173,9177p' src/libs/tryAGI.OpenAI/openapi.yaml
echo -e "\n=== Lines 9230-9237 (third endpoint) ===" && sed -n '9230,9237p' src/libs/tryAGI.OpenAI/openapi.yaml
echo -e "\n=== Lines 9260-9267 (fourth endpoint) ===" && sed -n '9260,9267p' src/libs/tryAGI.OpenAI/openapi.yamlRepository: tryAGI/OpenAI
Length of output: 1179
🏁 Script executed:
# Get broader context around first endpoint to see the requestBody structure
echo "=== Broader context for first endpoint (9090-9105) ===" && sed -n '9090,9105p' src/libs/tryAGI.OpenAI/openapi.yamlRepository: tryAGI/OpenAI
Length of output: 631
🏁 Script executed:
# Search for the referenced schema definitions to check required fields
echo "=== CreateVideoMultipartBody schema ===" && rg -A 20 'CreateVideoMultipartBody:' src/libs/tryAGI.OpenAI/openapi.yaml | head -40
echo -e "\n=== CreateVideoJsonBody schema ===" && rg -A 20 'CreateVideoJsonBody:' src/libs/tryAGI.OpenAI/openapi.yaml | head -40Repository: tryAGI/OpenAI
Length of output: 1765
Mark these POST request bodies as required.
All four operations omit requestBody.required: true. In OpenAPI 3.1.0, requestBody.required defaults to false, so these endpoints are currently described as accepting optional bodies even though each referenced schema declares required fields. This creates a mismatch that will cause SDK generation and validation issues.
Add required: true to /videos (line 9093), /videos/characters (line 9172), /videos/edits (line 9229), and /videos/extensions (line 9259).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/tryAGI.OpenAI/openapi.yaml` around lines 9094 - 9100, The POST
operations for the video endpoints currently omit requestBody.required, causing
a mismatch with the schemas that declare required fields; update each operation
under the paths /videos, /videos/characters, /videos/edits, and
/videos/extensions to include requestBody.required: true (i.e., inside each
operation's requestBody object set "required": true) so the OpenAPI spec
correctly marks the body as mandatory for CreateVideoMultipartBody and
CreateVideoJsonBody schemas.
| node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst character = await client.videos.character.create({\n name: 'x',\n video: fs.createReadStream('path/to/file'),\n});\n\nconsole.log(character.id);" | ||
| python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\ncharacter = client.videos.character.create(\n name=\"x\",\n video=b\"Example data\",\n)\nprint(character.id)" | ||
| go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcharacter, err := client.Videos.Character.New(context.TODO(), openai.VideoCharacterNewParams{\n\t\tName: \"x\",\n\t\tVideo: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", character.ID)\n}\n" | ||
| java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.character.CharacterCreateParams;\nimport com.openai.models.videos.character.CharacterCreateResponse;\nimport java.io.ByteArrayInputStream;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n CharacterCreateParams params = CharacterCreateParams.builder()\n .name(\"x\")\n .video(ByteArrayInputStream(\"Example data\".getBytes()))\n .build();\n CharacterCreateResponse character = client.videos().character().create(params);\n }\n}" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, check the file exists and get its size
wc -l src/libs/tryAGI.OpenAI/openapi.yamlRepository: tryAGI/OpenAI
Length of output: 98
🏁 Script executed:
# Now look at lines 9189-9192 and surrounding context
sed -n '9185,9195p' src/libs/tryAGI.OpenAI/openapi.yamlRepository: tryAGI/OpenAI
Length of output: 2327
🏁 Script executed:
# Also check lines 9249-9252 and surrounding context
sed -n '9245,9255p' src/libs/tryAGI.OpenAI/openapi.yamlRepository: tryAGI/OpenAI
Length of output: 2221
Add missing imports and new operator to code examples.
The Node.js examples use fs.createReadStream(...) without importing the fs module—add import fs from 'fs'; after the OpenAI import. The Java examples call ByteArrayInputStream(...) without the new keyword, which will cause a compilation error—fix to new ByteArrayInputStream(...).
Both issues appear at lines 9189-9192 (character creation) and 9249-9252 (video editing).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/tryAGI.OpenAI/openapi.yaml` around lines 9189 - 9192, The examples
are missing required imports and a constructor: in the Node.js snippets that
call fs.createReadStream(...) (e.g., in the character and video examples) add an
import for the fs module (import fs from 'fs';) after the OpenAI import so fs is
defined, and in the Java examples that instantiate ByteArrayInputStream for
video data (e.g., CharacterCreateParams/video edit examples) use the Java
constructor with new (new ByteArrayInputStream(...)) so the code compiles;
update the example snippets that reference fs.createReadStream and
ByteArrayInputStream accordingly.
| - '8' | ||
| - '12' | ||
| type: string |
There was a problem hiding this comment.
Reconcile the extension seconds contract.
Both extension bodies document 4, 8, 12, 16, 20, but they still point at the shared VideoSeconds schema defined above. Any schema consumer will follow the enum, not the prose, so either introduce a dedicated extension enum that includes 16 and 20 or trim the descriptions to match the actual schema.
One way to make the schema match the documented contract
+ VideoExtensionSeconds:
+ enum:
+ - '4'
+ - '8'
+ - '12'
+ - '16'
+ - '20'
+ type: string
...
- $ref: '#/components/schemas/VideoSeconds'
+ $ref: '#/components/schemas/VideoExtensionSeconds'
...
- $ref: '#/components/schemas/VideoSeconds'
+ $ref: '#/components/schemas/VideoExtensionSeconds'Also applies to: 37368-37370, 37388-37390
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/libs/tryAGI.OpenAI/openapi.yaml` around lines 37213 - 37215, The
extension "seconds" bodies claim allowed values 4, 8, 12, 16, 20 but the shared
VideoSeconds schema only enumerates 4 and 12 (and the diff shows '8' and '12'
entries being inconsistent); reconcile by either (A) creating a dedicated enum
for the extension (e.g., a new schema like VideoSecondsExtension or seconds
enum) that includes 4, 8, 12, 16, 20 and point the extension bodies to that new
schema, or (B) update the prose in the extension bodies to exactly match the
existing VideoSeconds schema values; apply the same reconciliation for the other
instances referenced around the file (the other extension bodies at the
locations noted: ~37368-37370 and ~37388-37390) so consumers follow a single
authoritative enum.
Summary by CodeRabbit
Release Notes