Skip to content

feat:Enhance dubbing audio endpoint: add 422, update 404 & export lang_code#64

Merged
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202503251237
Mar 25, 2025
Merged

feat:Enhance dubbing audio endpoint: add 422, update 404 & export lang_code#64
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202503251237

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Mar 25, 2025

Summary by CodeRabbit

  • New Features
    • Enhanced audio dubbing responses with improved error handling.
    • Introduced a new validation error response and updated error messages for scenarios where a language-specific resource is unavailable.

@coderabbitai
Copy link

coderabbitai bot commented Mar 25, 2025

Walkthrough

This pull request enhances the /v1/dubbing/{dubbing_id}/audio/{language_code} endpoint by introducing improved error handling and validation. A new 422 response is defined to handle validation errors, while the existing 404 response now includes a more detailed error message for cases where the dubbing is not found in the specified language. Additionally, the GetDubbedFileResponseModel schema is updated to export a new language_code field.

Changes

File(s) Change Summary
src/libs/ElevenLabs/openapi.yaml Added a 422 response for validation errors; updated the 404 response with a detailed error message; added the language_code field to schema.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant API as API

    C->>API: Request to /v1/dubbing/{dubbing_id}/audio/{language_code}
    alt Validation Error
        API-->>C: 422 Validation Error Response
    else Dubbing Not Found
        API-->>C: 404 Detailed Error Response
    else Success
        API-->>C: 200 Success Response with language_code field
    end
Loading

Possibly related PRs

Poem

(_/) Hop, hop, in code we play,
A 422 joins the fray today.
A 404 now tells more clear,
When dubbing isn’t found, have no fear.
With language codes in our design,
This rabbit cheers—code now aligns!


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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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 merged commit a7388c4 into main Mar 25, 2025
1 of 3 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202503251237 branch March 25, 2025 12:38
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Enhance dubbing audio endpoint: add 422, update 404 & export lang_code Mar 25, 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: 2

🧹 Nitpick comments (5)
src/libs/ElevenLabs/openapi.yaml (5)

4147-4159: Expanded Response Content for 200 Success
Including an alternative text/plain content type alongside application/json for the 200 response is a thoughtful enhancement for client compatibility. It would be even clearer if an example were provided for the text/plain response similar to the JSON example to ensure consistency in documentation.


9051-9058: Schema Constraints for num_speakers
Defining explicit minimum (1) and maximum (32) values for num_speakers provides clear validation rules. Note that the description mentions a default behavior when null, so ensure that the documentation and implementation consistently handle the case when this field is not set.


10112-10119: Validation for response_timeout_secs
The newly added constraints (minimum: 1, maximum: 30) for the response_timeout_secs field help enforce valid input ranges. Please double-check that these limits are consistent with backend expectations and that any defaults or fallbacks (if applicable) are clearly documented.


14307-14325: Updated Constraints for Vector and Document Length Fields
The revisions for max_vector_distance and max_documents_length now use exclusive boundaries, which enforce a strict range. Verify that these boundaries (0 < value < 1 for distance, and 0 < value < 10,000,000 for documents length) are in line with the intended business logic. If edge values (such as exactly 0 or 1) should be allowed, you might want to reconsider the use of exclusive limits.


15922-15953: Comprehensive Audio Output Parameter Updates
Multiple audio output parameters—including loudness, quality, seed, and guidance_scale—now have clearly defined ranges and defaults. While these constraints seem sensible (e.g., loudness between -1 and 1, guidance_scale up to 100), please confirm that they match the underlying service logic and that your documentation reflects any nuanced behavior at the range boundaries.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7802130 and 293986a.

⛔ Files ignored due to path filters (2)
  • src/libs/ElevenLabs/Generated/ElevenLabs.DubbingClient.GetDubbingByDubbingIdAudioByLanguageCode.g.cs is excluded by !**/generated/**
  • src/libs/ElevenLabs/Generated/ElevenLabs.DubbingClient.GetDubbingByDubbingIdTranscriptByLanguageCode.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/ElevenLabs/openapi.yaml (10 hunks)
🔇 Additional comments (3)
src/libs/ElevenLabs/openapi.yaml (3)

4168-4186: Consistent Error Handling for Transcript Endpoint
The transcript endpoint now mirrors the improvements made for the audio endpoint by adding a 422 response for validation errors. This consistency across endpoints is excellent. Please double-check that the error messaging (e.g., for transcript_not_found) and the referenced schema remain aligned with your overall error handling strategy.


15427-15434: Schema Amendment for TTS Optimization
Linking to the external schema TTSOptimizeStreamingLatency and setting constraints for stability (between 0 and 1) provide clarity for TTS optimization parameters. Ensure that these constraints sync well with your TTS service expectations and that any dependencies on this schema are updated across the documentation.


15439-15446: Clear Range for Similarity Boost
Defining similarity_boost with a range of 0 to 1 and a default value of 0.8 is straightforward and aligns well with similar parameters elsewhere in the spec. No further changes are needed here.

Comment on lines 10149 to 10156
default: false
response_timeout_secs:
title: Response Timeout Secs
maximum: 30.0
minimum: 1.0
maximum: 30
minimum: 1
type: integer
nullable: true
dynamic_variables:
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

DRY Opportunity for response_timeout_secs Schema
This field is defined again with similar constraints later in the file. To avoid duplication and potential inconsistencies, consider refactoring these common constraints into a shared component that can be reused across the API specification.

Comment on lines 4085 to 4103
example:
error: dubbing_not_found
message: 'There is no dubbing for language {language_code}.'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'425':
description: Dubbing not ready
content:
application/json:
example:
error: dubbing_not_dubbed
message: Dubbing has not finished yet.
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
x-fern-sdk-group-name: dubbing
x-fern-sdk-method-name: get_dubbed_file
'/v1/dubbing/{dubbing_id}/transcript/{language_code}':
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhanced Error Handling for Audio Endpoint
The addition of a new 422 response for validation errors is a strong improvement, and the updated 404 example now explicitly includes the missing language context. Please verify that the referenced schema HTTPValidationError is correctly defined in your components. Also, consider whether common error responses like these might be beneficial to extract into reusable components to reduce duplication across endpoints.

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