-
Notifications
You must be signed in to change notification settings - Fork 109
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
The path to 1.0 #60
Comments
|
Hi Chris, I'm up for working on converting/modernizing the tests. But may I suggest using orchestral/testbench? I used it when I developed the dixieio/eloquent-model-future and it just made writing tests using laravel facades and configs a breeze and super reliable. If like the approach I'm up for throwing a PR tonight. 😄 |
Hi @jstoone Your help with the tests would be super appreciated and would definitely speed up getting to I'd be happy to use testbench where it is not possible to write unit tests. Generally I'm trying to write the majority of units so that they are unit testable - i.e. their dependencies are Illuminate contracts. E.g. the There are however some parts of the package where that's not possible - and the part the really jumps to mind is anything to do with Eloquent models. So what I'd suggest is we create two sub directories in the If that sounds like a plan, I'll push a commit to the |
@jstoone I've restructured the tests on |
@lindyhopchris Sounds great, and the Exciting times! 🔥 |
@jstoone great tip on the testbench repo - just used that in a package at work and it makes things a lot simpler. i was going to start setting up the tests this evening unless you'd already started? |
@lindyhopchris it is really a gem when it comes to testing features that are more tightly coupled to Laravel. Also great that you've had the opportunity to play around with it. 👍 I have started setting them up, but then life entered the door and denied me access to my spare time. I was planning on finishing it around Saturday or Sunday, but with that said if you want to get it done tonight feel free to take over. I haven't produced any progress on the setup, mainly playing around to see what would feel the best. I'll pick something else on the checklist for the weekend json-api hackathon. 🎉 Also in general, if you feel like getting code reviews on your changes, just assign me and I'll review. That would also help me gain more knowledge regarding the package. There is always time for a code review or two during my day. 🙂 |
@jstoone didn't do any on it last night as I didn't want to cross over with anything you were doing (and only just seen your message now this morning). So if you want to carry on with the test stuff this weekend that will really help. Thanks for offer of help re: code reviews. Will take you up on that! |
@lindyhopchris alright! Awesome to finally get the PR pushed out and merged! 🎉 Is there anything that you would find handy, that I'd start working on now? |
Thanks for your PR. Definitely some help with writing tests for the Eloquent classes. I'm doing some work on this package tonight so will let you know which class you could take once I've had a look over things this evening. |
@lindyhopchris you're very welcome, it's great to be able to contribute. Just throw me a bone when you're ready, and I'll figure out what to do with it once it's there. 😁 |
@jstoone was thinking if it's possible to test the |
Just as an update, the latest changes on Here's what an adapter now looks like: And this one supports has-many polymorphic relationships: |
@lindyhopchris This is awesome news. A lot simpler indeed. Then I guess "full support for filtering, paging etc for relationship endpoints" is next on the list. This is the one thing that prevents me from updating my project. I guess there's not an easy workaround I could implement on my own? Anyway, great work, as always. |
Yes, plan is to do that next then tag as The only thing is that'll be in January as I'm away for 3 weeks from 26 December and work is too busy between now and Christmas to get it done before then. |
@lindyhopchris I know you are more than super busy, and work should always come before hobby, but just to try and get an update on those two first items in the path to 1.0 list (filtering and with on single). Not to rush you, but to know what can be reasonably expected. |
@JeanLucEsser no problem with you asking!! So I've been working on the 1.0 release recently - it's on the The I'm thinking that'll probably be tagged in the next couple of weeks. I'm using the |
@lindyhopchris thanx for this update! Good luck on your deadlines! |
actually I interpreted this as straightforward. If your relationship needs to be paginated, it should never be serialized as resource identifiers in the primary resource. You should use a link for the relationship and then paginate when using that link. For example, lets say there's a Your post resource would look like this: {
"type": "posts",
"id": "1",
"attributes": {
"title": "My First Post"
},
"relationships": {
"comments": {
"links": {
"related": "/api/posts/1/comments"
}
}
}
} Then to get the first page of comments for that post you would do: GET /api/posts/1/comments?page[number]=1&page[size]=20 HTTP/1.1
Accept: application/vnd.api+json The version 1.0 branch will handle that relationship pagination automatically. It also handles filtering on the relationship so you could also do this: GET /api/posts/1/comments?filter[author]=123 HTTP/1.1
Accept: application/vnd.api+json To get all comments created by the author with id 123. |
@lindyhopchris,
(that should return all posts where the author with ID=123 has commented)? |
So I'd never recommend variably including the resource identifiers... because otherwise the client doesn't know what it's getting. So in the In terms of only providing the links and not data, you can already do that in your schema by not returning anything for data. You can see an example of that here: The filtering logic is totally up to the application as this package just provides the hook for it and then each application can implement its own filtering logic. For the example you give, this would already be possible in the if ($author = $filters->get('comments.author')) {
$builder->whereHas('comments', function ($query) use ($author) {
$query->where('author_id', $author);
});
} |
Have moved the caching of API config to the |
Good idea! Anything that can speed up official release of |
@JeanLucEsser good point, I'll take that off for now as you're right that it doesn't stop me from tagging Just as an update for all on where I'm at with this...
I'll time |
I'm really curious about what alpha 2 will bring to the table. I'll take a look at Laravel Authorization and how it is currently implemented. All in all, that's a great roadmap. Thanx ^^ |
@JeanLucEsser the Authorization thing is mainly:
|
I've also added it to the demo app. |
Awsome. Just to be sure, should we require |
Require the tag: $ composer require cloudcreativity/laravel-json-api:1.0.0-alpha.2 |
Closing this in favour of the milestone. The only remaining issues relate to validation. We're planning to put in a new validation implementation as the current one was one of the first things we wrote and there's a number of improvements we can do now that the validation does not need to be framework-agnostic. Our plan however is to leave the existing validation implementation for |
Now that
neomerx/json-api
is at1.0
we want to get this library to1.0
as soon as possible - to give people confidence that the API is stable.The recent routing refactor and reducing the number of units per resource type (currently on
develop
- will be released as0.8
) puts in a lot of pre-1.0 changes that we wanted to do to simplify the package.Required 1.0 Features
with
when retrieving single records. See with not being called in single record request #62JsonApiController
so that it has the majority of the workflow that currently exists withinEloquentController
. Extend the Eloquent controller from this new controller.laravel/browser-kit-testing
.Addjson-api:cache
andjson-api:clear
commands to cache theApiInterface
object. This will give a performance benefit to HTTP requests along the lines ofroute:cache
.Required Internal Changes
Resource
class as it is a reserved word in PHP 7.0StandardObjectInterface
and related generic classes to a separate utility library.ValidatorErrorFactoryInterface
in thecloudcreativity/json-api
package rather than extending that interface inlaravel-json-api
.HttpServiceInterface
and instead inject theApiInterface
andRequestInterface
directly. This is possible as long as no services are created post the JSON-API middleware running.Opening this issue so that people can comment on any features that they think are needed for 1.0.
The text was updated successfully, but these errors were encountered: