plone.restapi
plone.restapi copied to clipboard
Using CatalogSource sources
The @sources
endpoint is registered now for IContentish, which is not provided by Plone root.
A field such as
partner= RelationChoice(source=CatalogSource(portal_type='Partner'))
Is serialized like:
"partner": {
"behavior": "IHasPartner",
"description": "",
"factory": "Relation Choice",
"title": "Partner",
"type": "string",
"vocabulary": {
"@id": "http://localhost:3000/@sources/partner"
}
},
Notice the @source
endpoint is rooted in the Plone root.
It seems like @source
bails out early if there's no field found. https://github.com/plone/plone.restapi/blob/34dc327285efe85ac7ee2bac73905f7352818bc8/src/plone/restapi/services/sources/get.py#L35
I think it should take into consideration the CatalogSource use case, which is a context-less source.
@tiberiuichim as long as we do not have Plone 6 with the Dx-siteroot PLIP merged, we can register the @sources endpoint for the Plone root. This is what we did for other endpoints as well.