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

Micropub Update Clarification #8

Open
hacdias opened this issue Nov 5, 2021 · 0 comments
Open

Micropub Update Clarification #8

hacdias opened this issue Nov 5, 2021 · 0 comments

Comments

@hacdias
Copy link

hacdias commented Nov 5, 2021

I am creating a new Micropub endpoint for my website and I read the specification. However, while testing the update action, something unexpected happened. The specification is not quite clear to whether we should deeply-traverse the update and update field by field, or solely replace the top-level keys.

Take into account the following post (taken from the specification):

{
  "type": ["h-entry"],
  "properties": {
    "summary": [
      "Weighed 70.64 kg"
    ],
    "weight": [
      {
        "type": ["h-measure"],
        "properties": {
          "num": ["70.64"],
          "unit": ["kg"]
        }
      }
    ]
  }
}

What happens with the following update request?

{
  "action": "update",
  "url": "https://example.com/weight",
  "replace": {
    "weight": [
      {
        "properties": {
          "unit": ["lbs"]
        }
      }
    ]
  }
}

Should the Micropub endpoint recursively traverse the fields and check if they exist and if so, update it? Or should it simply replace the top level weight field?

I am asking this because I was testing with a checkin locally, and I used OwnYourSwarm which provides a lot of detailed fields. Then, I used micropublish to update that post, and most of the fields of the checkin were gone because I was simply replacing the top-level fields.

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

No branches or pull requests

1 participant