restangular icon indicating copy to clipboard operation
restangular copied to clipboard

Restangular 2.0: Opinions and Recommendations

Open mgonto opened this issue 11 years ago • 18 comments

Hey Everyone,

Sorry for not answering most of the issues lately, I've been working in creating a new version of Restangular. It'll be Restangular 2.0 and the idea is that it'll be easier to then move it to AngularJS 2.0.

I have an idea of what I want for Restangular 2.0 but wanted to get your feedback (the users feedback) on what APIs you like and which you don't as well as features that you'd like to be included.

Here is the main list I've got so far:

  • Implementing Restangularized objects as Prototypes
  • Implementing Method/Data extension with objects
  • Improving API to work with URLs instead of resources
  • Add request/response interceptors per resource
  • Improve the API for getting an element from the list
  • Add the posibility to inject any service to configurations on RestangularProvider
  • Make Restangular service based options. Make Restangular.service('users') work

As I said, feedback is welcomed. This is the right moment to make an impact in the future of Restangular :).

Thanks!

mgonto avatar Sep 29 '14 14:09 mgonto

Great idea to ask for feedback! First thanks for your good work.

My priority list would be:

  • work with stub objects: sometimes I retrieve a list of basic objects throught restangular, and if needed I want to retrieve the full object (extend the stub object), usually multiple fields containing sub lists of objects, but also single value fields.
  • better handling of related entities: maybe take some ideas from breeze.js. In particular having a single instance of a sub object that can be related to multiple entities is a challenge. Maybe is it outside the scope of Restangular and sounds more like an ORM feature.
  • Improve the API for getting an element from the list

jmaynier avatar Sep 30 '14 08:09 jmaynier

Great! I think we should get each of these ideas/priorities and make an issue to discuss them separately, all tagged with a common tag (Think for Restangular 2.0?).

On my priority list, I would put the necessity to divide Restangular into stand-alone services. Say, one for what today is Path, BaseCreator, and others that probably should appear. This does not mean we would have the main Restangular object, but this one would then inject the others.

Also, I would recommend we make better use of Grunt (or even consider moving to Gulp, which I tend to love nowadays) to divide the code into minimal implementation parts. In my opinion, that would dramatically improve contributions.

Cheers! Congratulations for the project and for been so community focused.

lucasconstantino avatar Oct 01 '14 00:10 lucasconstantino

Hey guys,

You can see some of the work at https://github.com/mgonto/restangular/tree/2.0-wip

I'll be releasing the docs soon :).

Cheers!

mgonto avatar Oct 01 '14 03:10 mgonto

+1 to use Gulp, it is far better than Grunt

jmaynier avatar Oct 01 '14 08:10 jmaynier

OData support!

lopesc avatar Oct 01 '14 20:10 lopesc

OData is very .Net centric, there are few other server side implementations.

jmaynier avatar Oct 02 '14 09:10 jmaynier

Make child objects of an array auto update the item in the parent array.

pseudo code html <.tr ng-repeat=item in items> <.button ui-sref='item(itemId:itemId)'>Edit Item<./button> <./tr> js

$stateProvider.state(items, {
resolve:{
items: restangularArray
}
};
$stateProvider.state(item, {
url:':itemId',
resolve: {
    item: items.get(itemId)
}

I _think that's enough to get the gist of what I'm saying. Basically, if I change something in the item state, I would like to see restangular handle updating it in the items array. It doesn't currently, so I have to reload the array in the parent scope to do so manually.

jondthompson avatar Oct 23 '14 18:10 jondthompson

My #1 request would be to separate the pure HTTP client & resource configuration from the Angular part. Because I can't find any library with such a good API for requesting REST services, but I don't want to be tied to Angular.

The first step would be replacing $http with something independent of Angular.js (how about https://github.com/mzabriskie/axios ?)

fzaninotto avatar Jan 13 '15 12:01 fzaninotto

Nice one, @fzaninotto. This could even lead to a separated project which would be a dependency for Restangular.

lucasconstantino avatar Jan 13 '15 19:01 lucasconstantino

I'd like to see the restangular properties (eg restangularEtag, reqParams, fromServer etc etc) in a namespace so I can clearly see the properties that come from the api without the restangular stuff getting in the way.

Also all promises/enhanced promises should be fully chainable.

j0hnsmith avatar Jan 15 '15 10:01 j0hnsmith

@jondthompson +1

MarkRBM avatar Mar 05 '15 11:03 MarkRBM

Continuing on my previous comment, we've just released the framework agnostic library that builds up on axios, and provides similar features to Restangular, but without angular. It's called marmelab/restful.js. Comments re welcome!

fzaninotto avatar Mar 10 '15 14:03 fzaninotto

+1 for enabling easy auto updates to view data based on the response of further requests / the data is changed.

E.g. ng-repeat a list of items form a get, perform a (successful) post, remove, put etc request on those items, grab the response and auto update the view with the changes (item added, removed or updated)

Restangular will help bridge the real-time gap for api responses. No more manually pushing or splicing or .then required!

Add in your favorite socket service as well for complete real time goodness :)

mmichaelbiz avatar Mar 18 '15 19:03 mmichaelbiz

What is the state of 2.0? It's been almost half a year since the last commit to 2.0-wip. Do you need any help? Is the project abandoned? Is @mgonto MIA after ng-conf?

santialbo avatar Mar 25 '15 11:03 santialbo

up, any progress?

sidoruk-sv avatar Jan 26 '16 14:01 sidoruk-sv

@mgonto has more or less abandoned the project, at least for now. A handful of us collaborators try to keep the project afloat by merging PRs and answering issues, but any help is always welcome! See #1319

bostrom avatar Jan 13 '17 09:01 bostrom

It seems now that this project will continue to focus only on Angular 1 support, since there's ng2-restangular for Angular 2 support (see #1318).

Since @mgonto is the only one that really knows what the plans were for Restangular 2, and he is not longer mantaining this project, I made a proposal about the future versions of Restangular, implying to abandon the plans for Restangular 2 as we know them (full on rewrite and Angular 2 support) and instead continue the development of the current Restangular code according to semver, i.e. bumping the major version when breaking changes are introduced. This would mean a major version bump every now and then, instead of seeing the major version as a "software generation identifier".

Fixing bugs and introducing features is a brittle affair at the moment, so I'm now trying to decipher the codebase and restructure it to accommodate for more and better unit tests and, hopefully, some major refactoring at some point. With absolute minimum impact on the API. Easier said than done maybe...

bostrom avatar Jan 19 '17 08:01 bostrom

Hello guys, I'm rewriting the Restangular to work with Angular 2...

https://github.com/RodolfoSilva/rs-restangular

RodolfoSilva avatar Mar 11 '17 19:03 RodolfoSilva