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

hal collection links should have a href property #1775

Merged
merged 4 commits into from
Mar 15, 2018
Merged

hal collection links should have a href property #1775

merged 4 commits into from
Mar 15, 2018

Conversation

bendavies
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no?
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

It seems to me that json hal links for collections where missing the href property:
https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.1

@bendavies bendavies changed the base branch from master to 2.2 March 14, 2018 17:08
@dunglas
Copy link
Member

dunglas commented Mar 14, 2018

Good catch.

We should also validate the produced HAL output using http://hyperschema.org/mediatypes/hal. As we do for Swagger and JSONAPI.

@bendavies
Copy link
Contributor Author

@dunglas happy to take a look. can you point me towards what is done currently for swagger and jsonapi?

@soyuka
Copy link
Member

soyuka commented Mar 15, 2018

@dunglas happy to take a look. can you point me towards what is done currently for swagger and jsonapi?

  1. https://github.com/api-platform/core/blob/master/.travis.yml#L43 we install swagger-cli
  2. https://github.com/api-platform/core/blob/master/.travis.yml#L56 we launch a swagger-validate command on an extracted JSON file that comes from a symfony command that you can find here

@bendavies
Copy link
Contributor Author

@dunglas i think I've done what you wanted. Additionally, schema validation was completely broken (not validating at all) in the jsonapi features/context, so I've fixed that.

Copy link
Member

@dunglas dunglas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome

@meyerbaptiste
Copy link
Member

meyerbaptiste commented Mar 15, 2018

This makes me think that it might be nice to have a script to update our JSON Schema files from:

Copy link
Member

@meyerbaptiste meyerbaptiste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

"item": [
{
"href": "/dummies/2"
And the JSON should be valid according to the JSON HAL schema
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh

@dunglas dunglas merged commit c2e5b77 into api-platform:2.2 Mar 15, 2018
@dunglas
Copy link
Member

dunglas commented Mar 15, 2018

Thank you very much @bendavies!

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

Successfully merging this pull request may close these issues.

None yet

4 participants