feat(event_handler): allow custom serializer on BedrockAgentResolver#8271
Conversation
BedrockAgentResolver did not expose the `serializer` parameter that its parent ApiGatewayResolver and its sibling BedrockAgentFunctionResolver already accept, so there was no way to override the default `ensure_ascii=True` serialization. Non-ASCII agent responses (e.g. Korean/Japanese/emoji) were therefore always \uXXXX-escaped in responseBody.body. Expose the existing parent `serializer` argument and pass it through to super().__init__, matching the sibling resolver. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #8271 +/- ##
========================================
Coverage 96.58% 96.58%
========================================
Files 286 286
Lines 14294 14294
Branches 1192 1192
========================================
Hits 13806 13806
Misses 357 357
Partials 131 131 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
leandrodamascena
left a comment
There was a problem hiding this comment.
Thanks @kimnamu! Approved!
|
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |



Issue number: closes #8270
Summary
Changes
BedrockAgentResolveris the only OpenAPI resolver that doesn't exposeserializer, so non-ASCII Bedrock Agent responses can't avoid\uXXXXescaping. This exposes the parentApiGatewayResolver's existingserializerargument onBedrockAgentResolverand passes it through — matching the siblingBedrockAgentFunctionResolver, which already acceptsserializer(and the approach the maintainer endorsed in #7776 / #6394).User experience
BedrockAgentResolver(serializer=...)TypeError: unexpected keyword 'serializer'잔액...escaped잔액은 1,000원입니다 💰(withensure_ascii=False)Out of scope (follow-up): defaulting the builder to
ensure_ascii=False(a behavior change) — intentionally not done here.Checklist
_pydantic/test_bedrock_agent.py(default escapes; custompartial(json.dumps, ensure_ascii=False)preserves non-ASCII). Reverting the source change (keeping tests) →TypeError: ... unexpected keyword argument 'serializer'; restored → 17 passed.ruff/mypyclean.This contribution was prepared with the help of an AI agent (Claude Code); a human reviewed the change, rationale, and test results before submission.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.