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

When PATCHing a Thing, it should also be possible to implicitly convert to "Create Thing" if thing is not yet existing #1614

Closed
thjaeckle opened this issue Apr 13, 2023 · 0 comments · Fixed by #1616
Assignees
Milestone

Comments

@thjaeckle
Copy link
Member

The RFC for HTTP PATCH states that:

If the Request-URI does not
point to an existing resource, the server MAY create a new resource,
depending on the patch document type (whether it can logically modify
a null resource) and permissions, etc.

So it would also make sense to create a Thing when e.g. doing a PATCH /api/2/things/<thingId> when this thing is not yet existing.
Using If-Match: * header it still would be possible to only update already existing things.

This would of course only make sense when "patching" a complete thing, so on path /.

The already existing ModifyToCreateThingTransformer could be enhanced to also handle MergeThing commands and transform to CreateThing if the thing is not yet existing.

@thjaeckle thjaeckle added this to the 3.3.0 milestone Apr 13, 2023
@thjaeckle thjaeckle self-assigned this Apr 13, 2023
@thjaeckle thjaeckle changed the title When sending a MergeThing command, it should also be possible to implicitly convert to "Create Thing" if thing is not yet existing When PATCHing a Thing, it should also be possible to implicitly convert to "Create Thing" if thing is not yet existing Apr 13, 2023
thjaeckle added a commit that referenced this issue Apr 14, 2023
…t exist

* enhanced ModifyToCreateThingTransformer to also handle "MergeThing" in addition to "ModifyThing"
* adjusted ThingsRoute to also support using "_policy" and "_copyPolicyFrom"

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit that referenced this issue Apr 24, 2023
…ommand"

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit that referenced this issue Apr 24, 2023
…ommand"

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit that referenced this issue May 15, 2023
…-thing

#1614 enabled creating a thing for a "MergeThing" when it does not yet exist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant