Skip to content

Conversation

@puretension
Copy link

Summary

Improves type safety for aspectRatio parameters across media generation APIs by replacing loose string types with strongly-typed unions.

Changes

  • Add ImageAspectRatio and VideoAspectRatio type definitions
  • Update GenerateImagesConfig, EditImageConfig, and GenerateVideosConfig interfaces
  • Enable IDE autocomplete and compile-time validation

🚀 Developer Experience Improvement

Before After
No type safety or autocomplete Full type safety with autocomplete
No guidance for developers Perfect IDE autocomplete support

Benefits

  • Better developer experience with autocomplete
  • Prevents invalid aspect ratio values at compile time
  • Centralizes aspect ratio definitions (DRY principle)
  • Maintains 100% backward compatibility

Type Definitions

// Common aspect ratios supported across all media generation APIs
export type CommonAspectRatio = "9:16" | "16:9";

// Aspect ratios for image generation and editing
export type ImageAspectRatio = CommonAspectRatio | "1:1" | "3:4" | "4:3";

// Aspect ratios for video generation  
export type VideoAspectRatio = CommonAspectRatio;

@google-cla
Copy link

google-cla bot commented Jul 22, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@shmishra99 shmishra99 self-assigned this Sep 26, 2025
@shmishra99
Copy link
Collaborator

Hi @puretension,

Thanks for your contribution to the SDK. We've noticed your forked repository currently has a merge conflict. Could you please resolve the conflict on your end so we can proceed with reviewing the PR? We appreciate your work.

@shmishra99 shmishra99 added generated: genai Contains Generative AI based code, requesting an additional reviewer. status:awaiting user response issues requiring a response from the user labels Sep 29, 2025
@puretension
Copy link
Author

Hi @shmishra99,

Thank you for the feedback! I've resolved the merge conflict on my end. The PR should now be ready for review.

I really appreciate you taking the time to look at this contribution and have been looking forward to your feedback.
Please let me know if there's any additional feedback or if there are any other changes needed from my side.

@puretension puretension force-pushed the feat/improve-aspect-ratio-types branch from deb5900 to a79ec8f Compare September 29, 2025 09:54
@shmishra99 shmishra99 removed the status:awaiting user response issues requiring a response from the user label Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

generated: genai Contains Generative AI based code, requesting an additional reviewer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants