umbraco / Announcements

Subscribe to this repo to be notified about major changes in Umbraco-CMS, Deploy and Forms
MIT License
21 stars 0 forks source link

[Breaking change]: V14 webhooks changes casing in payload serialization #17

Open kjac opened 3 months ago

kjac commented 3 months ago

Description

V14 performs a system wide replacement of Newtonsoft.Json with System.Text.Json (see #9). This has inadvertedly resulted in a change of casing for the payload serialization in the Umbraco webhooks, which now uses camelCase instead of PascalCase.

Version

Umbraco 14

Previous behavior

In versions 12 and 13, the webhooks would have a PascalCased payload, except from the Properties collection, where the individual content properties are contained by their actual alias (which is usually camelCased).

For example, the payload of a "content published" webhook could look like this:

{
    "Name": "Home",
    "CreateDate": "2024-06-25T08:59:15.4140973",
    "UpdateDate": "2024-06-25T09:05:39.3958439",
    "Route": {
        "Path": "/",
        "StartItem": {
            "Id": "ca4249ed-2b23-4337-b522-63cabe5587d1",
            "Path": "home"
        }
    },
    "Id": "ca4249ed-2b23-4337-b522-63cabe5587d1",
    "ContentType": "home",
    "Properties": {
        "heroHeader": "Umbraco Demo",
        "heroDescription": "Moonfish, steelhead, ...",
        "heroCTACaption": "Check our products"
    }
}

...and a "content deleted" webhook could have a payload like this:

{
    "Id": "ca4249ed-2b23-4337-b522-63cabe5587d1"
}

New behavior

In version 14, all JSON is camelCased by default. This means the webhook payload casing changes accordingly.

For example, the payload of a "content published" webhook will now look like this:

{
    "contentType": "home",
    "name": "Home",
    "createDate": "2024-06-06T11:41:29.8603216",
    "updateDate": "2024-06-25T08:53:08.8839169",
    "route": {
        "path": "/",
        "startItem": {
            "id": "ca4249ed-2b23-4337-b522-63cabe5587d1",
            "path": "home"
        }
    },
    "id": "ca4249ed-2b23-4337-b522-63cabe5587d1",
    "properties": {
        "heroHeader": "Umbraco Demo",
        "heroDescription": "Moonfish, steelhead, ...",
        "heroCTACaption": "Check our products"
    }
}

...and a "content deleted" webhook will have a payload like this:

{
    "id": "ca4249ed-2b23-4337-b522-63cabe5587d1"
}

Type of breaking change

Reason for change

This change is primarily driven by the need to replace Newtonsoft.Json with System.Text.Json.

Secondarily, the change in default serialization casing scheme ensures that Umbraco follows widely adopted casing standards by default.

Recommended action

Any webhook consumers that are case sensitive needs updating to follow the new casing scheme.

Affected APIs

Webhooks 😄