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

Fixed invalid resource id #68

Merged

Conversation

piotrbelina
Copy link
Contributor

Hello everyone,

I submit a small for an error I found.

When an user submits a request with an ID which is not string, he receives PHP type error instead of exception.

For example

PATCH /api/v1/sometypes/1 HTTP/1.1
Content-Type: application/json

{
  "data": {
    "type": "sometypes",
    "id": 1,
    "attributes": {
      "foo": "bar"
    }
  }
}

Actual error:

Type error: Argument 1 passed to WoohooLabs\Yin\JsonApi\Exception\ResourceIdInvalid::__construct() must be of the type string, integer given

Expected exception:

WoohooLabs\Yin\JsonApi\Exception\ResourceIdInvalid: The resource ID '1' must be a string!

Best regards,
Piotr Belina

@kocsismate
Copy link
Member

Hey Piotr,

This is an awesome fix :) Probably I was too eager to type-hint everything :D So I'll release your fix very soon (hopefully today).

Cheers,

Máté

@kocsismate kocsismate merged commit 003025e into woohoolabs:2.0 Jan 31, 2018
@piotrbelina
Copy link
Contributor Author

Hi Máté,

Thank you for your quick response and the merge :)
Feel free to merge it to master also (since this pull request was for release 2.0.0 - I'm using version 2 because it supports php 7.0).
I would appreciate very much 2.0.5 tag so it would appear on packagist :)
Cheers,
Piotr

@kocsismate
Copy link
Member

I've just released v2.0.5 :) And 3.0.1 is on its way along with other changes!

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.

2 participants