Skip to content

Linking changes - add previousCommit - prevent accidental overwrites #62

@joepio

Description

@joepio

Currently, there is no difference between a Commit that updates a resource and one that creates a new one. This can easily lead to accidental overwrites.

Approaches:

Adding initial prop to commits

I suggest we add an optional Property to Commits, initial, which must be set to true for initial commits. If this is true and the commit would overwrite an existing one, it should fail.

I've made the prop here, but have not added it to atomic server https://atomicdata.dev/properties/initial

Require linking to previous commit in non-initial props (preffered)

We could also explicitly mention the previousCommit in a Commit, and require that it matches the one in the Resource when we apply a Commit to an existing resource.
This seems even better, as this would serve as a check that the client has the correct version of a resource.
Also, it can be used in the future to deal with things like audit info (creator / edit date).
However, this does mean that the Client would need to find the previousCommit. How could they do this? We could do two things:

  • Create an Endpoint / use the /version endpoint to find the commit. This costs a roundtrip.
  • Include the lastCommit in the Resource. We could create this property when handling the Commit. (preffered)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions