Update Gemini API spec from Discovery, regenerate bindings, and add live (multimodal) integration tests#1
Draft
o1lo01ol1o wants to merge 4 commits intosonowz:masterfrom
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description (Detailed)
Context / Motivation
This repo is an auto-generated low-level Haskell client for the Gemini (Generative Language) API. The
upstream OpenAPI spec link from the public docs was unavailable/404, and the repo’s existing spec had
fallen behind the latest API revision. We needed a repeatable way to:
What Changed
1) Update the API spec source of truth
Why
the stable upstream artifact.
2) Add a reproducible Discovery → OpenAPI generation workflow
version=v1beta and writes ./openapi.yaml for this repo.
config) to build native deps required by Haskell packages.
Why
3) Sanitize the converted OpenAPI so generators don’t choke
Inside genai-generate-openapi (embedded Node script in nix/modules/flake/devshell.nix), we sanitize schemas
to remove Discovery-only / invalid OpenAPI keywords and prevent codegen collisions.
Key fixes:
cause duplicate record fields in Haskell.
Why
generationConfigResponseJsonSchema collision).
4) Regenerate the Haskell client from the updated spec
f8a9f56).
Why
5) Add live integration tests that hit the real API using generated client code
haskell-google-genai-client.cabal.
language.
Live-test environment variables:
Why
6) Improve developer ergonomics / documentation
Why
How to Reproduce / Regenerate
Update spec and regenerate bindings
Run live tests
GEMINI_API_KEY='...' GEMINI_PRINT_MODELS=1 cabal test live --test-options='--match listModels'
GEMINI_API_KEY='...' GEMINI_MODEL='models/gemini-3-pro-preview' cabal test live --test-options='--match
generateContent'
GEMINI_API_KEY='...' GEMINI_IMAGE_MODEL='models/gemini-3-pro-image-preview'
GEMINI_HTTP_TIMEOUT_SECONDS=180 cabal test live --test-options='--match multimodal'
Notes / Known Tradeoffs
doesn’t ship in the Haskell library artifact, but it’s worth tracking if you want to vendor/pin/fork
the converter.
transient image decoding errors. Timeouts are now configurable.