Option to transform primary field target to provide information about the target rather than just it's URL#1903
Option to transform primary field target to provide information about the target rather than just it's URL#1903JeffersonBledsoe wants to merge 15 commits intomainfrom
Conversation
… to that of image and file fields
|
@JeffersonBledsoe 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! |
…de information about the target rather than just it's URL plone#1903
… if we've already deserialized a field. plone#1903
|
@davisagli I've been having some issues trying to complete this and wanted to check it made sense as it would be a breaking change without the environment variable. The functionality mostly works well, but as you can see from the latest test runs, the
|
|
@JeffersonBledsoe I think the idea is sound in general; the API is not providing enough information here. In terms of backwards-compatibility, I'd suggest following this path:
About the extra expansion of the Possible solutions:
|
Currently, if you anonymously get data from a field which points to an object which the requirements for an object with a PrimaryField (e.g. a block with a
urlfield which points to a dexterity file object), you are always given the@@downloadversion of the URL. This isn't always desirable as you may have content on the 'display' version of the view.This PR changes this view to expand into information about the primary field target so that the consumer of the REST API response (e.g. Volto) can make the decision on whether to open the content object or download it. Currently this is behind an environment variable to test the behaviour.
📚 Documentation preview 📚: https://plonerestapi--1903.org.readthedocs.build/