Fix JSON schema provider crash for Dict/List fields (#2037) - #2038
Conversation
|
@erral thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment: To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
|
@jenkins-plone-org please run jobs |
…n sub-types are missing (#2037)
20f7e5b to
d9ff170
Compare
|
I have refined the fix to follow a more localized approach as discussed. Refined Changes:
The implementation is now robust against the reported crash while preserving the strictness of the base classes. |
This PR fixes a crash in the JSON schema providers for Dict and List fields when they are defined without specifying sub-types (
key_typeorvalue_type).In
zope.schema, these sub-types default toNone. The previous implementation was unconditionally attempting to adapt theseNonevalues toIJsonSchemaProvider, leading to aComponentLookupError.Changes:
getMultiAdapterwithqueryMultiAdapterand added safety checks forkey_typeandvalue_typeinDictJsonSchemaProviderandCollectionJsonSchemaProvider.src/plone/restapi/tests/test_types.py.Fixes #2037