plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

Adds @id to @content-rules endpoint and makes it consistent with other endpoints

Open irtisamsajin opened this issue 8 months ago • 4 comments

Fixes #1901 I have added the @id field to the response. Also made changes to the response so that the response is now consistent with other endpoints

Old response


HTTP/1.1 200 OK
Content-Type: application/json

{
    "content-rules": {
        "acquired_rules": [],
        "assignable_rules": [],
        "assigned_rules": [
            {
                "bubbles": true,
                "description": "First rule added in the testing setup",
                "enabled": true,
                "global_enabled": true,
                "id": "rule-1",
                "title": "First test rule",
                "trigger": "Comment added",
                "url": "http://localhost:55001/plone/++rule++rule-1/@@manage-elements"
            },
            {
                "bubbles": true,
                "description": "Second rule added in the testing setup",
                "enabled": true,
                "global_enabled": true,
                "id": "rule-2",
                "title": "Second test rule",
                "trigger": "Comment added",
                "url": "http://localhost:55001/plone/++rule++rule-2/@@manage-elements"
            }
        ]
    }
}

New Response:


HTTP/1.1 200 OK
Content-Type: application/json

{
    "@id": "http://localhost:55001/plone/@content-rules",
    "acquired_rules": [],
    "assignable_rules": [],
    "assigned_rules": [
        {
            "bubbles": true,
            "description": "First rule added in the testing setup",
            "enabled": true,
            "global_enabled": true,
            "id": "rule-1",
            "title": "First test rule",
            "trigger": "Comment added",
            "url": "http://localhost:55001/plone/++rule++rule-1/@@manage-elements"
        },
        {
            "bubbles": true,
            "description": "Second rule added in the testing setup",
            "enabled": true,
            "global_enabled": true,
            "id": "rule-2",
            "title": "Second test rule",
            "trigger": "Comment added",
            "url": "http://localhost:55001/plone/++rule++rule-2/@@manage-elements"
        }
    ]
}

📚 Documentation preview 📚: https://plonerestapi--1905.org.readthedocs.build/

irtisamsajin avatar Apr 07 '25 13:04 irtisamsajin

@irtisamsajin thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

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!

mister-roboto avatar Apr 07 '25 13:04 mister-roboto

@jenkins-plone-org please run jobs

irtisamsajin avatar Apr 07 '25 13:04 irtisamsajin

@davisagli Can you review this

irtisamsajin avatar Apr 07 '25 17:04 irtisamsajin

@irtisamsajin I will consider this in the future when we are ready to make a release with breaking changes. It is not something that we can include in plone.restapi 9. The issue was a reminder for work in the future, not something that should happen now.

davisagli avatar Apr 07 '25 17:04 davisagli