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

JSON-HAL HATEOAS compliant refs #16

Open
Schiller-Stoff opened this issue Jan 29, 2020 · 3 comments
Open

JSON-HAL HATEOAS compliant refs #16

Schiller-Stoff opened this issue Jan 29, 2020 · 3 comments

Comments

@Schiller-Stoff
Copy link
Collaborator

My question is: Wouldn't it be better for an API-consumer to have JSON-HAL conform JSON-Response available?
Otherwise a consumre would have to implement API logic in the client code and could not rely on abstract REST-traversel features provided by HATEOAS using e.g. the Traverson library in Spring-Boot or in Javascript.

So instead of implicit knowledge on client side, each REST-Response (and so the server-side) would include the knowledge about how to traverse / use the API for further information, following the factoid model. E.g. instead of providing ids in the response, we could use full urls in an HAL-conform way to inform a consumer on how to further use rest-parameters / what further paths are etc.

HAL Spec:
http://stateless.co/hal_specification.html

Example of JSON-HAL:
image

@Schiller-Stoff
Copy link
Collaborator Author

#13 related?

@Schiller-Stoff
Copy link
Collaborator Author

@gvasold @GVogeler

@GVogeler
Copy link
Collaborator

sounds reasonable. So we would replate the refs section with something like the following?

{
    "_links": {
        "curies": [
            {
              "name": "api",
              "href": "/{rel}",
              "templated": true
            }
        ],
        "api:factoid-ref" : { "href": "/factoid/{@id}" , templated:True}
    }
}

I currently don't get, how the OpenAPI-datamodel description is combined with the HAL formalism: maybe OAI/OpenAPI-Specification#577 helps.

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