How to get the full, final Dexterity schema?

A Dexterity-based content type may have its schema fields defined in a multitude of ways. Looking at the FTI, I count at least five different sources that should be checked.

So, by final, full schema I mean the final schema outcome, regardless of how it has been defined and where.

Are there any helpers or utility methods or functions somewhere that would help in this? I would think at some point in the Dexterity content instantiation process there has to be a list of schema fields that has been constructed from all the various possible sources. But I have no good idea where to look for?

Introspecting an already created content item somewhere on the site is not an option.

I think you can use plone.dexterity.utils.iterSchemata(context). This yields the FTI schema + the schemas from behaviors.
This is what we use in plone.restapi for (de)serializing DX content.

iterSchemata(portal_type) should help if you don't yet have an object.

2 Likes

Fabulous, thanks @jaroel!

1 Like