8000 [Bugfix] Fix wrong returned methods in validators by freddy38510 · Pull Request #370 · cloudcreativity/laravel-json-api · GitHub
[go: up one dir, main page]

Skip to content

[Bugfix] Fix wrong returned methods in validators #370

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

Merged
merged 1 commit into from
Jun 18, 2019
Merged

[Bugfix] Fix wrong returned methods in validators #370

merged 1 commit into from
Jun 18, 2019

Conversation

freddy38510
Copy link
Contributor

The methods used in return statement were inverted between delete and create requests.

I think the methods used in return statement were inverted between delete and create requests.
@freddy38510
Copy link
Contributor Author

I'm not sure about this. But i can confirm that when i make a POST request (with one field that not respect his own rules) to create a new resource with a custom validator, the response throws an error with title "Not deletable" instead of "Unprocessable Entity".

@lindyhopchris
Copy link
Member

Hmmm... I don't get this either, because the tests relating to this are passing. It does indeed look wrong though so think I need to figure out how to reproduce the failure in the tests before merging your fix.

@lindyhopchris lindyhopchris added this to the 1.x milestone Jun 18, 2019
@lindyhopchris
Copy link
Member

Ah ok I get it now, the createValidator method isn't used anywhere in this code base - it's provided as a helper method, which is why I haven't picked up on it before. So this is definitely a bug. Thanks for the fix.

lindyhopchris added a commit that referenced this pull request Jun 18, 2019
@lindyhopchris lindyhopchris merged commit 9addb7f into cloudcreativity:develop Jun 18, 2019
@freddy38510
Copy link
Contributor Author
freddy38510 commented Jun 18, 2019

In fact this method is present in the doc to use custom decoding. https://laravel-json-api.readthedocs.io/en/latest/features/media-types/#custom-decoding
Perhaps you should write some tests based on the doc for custom decoding.

You're welcome. By the way, i really like what you're done in this package.

Edit: you were too fast :)

@lindyhopchris
Copy link
Member

Yes, present in the docs is what I meant as a helper method! I've added a test now that failed before your PR, and passes now your PR has been merged.

Glad you are finding the package useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0