Repository: plone/plone.restapi (language: python)

Issue:
No way to determine whether next/ previous should be used from a content response
If `Enable next previous navigation` is unchecked or the `Next previous navigation` is disabled, the `next` and `previous` keys are still included in the response. This means that currently the only way to know whether the `Next/ Previous` should be used is to get the schema information for the content type and lookup the information there, but this requires a logged-in user.

## Proposed solutions

- A `Next/ previous enabled` key is added  to the content response which indicated whether the next/ previous should be used or not.

## Other options

- The 'Next' and 'Previous' keys are not included if the behaviours aren't enabled or the toggle behaviour is on but the toggle is unselected.
  - Unfavourable due to this being a breaking change in the response


Discussion / hints:
I'd suggest a variation on your "other option": if the behaviors aren't enabled or the toggle behavior is on but the toggle is disabled, then set `next_item` and `previous_item` to an empty object (`{}`). This is backwards compatible with the current implementation when there isn't a next/previous item or there's an error looking it up.

Fix patch:
diff --git a/news/1799.bugfix b/news/1799.bugfix
new file mode 100644
index 0000000000..171db7f10a
--- /dev/null
+++ b/news/1799.bugfix
@@ -0,0 +1,4 @@
+Fixed Dexterity content serializer:
+Return an empty object for `next_item` and `previous_item`
+unless the parent has next/previous support enabled.
+@JeffersonBledsoe, @davisagli
diff --git a/plone-6.0.x-python3.8.cfg b/plone-6.0.x-python3.8.cfg
index 9fca1a2f0e..2bd12daf3f 100644
--- a/plone-6.0.x-python3.8.cfg
+++ b/plone-6.0.x-python3.8.cfg
@@ -1,6 +1,6 @@
 [buildout]
 extends =
-    https://dist.plone.org/release/6.0.11.1/versions.cfg
+    https://dist.plone.org/release/6.0.12/versions.cfg
     base.cfg
 
 [instance]
diff --git a/plone-6.0.x.cfg b/plone-6.0.x.cfg
index 5172c9ddaf..26373fac81 100644
--- a/plone-6.0.x.cfg
+++ b/plone-6.0.x.cfg
@@ -1,6 +1,6 @@
 [buildout]
 extends =
-    https://dist.plone.org/release/6.0.11.1/versions.cfg
+    https://dist.plone.org/release/6.0.12/versions.cfg
     base.cfg
 
 [buildout:python37]
diff --git a/requirements-6.0.txt b/requirements-6.0.txt
index 2f870811b5..b654a46a97 100644
--- a/requirements-6.0.txt
+++ b/requirements-6.0.txt
@@ -1,1 +1,1 @@
--r https://dist.plone.org/release/6.0.11.1/requirements.txt
+-r https://dist.plone.org/release/6.0.12/requirements.txt
diff --git a/src/plone/restapi/serializer/nextprev.py b/src/plone/restapi/serializer/nextprev.py
index ffcd0e29fc..6d11ef3234 100644
--- a/src/plone/restapi/serializer/nextprev.py
+++ b/src/plone/restapi/serializer/nextprev.py
@@ -1,24 +1,9 @@
-from AccessControl import getSecurityManager
 from Acquisition import aq_inner
 from Acquisition import aq_parent
-from plone.app.dexterity.behaviors.nextprevious import NextPreviousBase
-from plone.registry.interfaces import IRegistry
+from plone.app.dexterity.behaviors.nextprevious import (
+    INextPreviousProvider,
+)
 from plone.restapi.serializer.utils import get_portal_type_title
-from zope.component import getUtility
-
-
-class NextPreviousFixed(NextPreviousBase):
-    """
-    Based on plone.app.dexterity.behaviors.nextprevious.NextPreviousBase
-    but works for IPloneSite object
-    """
-
-    def __init__(self, context):
-        self.context = context
-        registry = getUtility(IRegistry)
-        self.vat = registry.get("plone.types_use_view_action_in_listings", [])
-        self.security = getSecurityManager()
-        self.order = self.context.objectIds()
 
 
 class NextPrevious:
@@ -27,11 +12,14 @@ class NextPrevious:
     def __init__(self, context):
         self.context = context
         self.parent = aq_parent(aq_inner(context))
-        self.nextprev = NextPreviousFixed(self.parent)
+        self.nextprev = INextPreviousProvider(self.parent, None)
+        self.enabled = self.nextprev is not None and self.nextprev.enabled
 
     @property
     def next(self):
         """return info about the next item in the container"""
+        if not self.enabled:
+            return {}
         if getattr(self.parent, "_ordering", "") == "unordered":
             # Unordered folder
             return {}
@@ -49,6 +37,8 @@ def next(self):
     @property
     def previous(self):
         """return info about the previous item in the container"""
+        if not self.enabled:
+            return {}
         if getattr(self.parent, "_ordering", "") == "unordered":
             # Unordered folder
             return {}


Test patch:
diff --git a/src/plone/restapi/tests/http-examples/collection.resp b/src/plone/restapi/tests/http-examples/collection.resp
index 036a0bfd27..5a839d3004 100644
--- a/src/plone/restapi/tests/http-examples/collection.resp
+++ b/src/plone/restapi/tests/http-examples/collection.resp
@@ -97,13 +97,7 @@ Content-Type: application/json
         "stealable": true
     },
     "modified": "1995-07-31T17:30:00+00:00",
-    "next_item": {
-        "@id": "http://localhost:55001/plone/doc1",
-        "@type": "Document",
-        "description": "",
-        "title": "Document 1",
-        "type_title": "Page"
-    },
+    "next_item": {},
     "parent": {
         "@id": "http://localhost:55001/plone",
         "@type": "Plone Site",
@@ -111,13 +105,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/front-page",
-        "@type": "Document",
-        "description": "Congratulations! You have successfully installed Plone.",
-        "title": "Welcome to Plone",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "query": [
         {
             "i": "portal_type",
diff --git a/src/plone/restapi/tests/http-examples/collection_fullobjects.resp b/src/plone/restapi/tests/http-examples/collection_fullobjects.resp
index 04b573bff3..3836845d88 100644
--- a/src/plone/restapi/tests/http-examples/collection_fullobjects.resp
+++ b/src/plone/restapi/tests/http-examples/collection_fullobjects.resp
@@ -113,13 +113,7 @@ Content-Type: application/json
                 "stealable": true
             },
             "modified": "1995-07-31T17:30:00+00:00",
-            "next_item": {
-                "@id": "http://localhost:55001/plone/collection",
-                "@type": "Collection",
-                "description": "This is a collection with two documents",
-                "title": "My Collection",
-                "type_title": "Collection"
-            },
+            "next_item": {},
             "parent": {
                 "@id": "http://localhost:55001/plone",
                 "@type": "Plone Site",
@@ -195,13 +189,7 @@ Content-Type: application/json
                 "stealable": true
             },
             "modified": "1995-07-31T17:30:00+00:00",
-            "next_item": {
-                "@id": "http://localhost:55001/plone/doc2",
-                "@type": "Document",
-                "description": "",
-                "title": "Document 2",
-                "type_title": "Page"
-            },
+            "next_item": {},
             "parent": {
                 "@id": "http://localhost:55001/plone",
                 "@type": "Plone Site",
@@ -209,13 +197,7 @@ Content-Type: application/json
                 "title": "Plone site",
                 "type_title": "Plone Site"
             },
-            "previous_item": {
-                "@id": "http://localhost:55001/plone/collection",
-                "@type": "Collection",
-                "description": "This is a collection with two documents",
-                "title": "My Collection",
-                "type_title": "Collection"
-            },
+            "previous_item": {},
             "relatedItems": [],
             "review_state": "private",
             "rights": "",
@@ -287,13 +269,7 @@ Content-Type: application/json
                 "title": "Plone site",
                 "type_title": "Plone Site"
             },
-            "previous_item": {
-                "@id": "http://localhost:55001/plone/doc1",
-                "@type": "Document",
-                "description": "",
-                "title": "Document 1",
-                "type_title": "Page"
-            },
+            "previous_item": {},
             "relatedItems": [],
             "review_state": "private",
             "rights": "",
@@ -317,13 +293,7 @@ Content-Type: application/json
         "stealable": true
     },
     "modified": "1995-07-31T17:30:00+00:00",
-    "next_item": {
-        "@id": "http://localhost:55001/plone/doc1",
-        "@type": "Document",
-        "description": "",
-        "title": "Document 1",
-        "type_title": "Page"
-    },
+    "next_item": {},
     "parent": {
         "@id": "http://localhost:55001/plone",
         "@type": "Plone Site",
@@ -331,13 +301,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/front-page",
-        "@type": "Document",
-        "description": "Congratulations! You have successfully installed Plone.",
-        "title": "Welcome to Plone",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "query": [
         {
             "i": "portal_type",
diff --git a/src/plone/restapi/tests/http-examples/content_get.resp b/src/plone/restapi/tests/http-examples/content_get.resp
index 9d876dccf3..ad574ee2ff 100644
--- a/src/plone/restapi/tests/http-examples/content_get.resp
+++ b/src/plone/restapi/tests/http-examples/content_get.resp
@@ -60,13 +60,7 @@ Content-Type: application/json
         "title": "My Folder",
         "type_title": "Folder"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/folder/doc2",
-        "@type": "Document",
-        "description": "",
-        "title": "A document within a folder",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/content_get_folder.resp b/src/plone/restapi/tests/http-examples/content_get_folder.resp
index c7e9f35e75..7c2915f480 100644
--- a/src/plone/restapi/tests/http-examples/content_get_folder.resp
+++ b/src/plone/restapi/tests/http-examples/content_get_folder.resp
@@ -89,13 +89,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/front-page",
-        "@type": "Document",
-        "description": "Congratulations! You have successfully installed Plone.",
-        "title": "Welcome to Plone",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/content_patch_representation.resp b/src/plone/restapi/tests/http-examples/content_patch_representation.resp
index 0003cae47f..bbc788a945 100644
--- a/src/plone/restapi/tests/http-examples/content_patch_representation.resp
+++ b/src/plone/restapi/tests/http-examples/content_patch_representation.resp
@@ -60,13 +60,7 @@ Content-Type: application/json
         "title": "My Folder",
         "type_title": "Folder"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/folder/doc2",
-        "@type": "Document",
-        "description": "",
-        "title": "A document within a folder",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/content_post.resp b/src/plone/restapi/tests/http-examples/content_post.resp
index 9cd542a495..99c1f3c4b6 100644
--- a/src/plone/restapi/tests/http-examples/content_post.resp
+++ b/src/plone/restapi/tests/http-examples/content_post.resp
@@ -61,13 +61,7 @@ Location: http://localhost:55001/plone/folder/my-document
         "title": "My Folder",
         "type_title": "Folder"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/folder/doc2",
-        "@type": "Document",
-        "description": "",
-        "title": "A document within a folder",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/event.resp b/src/plone/restapi/tests/http-examples/event.resp
index 2591e61803..7cf0051a36 100644
--- a/src/plone/restapi/tests/http-examples/event.resp
+++ b/src/plone/restapi/tests/http-examples/event.resp
@@ -67,13 +67,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/front-page",
-        "@type": "Document",
-        "description": "Congratulations! You have successfully installed Plone.",
-        "title": "Welcome to Plone",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "recurrence": null,
     "relatedItems": [],
     "review_state": "private",
diff --git a/src/plone/restapi/tests/http-examples/file.resp b/src/plone/restapi/tests/http-examples/file.resp
index 4b463c60fc..1f2f7ad123 100644
--- a/src/plone/restapi/tests/http-examples/file.resp
+++ b/src/plone/restapi/tests/http-examples/file.resp
@@ -61,13 +61,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/front-page",
-        "@type": "Document",
-        "description": "Congratulations! You have successfully installed Plone.",
-        "title": "Welcome to Plone",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": null,
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/folder.resp b/src/plone/restapi/tests/http-examples/folder.resp
index 7a41f8227d..ad3dd229be 100644
--- a/src/plone/restapi/tests/http-examples/folder.resp
+++ b/src/plone/restapi/tests/http-examples/folder.resp
@@ -75,13 +75,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/front-page",
-        "@type": "Document",
-        "description": "Congratulations! You have successfully installed Plone.",
-        "title": "Welcome to Plone",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/image.resp b/src/plone/restapi/tests/http-examples/image.resp
index c2e13cbd1e..e459b587ce 100644
--- a/src/plone/restapi/tests/http-examples/image.resp
+++ b/src/plone/restapi/tests/http-examples/image.resp
@@ -120,13 +120,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/front-page",
-        "@type": "Document",
-        "description": "Congratulations! You have successfully installed Plone.",
-        "title": "Welcome to Plone",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": null,
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/link.resp b/src/plone/restapi/tests/http-examples/link.resp
index 76d990359a..64ac54490b 100644
--- a/src/plone/restapi/tests/http-examples/link.resp
+++ b/src/plone/restapi/tests/http-examples/link.resp
@@ -56,13 +56,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/front-page",
-        "@type": "Document",
-        "description": "Congratulations! You have successfully installed Plone.",
-        "title": "Welcome to Plone",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "remoteUrl": "http://localhost:55001/plone",
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/navroot_lang_content_get.resp b/src/plone/restapi/tests/http-examples/navroot_lang_content_get.resp
index d537815afe..cfbf9e1cfd 100644
--- a/src/plone/restapi/tests/http-examples/navroot_lang_content_get.resp
+++ b/src/plone/restapi/tests/http-examples/navroot_lang_content_get.resp
@@ -74,13 +74,7 @@ Content-Type: application/json
         "layout": "folder_listing",
         "lock": {},
         "modified": "1995-07-31T17:30:00+00:00",
-        "next_item": {
-            "@id": "http://localhost:55001/plone/de",
-            "@type": "LRF",
-            "description": "",
-            "title": "Deutsch",
-            "type_title": "Language Root Folder"
-        },
+        "next_item": {},
         "parent": {
             "@id": "http://localhost:55001/plone",
             "@type": "Plone Site",
diff --git a/src/plone/restapi/tests/http-examples/navroot_lang_folder_get.resp b/src/plone/restapi/tests/http-examples/navroot_lang_folder_get.resp
index 801625f6d7..3932a805ee 100644
--- a/src/plone/restapi/tests/http-examples/navroot_lang_folder_get.resp
+++ b/src/plone/restapi/tests/http-examples/navroot_lang_folder_get.resp
@@ -74,13 +74,7 @@ Content-Type: application/json
         "layout": "folder_listing",
         "lock": {},
         "modified": "1995-07-31T17:30:00+00:00",
-        "next_item": {
-            "@id": "http://localhost:55001/plone/de",
-            "@type": "LRF",
-            "description": "",
-            "title": "Deutsch",
-            "type_title": "Language Root Folder"
-        },
+        "next_item": {},
         "parent": {
             "@id": "http://localhost:55001/plone",
             "@type": "Plone Site",
diff --git a/src/plone/restapi/tests/http-examples/newsitem.resp b/src/plone/restapi/tests/http-examples/newsitem.resp
index e1dab847dd..cab5656caf 100644
--- a/src/plone/restapi/tests/http-examples/newsitem.resp
+++ b/src/plone/restapi/tests/http-examples/newsitem.resp
@@ -125,13 +125,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/front-page",
-        "@type": "Document",
-        "description": "Congratulations! You have successfully installed Plone.",
-        "title": "Welcome to Plone",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/search_fullobjects.resp b/src/plone/restapi/tests/http-examples/search_fullobjects.resp
index 5c9fe7ebf3..e745671059 100644
--- a/src/plone/restapi/tests/http-examples/search_fullobjects.resp
+++ b/src/plone/restapi/tests/http-examples/search_fullobjects.resp
@@ -62,13 +62,7 @@ Content-Type: application/json
                 "title": "Plone site",
                 "type_title": "Plone Site"
             },
-            "previous_item": {
-                "@id": "http://localhost:55001/plone/front-page",
-                "@type": "Document",
-                "description": "Congratulations! You have successfully installed Plone.",
-                "title": "Welcome to Plone",
-                "type_title": "Page"
-            },
+            "previous_item": {},
             "relatedItems": [],
             "review_state": "private",
             "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/site_get_expand_lang_folder.resp b/src/plone/restapi/tests/http-examples/site_get_expand_lang_folder.resp
index 4d636bc252..705960ddec 100644
--- a/src/plone/restapi/tests/http-examples/site_get_expand_lang_folder.resp
+++ b/src/plone/restapi/tests/http-examples/site_get_expand_lang_folder.resp
@@ -91,13 +91,7 @@ Content-Type: application/json
                 "layout": "folder_listing",
                 "lock": {},
                 "modified": "1995-07-31T17:30:00+00:00",
-                "next_item": {
-                    "@id": "http://localhost:55001/plone/de",
-                    "@type": "LRF",
-                    "description": "",
-                    "title": "Deutsch",
-                    "type_title": "Language Root Folder"
-                },
+                "next_item": {},
                 "parent": {
                     "@id": "http://localhost:55001/plone",
                     "@type": "Plone Site",
@@ -167,13 +161,7 @@ Content-Type: application/json
     "layout": "folder_listing",
     "lock": {},
     "modified": "1995-07-31T17:30:00+00:00",
-    "next_item": {
-        "@id": "http://localhost:55001/plone/de",
-        "@type": "LRF",
-        "description": "",
-        "title": "Deutsch",
-        "type_title": "Language Root Folder"
-    },
+    "next_item": {},
     "parent": {
         "@id": "http://localhost:55001/plone",
         "@type": "Plone Site",
diff --git a/src/plone/restapi/tests/http-examples/site_get_expand_lang_folder_content.resp b/src/plone/restapi/tests/http-examples/site_get_expand_lang_folder_content.resp
index 9d40582315..443f2014bd 100644
--- a/src/plone/restapi/tests/http-examples/site_get_expand_lang_folder_content.resp
+++ b/src/plone/restapi/tests/http-examples/site_get_expand_lang_folder_content.resp
@@ -91,13 +91,7 @@ Content-Type: application/json
                 "layout": "folder_listing",
                 "lock": {},
                 "modified": "1995-07-31T17:30:00+00:00",
-                "next_item": {
-                    "@id": "http://localhost:55001/plone/de",
-                    "@type": "LRF",
-                    "description": "",
-                    "title": "Deutsch",
-                    "type_title": "Language Root Folder"
-                },
+                "next_item": {},
                 "parent": {
                     "@id": "http://localhost:55001/plone",
                     "@type": "Plone Site",
@@ -161,13 +155,7 @@ Content-Type: application/json
         "title": "English",
         "type_title": "Language Root Folder"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/en/assets",
-        "@type": "LIF",
-        "description": "",
-        "title": "Assets",
-        "type_title": "Language Independent Folder"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/translated_messages_types_folder.resp b/src/plone/restapi/tests/http-examples/translated_messages_types_folder.resp
index 3bdf1d0094..ab0702c569 100644
--- a/src/plone/restapi/tests/http-examples/translated_messages_types_folder.resp
+++ b/src/plone/restapi/tests/http-examples/translated_messages_types_folder.resp
@@ -59,11 +59,11 @@ Content-Type: application/json+schema
     ],
     "layouts": [
         "album_view",
+        "event_listing",
         "full_view",
         "listing_view",
         "summary_view",
-        "tabular_view",
-        "event_listing"
+        "tabular_view"
     ],
     "properties": {
         "allow_discussion": {
diff --git a/src/plone/restapi/tests/http-examples/translations_expand_get.resp b/src/plone/restapi/tests/http-examples/translations_expand_get.resp
index 010dce733e..fc5e677b12 100644
--- a/src/plone/restapi/tests/http-examples/translations_expand_get.resp
+++ b/src/plone/restapi/tests/http-examples/translations_expand_get.resp
@@ -78,13 +78,7 @@ Content-Type: application/json
         "title": "English",
         "type_title": "Language Root Folder"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/en/assets",
-        "@type": "LIF",
-        "description": "",
-        "title": "Assets",
-        "type_title": "Language Independent Folder"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/translations_link_on_post.resp b/src/plone/restapi/tests/http-examples/translations_link_on_post.resp
index 798d352197..699d57eddd 100644
--- a/src/plone/restapi/tests/http-examples/translations_link_on_post.resp
+++ b/src/plone/restapi/tests/http-examples/translations_link_on_post.resp
@@ -67,13 +67,7 @@ Location: http://localhost:55001/plone/de/mydocument
         "title": "Deutsch",
         "type_title": "Basisordner einer Sprache"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/de/assets",
-        "@type": "LIF",
-        "description": "",
-        "title": "Assets",
-        "type_title": "Sprachunabh\u00e4ngiger Ordner"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/translations_unexpanded_get.resp b/src/plone/restapi/tests/http-examples/translations_unexpanded_get.resp
index 7b0e674242..f266e4dc17 100644
--- a/src/plone/restapi/tests/http-examples/translations_unexpanded_get.resp
+++ b/src/plone/restapi/tests/http-examples/translations_unexpanded_get.resp
@@ -66,13 +66,7 @@ Content-Type: application/json
         "title": "English",
         "type_title": "Language Root Folder"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/en/assets",
-        "@type": "LIF",
-        "description": "",
-        "title": "Assets",
-        "type_title": "Language Independent Folder"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/http-examples/workingcopy_baseline_get.resp b/src/plone/restapi/tests/http-examples/workingcopy_baseline_get.resp
index 32a97febf7..aea5b625dd 100644
--- a/src/plone/restapi/tests/http-examples/workingcopy_baseline_get.resp
+++ b/src/plone/restapi/tests/http-examples/workingcopy_baseline_get.resp
@@ -58,13 +58,7 @@ Content-Type: application/json
         "token": "0.12345678901234567-0.98765432109876543-00105A989226:1630609830.249"
     },
     "modified": "1995-07-31T17:30:00+00:00",
-    "next_item": {
-        "@id": "http://localhost:55001/plone/copy_of_document",
-        "@type": "Document",
-        "description": "",
-        "title": "Test document",
-        "type_title": "Page"
-    },
+    "next_item": {},
     "parent": {
         "@id": "http://localhost:55001/plone",
         "@type": "Plone Site",
diff --git a/src/plone/restapi/tests/http-examples/workingcopy_wc_get.resp b/src/plone/restapi/tests/http-examples/workingcopy_wc_get.resp
index 08598e4e28..2db8771432 100644
--- a/src/plone/restapi/tests/http-examples/workingcopy_wc_get.resp
+++ b/src/plone/restapi/tests/http-examples/workingcopy_wc_get.resp
@@ -58,13 +58,7 @@ Content-Type: application/json
         "title": "Plone site",
         "type_title": "Plone Site"
     },
-    "previous_item": {
-        "@id": "http://localhost:55001/plone/document",
-        "@type": "Document",
-        "description": "",
-        "title": "Test document",
-        "type_title": "Page"
-    },
+    "previous_item": {},
     "relatedItems": [],
     "review_state": "private",
     "rights": "",
diff --git a/src/plone/restapi/tests/test_dxcontent_serializer.py b/src/plone/restapi/tests/test_dxcontent_serializer.py
index 18d41cb953..789cf865fa 100644
--- a/src/plone/restapi/tests/test_dxcontent_serializer.py
+++ b/src/plone/restapi/tests/test_dxcontent_serializer.py
@@ -11,6 +11,8 @@
 from plone.app.testing import TEST_USER_ID
 from plone.app.textfield.interfaces import ITransformer
 from plone.app.textfield.value import RichTextValue
+from plone.dexterity.interfaces import IDexterityFTI
+from plone.dexterity.schema import SCHEMA_CACHE
 from plone.namedfile.file import NamedFile
 from plone.registry.interfaces import IRegistry
 from plone.restapi.interfaces import IExpandableElement
@@ -31,6 +33,9 @@
 import json
 import unittest
 
+HAS_PLONE_6 = getattr(
+    import_module("Products.CMFPlone.factory"), "PLONE60MARKER", False
+)
 HAS_PLONE_61 = getattr(
     import_module("Products.CMFPlone.factory"), "PLONE61MARKER", False
 )
@@ -200,12 +205,42 @@ def test_get_is_folderish_in_folder(self):
         self.assertIn("is_folderish", obj)
         self.assertEqual(True, obj["is_folderish"])
 
+    def test_enable_disable_nextprev(self):
+        folder = api.content.create(
+            container=self.portal,
+            type="Folder",
+            title="Folder with items",
+            description="This is a folder with some documents",
+            nextPreviousEnabled=False,
+        )
+        api.content.create(
+            container=folder,
+            type="Document",
+            title="Item 1",
+            description="Previous item",
+        )
+        doc = api.content.create(
+            container=folder,
+            type="Document",
+            title="Item 2",
+            description="Current item",
+        )
+        api.content.create(
+            container=folder, type="Document", title="Item 2", description="Next item"
+        )
+
+        data = self.serialize(doc)
+
+        self.assertEqual({}, data["previous_item"])
+        self.assertEqual({}, data["next_item"])
+
     def test_nextprev_no_nextprev(self):
         folder = api.content.create(
             container=self.portal,
             type="Folder",
             title="Folder with items",
             description="This is a folder with some documents",
+            nextPreviousEnabled=True,
         )
         doc = api.content.create(
             container=folder,
@@ -223,6 +258,7 @@ def test_nextprev_has_prev(self):
             type="Folder",
             title="Folder with items",
             description="This is a folder with some documents",
+            nextPreviousEnabled=True,
         )
         api.content.create(
             container=folder,
@@ -255,6 +291,7 @@ def test_nextprev_has_next(self):
             type="Folder",
             title="Folder with items",
             description="This is a folder with some documents",
+            nextPreviousEnabled=True,
         )
         doc = api.content.create(
             container=folder,
@@ -284,6 +321,7 @@ def test_nextprev_has_nextprev(self):
             type="Folder",
             title="Folder with items",
             description="This is a folder with some documents",
+            nextPreviousEnabled=True,
         )
         api.content.create(
             container=folder,
@@ -327,7 +365,16 @@ def test_nextprev_root_no_nextprev(self):
         self.assertEqual({}, data["previous_item"])
         self.assertEqual({}, data["next_item"])
 
+    @unittest.skipUnless(HAS_PLONE_6, "Requires Dexterity-based site root")
     def test_nextprev_root_has_prev(self):
+        fti = queryUtility(IDexterityFTI, name="Plone Site")
+        behavior_list = [a for a in fti.behaviors]
+        behavior_list.append("plone.nextpreviousenabled")
+        fti.behaviors = tuple(behavior_list)
+        # Invalidating the cache is required for the FTI to be applied
+        # on the existing object
+        SCHEMA_CACHE.invalidate("Plone Site")
+
         doc = api.content.create(
             container=self.portal,
             type="Document",
@@ -347,7 +394,16 @@ def test_nextprev_root_has_prev(self):
         )
         self.assertEqual({}, data["next_item"])
 
+    @unittest.skipUnless(HAS_PLONE_6, "Requires Dexterity-based site root")
     def test_nextprev_root_has_next(self):
+        fti = queryUtility(IDexterityFTI, name="Plone Site")
+        behavior_list = [a for a in fti.behaviors]
+        behavior_list.append("plone.nextpreviousenabled")
+        fti.behaviors = tuple(behavior_list)
+        # Invalidating the cache is required for the FTI to be applied
+        # on the existing object
+        SCHEMA_CACHE.invalidate("Plone Site")
+
         api.content.create(
             container=self.portal,
             type="Document",
@@ -367,7 +423,16 @@ def test_nextprev_root_has_next(self):
             data["next_item"],
         )
 
+    @unittest.skipUnless(HAS_PLONE_6, "Requires Dexterity-based site root")
     def test_nextprev_root_has_nextprev(self):
+        fti = queryUtility(IDexterityFTI, name="Plone Site")
+        behavior_list = [a for a in fti.behaviors]
+        behavior_list.append("plone.nextpreviousenabled")
+        fti.behaviors = tuple(behavior_list)
+        # Invalidating the cache is required for the FTI to be applied
+        # on the existing object
+        SCHEMA_CACHE.invalidate("Plone Site")
+
         api.content.create(
             container=self.portal,
             type="Document",
@@ -414,6 +479,7 @@ def test_nextprev_unordered_folder(self):
             type="Folder",
             title="Folder with items",
             description="This is a folder with some documents",
+            nextPreviousEnabled=True,
         )
         folder.setOrdering("unordered")
         doc = api.content.create(