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

Clarification that the self link is the default target for templates #84

Open
odrotbohm opened this issue Oct 12, 2021 · 2 comments
Open

Comments

@odrotbohm
Copy link

This ticket in Spring HATEOAS makes obvious that the spec is currently not entirely clear which URI is to be assumed the default target for all state transitions described using templates.

The description of target mentions that the value should be ignored if missing or invalid. However, it doesn't mention that it's the self link's value that should be used as target. Neither the description of the _links element not the section of the _template section explicitly state that either.

@mamund
Copy link
Owner

mamund commented Oct 13, 2021

@odrotbohm

so, is this just a case where the docs need to reflect reality? or is there a proposed change in behavior here?

I'm happy to entertain a proposal that fixes this.

@odrotbohm
Copy link
Author

No change in behavior, I assume. This came up in a ticket in which we discussed whether extra links would need to be added to the HAL part of the HAL FORMS document to connect a named template to a request destination. I would've liked to point to the spec to claim, that unless target is defined, the state transition is supposed to be triggered on the self link, but unfortunately no section of the spec actually explicitly states that.

Unless I misunderstood and what I assume isn't the actual intent of the spec, I suggest changing:

This is an OPTIONAL property. If this property is not understood by the recipient, left blank, or contains an invalid URL string, it SHOULD be ignored.

in the section on the target attribute to:

… it SHOULD be ignored. In that case, the target URL for requests to be submitted is the href attribute of the self link contained in the _links collection.

The very latter probably deserves a link to the corresponding section (_links). Within that, it's declared that a self SHOULD be present but there's no description of what should happen if we neither find a self link nor a target attribute for a template. I'd personally fine with considering the form invalid then or recommend the client to ignore it entirely.

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

2 participants