Uh oh!
There was an error while loading. Please reload this page.
fix: use ConfigDict instead of class-based Config in RequestContext - #522
fix: use ConfigDict instead of class-based Config in RequestContext#522citizen204 wants to merge 2 commits into
Conversation
Pydantic V2 deprecated class-based model Config in favor of model_config = ConfigDict(...). Replace the inner Config class in RequestContext with the ConfigDict pattern to silence the deprecation warning emitted on import. Fixesaws#320
codecov-commenter
commented
Jun 24, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #522 +/- ##
=======================================
Coverage ? 89.20% =======================================
Files ? 96 Lines ? 8441 Branches ? 1256 =======================================
Hits ? 7530 Misses ? 586 Partials ? 325
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
valter-silva-au
commented
Jun 27, 2026
Nice — this is the idiomatic V2 pattern and matches the existing One suggestion to lock it in: add a regression test in |
…RequestContext
Instantiate RequestContext under warnings.simplefilter("error", PydanticDeprecatedSince20)
to ensure class-based Config never silently creeps back in.
Addresses review feedback from valter-silva-au on aws#522.citizen204
commented
Jul 2, 2026
Thanks for the suggestion @valter-silva-au — added the regression test in a3175ec. It instantiates |
Summary
RequestContextinsrc/bedrock_agentcore/runtime/context.pyuses the Pydantic V1-style innerclass Configto setarbitrary_types_allowed = True. Pydantic V2 deprecated this pattern and emits aPydanticDeprecatedSince20warning on every import ofBedrockAgentCoreApp, adding noise to user applications and test suites.Replace the inner
Configclass withmodel_config = ConfigDict(arbitrary_types_allowed=True)— the idiomatic Pydantic V2 pattern — so the warning is no longer emitted.Fixes#320
Changes
src/bedrock_agentcore/runtime/context.py: importConfigDictfrompydantic; replaceclass Configwithmodel_config = ConfigDict(arbitrary_types_allowed=True)