jakubrohleder / angular-jsonapi

Simple and lightweight, yet powerful ORM for your frontend that seamlessly integrates with your JsonAPI server.
http://jakubrohleder.github.io/angular-jsonapi/
GNU General Public License v3.0
94 stars 34 forks source link

Q&A #2

Open jakubrohleder opened 9 years ago

jakubrohleder commented 9 years ago

Topic for questions about the package usage that does not require a new issue. Feel free to ask about anything!

jsenecal commented 9 years ago

@jakubrohleder Is there a reason behind the use of validatejs? could one replace it with something else ? like ng-messages - Maybe make the validation part modular - i.e ng-messages is better adapted to multilingual applications.

jakubrohleder commented 9 years ago

@jsenecal I like validatejs (from http://validatejs.org/ not http://rickharrison.github.io/validate.js/) because it performs exactly what it promises: takes object, takes constraints, validates it and returns object with errors.

As far as I know ng-messages handles visual aspect of errors presentation and requires other directives (like ng-maxlenght or required).

I'm still looking for the right solution. For me perfect flow would be: object is validated, error codes are saved in the object.errors, in the view you translate error codes to messages using e.g. angular-translate. Maybe it's not perfect but it separates abstract objects layer from presentation layer.

I've added issue about internationalization to validate.js (ansman/validate.js#74)

hardywu commented 9 years ago

Why makes the service names so long, like AngularJsonAPISynchronizerSimple ?

jakubrohleder commented 9 years ago

@hardywu Current implementation of angular does not support namespaces nor module private services, so I just wanted to avoid names collisions with other packages.

It's not very likely with SynchronizerSimple, but e.g. Collection is quite a common name, thats why I added AngularJsonAPI prefix to all services.

dallas commented 9 years ago

@jakubrohleder Can't we namespace with the a - though? In fact, isn't that the preferred way to apply a namespace (https://github.com/angular/angular.js/wiki/Best-Practices)? E.g.: jsonapi-synchronizerSimple.

jakubrohleder commented 9 years ago

@dallas thanks for the article, I haven't seen it before. the - namespace is valid for directives, but for services that are meant to be injected I do not see it as a good idea - it is interpreted as the subtract. Same goes for ..

This kind name can be used in the "minification" style, but at the end of a day you still have to use some underscored/camelcased name.

The only reasonable idea I have to solve this problem is making services available via $jsonapi provider. Then both $jsonapi.synchronizerSimple and AngularJsonAPISourceRest would be available. What do you think about such a solution?

jsenecal commented 9 years ago

@jakubrohleder I'm starting to implement websocket support for our backend app...

I thought of implementing something that could push object updates to clients when they are changed on the server (and then replace the existing cached data with the new data) does that makes sense to you ?

jakubrohleder commented 9 years ago

@jsenecal it does! Current architecture is not really 'prepared' for push updates (as synchronization is always triggered by the user). Nevertheless it is totally possible to do socket style synchronization.

Recently I did not have much time to develop the project, as I'm leaving for three weeks long trip to South America (Peru to be exact) tomorrow and had to finish my work projects. I won't have much internet access and I'm leaving my laptop at home, but I'll try to help you as much as I can.

jsenecal commented 9 years ago

@jakubrohleder I heard that you were back - So, I currently have a websocket implementation that I would like to propose to you - Shall we open an issue dedicated to that ?

jakubrohleder commented 9 years ago

@jsenecal would be great! I need few days to sync with my everyday life, but I'll surely will review it by the end of a week.

xpopov commented 9 years ago

@jsenecal Do you push updates since connection started, or it's also possible to ask for updates since specific timestamp?

jsenecal commented 9 years ago

@xpopov Well, my websocket implementation is mostly SSE (Sever Side Events) So the client's browser is not actually requesting anything :P My implementation "Subscribes" the browser websocket to the content fetched in the past through regular HTTP GET (including includes) so that if some other user/client updates/deletes an entry all "subscribed" websockets would get the updated version or creation/deletion notification.

Makes sense ? I created issue #26 for further discussion

plwade commented 8 years ago

@jakubrohleder We are using your JsonApi in a slightly different way to your Demo App. We are injecting an accounts resource factory (return $jsonapi.getResource('accounts')) into our controller and using accounts.all().promise to get a collection of accounts.

On the return of the promise, we populate our view model using vm.accountsList = accounts.cache.index(). Is this an acceptable way to use the JsonApi?

I know this is a different approach to your demo app, but we just want to make sure we are not making any fundamental mistakes. Any help appreciated. Regards, Paul

mustela commented 8 years ago

Hey there, wondering if the project is still active.

Thanks!

jakubrohleder commented 8 years ago

@mustela yes and no :).

Recently I've been traveling a lot, changed job and been working on other big project. So for past two months I haven't got time to work on angular-jsonapi.

Nevertheless I'm still determined to keep this project alive. I hope to find some time to resolve posted issue in the near feature.

Sorry for no recent project activity.

mustela commented 8 years ago

Thanks for your comments @jakubrohleder!!

eduardmartinez commented 8 years ago

@jakubrohleder I really want to thank you a lot for the effort you have given to develop this project and if someone could help you, it'd be great for community. I'm currently developing a project based on this project and I'd be one of those contributors if I had more time (maybe in a months I could). By now, I'd like to ask if you could find some time for checking pull requests at least, because there are useful suggestions that can improve this project (well, it's on your own :) )

Sorry for my bad english :D

zoamel commented 8 years ago

Sorry if this question was already posted somewhere. Is this library compatible with json api 1.0? I'm asking cause I'm not sure when 1.0 was released exactly and if this library stopped being actively maintained before that time.