Skip to content

feat:Update OpenAPI spec with new properties, enum values, and schema changes#186

Merged
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202507102117
Jul 10, 2025
Merged

feat:Update OpenAPI spec with new properties, enum values, and schema changes#186
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202507102117

Conversation

@HavenDV
Copy link
Copy Markdown
Contributor

@HavenDV HavenDV commented Jul 10, 2025

Summary by CodeRabbit

  • New Features

    • Added support for specifying a file by URL in addition to file ID.
    • Added an optional server description field for MCP servers.
    • Expanded file purpose options to include user data.
  • Improvements

    • Usage statistics can now be included with completed audio transcription events.
    • Event type names and descriptions have been updated for clarity and consistency.
    • Duration usage fields now use "seconds" instead of "duration" for clearer time representation.
  • Other Changes

    • Java and Kotlin code examples have been removed from certain API documentation sections.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jul 10, 2025

Walkthrough

The changes update the OpenAPI specification by removing Java and Kotlin code examples from certain endpoints, introducing new optional properties (file_url, server_description), extending an enum, refining event type naming conventions, updating example event names, and renaming a field in the duration usage schema from duration to seconds.

Changes

File(s) Change Summary
src/libs/tryAGI.OpenAI/openapi.yaml - Removed Java/Kotlin code examples from two endpoints
- Added file_url and server_description optional properties
- Extended file purpose enum with user_data
- Added usage property to transcription completed event
- Renamed event type strings to use underscores
- Updated event schema name fields
- Renamed duration to seconds in usage schema

Poem

In YAML fields where changes dwell,
New URLs and descriptions swell.
Java and Kotlin bid adieu,
While enums and names get something new.
Seconds now count where durations lay—
A rabbit hops, "Hooray, hooray!"
For OpenAPI’s brighter day!

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

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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) July 10, 2025 21:18
@coderabbitai coderabbitai Bot changed the title feat:@coderabbitai feat:Update OpenAPI spec with new properties, enum values, and schema changes Jul 10, 2025
@HavenDV HavenDV merged commit 6f6b57e into main Jul 10, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202507102117 branch July 10, 2025 21:22
Copy link
Copy Markdown

@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

♻️ Duplicate comments (2)
src/libs/tryAGI.OpenAI/openapi.yaml (2)

21101-21109: Same verification needed for .done event rename.

Run the script above; confirm docs, examples, and tests use the new value exclusively.


21339-21347: Verify all response.output_text.annotation.added references updated.

Old value response.output_text_annotation.added must be removed throughout the spec & codebase.

🧹 Nitpick comments (1)
src/libs/tryAGI.OpenAI/openapi.yaml (1)

15950-15952: Check naming overlap with existing description fields.

server_description duplicates the semantic meaning of a plain description key already present in many schemas.
Unless you need both a short label and a long description, consider re-using description for consistency and to keep the schema shallow.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5806433 and 7abb6ce.

⛔ Files ignored due to path filters (13)
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI..JsonSerializerContext.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.InputFileContent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.MCPTool.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.OpenAIFile.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.OpenAIFilePurpose.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeServerEventConversationItemInputAudioTranscriptionCompleted.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallArgumentsDeltaEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallArgumentsDeltaEventType.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallArgumentsDoneEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseMCPCallArgumentsDoneEventType.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseOutputTextAnnotationAddedEvent.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.ResponseOutputTextAnnotationAddedEventType.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.TranscriptTextUsageDuration.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/tryAGI.OpenAI/openapi.yaml (9 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test / Build, test and publish
🔇 Additional comments (3)
src/libs/tryAGI.OpenAI/openapi.yaml (3)

21068-21076: Legacy enum strings are purged
I ran rg -n "response\.mcp_call\.arguments_delta|response\.mcp_call\.arguments_done" --type yaml against src/libs/tryAGI.OpenAI/openapi.yaml and found no matches. All stale references have been removed.


16936-16938: Ensure backend validation for the new enum value user_data

Adding "user_data" to the client enum is backward-compatible, but you must verify that the server accepts it. Please confirm that all validation layers recognize the new value for the purpose field:

  • Confirm the OpenAPI schema’s purpose enum includes "user_data".
  • Update any backend validation logic (controllers, serializers, middleware) to accept "user_data".
  • Check database constraints or enums (if any) allow "user_data".
  • Run end-to-end tests (e.g., file uploads, fine-tune jobs) with purpose: "user_data".
  • Optionally, update the YAML examples in openapi.yaml to demonstrate usage of "user_data".

23728-23733: Confirm property rename in OpenAPI spec and update code references

Verified that in src/libs/tryAGI.OpenAI/openapi.yaml, the TranscriptTextUsageDuration schema no longer defines a duration field—it’s been renamed to seconds. No dangling duration references remain in the spec.
Please ensure any client- or server-side code (including generated SDKs or type definitions) expecting TranscriptTextUsageDuration.duration is updated to use seconds.

• src/libs/tryAGI.OpenAI/openapi.yaml: TranscriptTextUsageDuration.properties.seconds (formerly duration)
• Review all generated clients/servers for TranscriptTextUsageDuration.duration usage

Comment on lines 18296 to 18300
- item_id
- content_index
- transcript
- usage
type: object
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Making usage a required field could break existing clients.

Previous versions emitted this event without usage; marking it required is a breaking change. Confirm that:

  1. All producers now supply usage.
  2. Consumers have been updated before release.

If not, keep it optional or release under a new major version.

🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 18296 to 18300, the usage
field is marked as required, which may break existing clients that do not
provide this field. Verify that all event producers now include usage and that
all consumers are updated to handle it. If either condition is not met, revert
usage to optional or consider releasing this change in a new major version to
avoid breaking compatibility.

Comment on lines +14903 to +14905
file_url:
type: string
description: The URL of the file to be sent to the model.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Declare file_url as a URI and document exclusivity with file_id.

file_url represents a remote resource, so OpenAPI best-practice is to add format: uri for basic syntactic validation.
Also, consider specifying that either file_id or file_url must be supplied (but not both) to avoid ambiguous requests.

 file_url:
   type: string
+  format: uri
   description: The URL of the file to be sent to the model.

If mutual exclusivity is desired, add a oneOf/anyOf constraint at the parent schema level.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 14903 to 14905, update the
schema to declare the `file_url` property with `format: uri` to ensure it is
validated as a URI. Additionally, modify the parent schema to enforce mutual
exclusivity between `file_id` and `file_url` by adding a `oneOf` or `anyOf`
constraint, specifying that only one of these fields can be provided in a
request to prevent ambiguity.

Comment on lines +18326 to +18334
usage:
type: object
oneOf:
- $ref: '#/components/schemas/TranscriptTextUsageTokens'
- $ref: '#/components/schemas/TranscriptTextUsageDuration'
description: Usage statistics for the transcription.
description: "This event is the output of audio transcription for user audio written to the\nuser audio buffer. Transcription begins when the input audio buffer is\ncommitted by the client or server (in `server_vad` mode). Transcription runs\nasynchronously with Response creation, so this event may come before or after\nthe Response events.\n\nRealtime API models accept audio natively, and thus input transcription is a\nseparate process run on a separate ASR (Automatic Speech Recognition) model.\nThe transcript may diverge somewhat from the model's interpretation, and\nshould be treated as a rough guide.\n"
x-oaiMeta:
example: "{\n \"event_id\": \"event_2122\",\n \"type\": \"conversation.item.input_audio_transcription.completed\",\n \"item_id\": \"msg_003\",\n \"content_index\": 0,\n \"transcript\": \"Hello, how are you?\"\n}\n"
example: "{\n \"event_id\": \"event_2122\",\n \"type\": \"conversation.item.input_audio_transcription.completed\",\n \"item_id\": \"msg_003\",\n \"content_index\": 0,\n \"transcript\": \"Hello, how are you?\",\n \"usage\": {\n \"type\": \"tokens\",\n \"total_tokens\": 48,\n \"input_tokens\": 38,\n \"input_token_details\": {\n \"text_tokens\": 10,\n \"audio_tokens\": 28,\n },\n \"output_tokens\": 10,\n }\n}\n"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider a discriminator for the oneOf usage object.

oneOf with TranscriptTextUsageTokens and TranscriptTextUsageDuration relies on structural uniqueness.
Add a discriminator (e.g., the existing type property) for unambiguous deserialisation across languages.

 usage:
   type: object
   oneOf:
     - $ref: '#/components/schemas/TranscriptTextUsageTokens'
     - $ref: '#/components/schemas/TranscriptTextUsageDuration'
+  discriminator:
+    propertyName: type
   description: Usage statistics for the transcription.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 18326 to 18334, the oneOf
schema using TranscriptTextUsageTokens and TranscriptTextUsageDuration lacks a
discriminator, which can cause ambiguous deserialization. Add a discriminator
property, such as the existing 'type' field, to the oneOf definition to clearly
distinguish between these object types during deserialization across different
languages.

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.

1 participant