Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks
kjac opened this issue Jun 25, 2024 · 0 comments
Open
2 tasks

Comments

@kjac
Copy link

kjac commented Jun 25, 2024

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

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.

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 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants