fix(go): handle optional image encoding (*types.Image)#2996
Merged
Conversation
Fix Go encoder to properly handle pointer-to-interface types like *types.Image. In Go, a pointer to an interface doesn't implement the interface, so we need to check both the original value and the dereferenced value for InternalBamlSerializer. Also fixes a bug where all media types were being converted to Image in streaming type conversion - now preserves the actual media type (Image, Audio, PDF, Video). Changes: - Add second type assertion check on concreteValue in encode.go - Fix streaming.rs to preserve media types instead of converting all to Image - Add media type tests to type_serialization_tests.md - Add Go integration tests for optional image input Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
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.
Summary
*types.Image*types.Image(pointer to interface) doesn't implementInternalBamlSerializer, but the dereferenced value doesImagein streaming type conversionTest plan
TestOptionalImageInputNilandTestOptionalImageInputWithValue🤖 Generated with Claude Code