Skip to content

fix: post-gen patch for embeddings input serialization#153

Merged
SSharma-10 merged 1 commit intomainfrom
fix/embeddings-input-serialization-v2
Apr 28, 2026
Merged

fix: post-gen patch for embeddings input serialization#153
SSharma-10 merged 1 commit intomainfrom
fix/embeddings-input-serialization-v2

Conversation

@harshmaru7
Copy link
Copy Markdown
Contributor

Summary

  • Kiota generates writeCollectionOfObjectValues for Embeddings_request.input (a string | string[] union type), which wraps each plain string in {} braces, producing malformed JSON like [{"hello world"}] instead of ["hello world"]
  • Adds a post-generation step (step 7) to postgen-inference.mjs that automatically replaces the broken call with writeCollectionOfPrimitiveValues after every make generate
  • The serializationFixes array is extensible for any similar Kiota union-type bugs in the future

Test plan

  • Run make generate and verify src/dots/models/index.ts uses writeCollectionOfPrimitiveValues for embeddings_request.input
  • Call /v1/embeddings with an array input and verify the request succeeds

Made with Cursor

Kiota generates writeCollectionOfObjectValues for Embeddings_request.input
(a string | string[] union), which wraps each string in {} braces producing
malformed JSON. Add post-gen step 7 to replace it with
writeCollectionOfPrimitiveValues, which correctly serializes string arrays.

Made-with: Cursor
@SSharma-10 SSharma-10 merged commit 8497bba into main Apr 28, 2026
5 checks passed
@SSharma-10 SSharma-10 deleted the fix/embeddings-input-serialization-v2 branch April 28, 2026 10:48
@SSharma-10 SSharma-10 mentioned this pull request Apr 28, 2026
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.

2 participants