Git Product home page Git Product logo

yoga's Introduction

Yoga

Yoga extends JAX-RS and SpringMVC RESTful servers to provide GData and LinkedIn style field selectors.

  • Choose which fields you want to see at call-time
  • Navigate entity relationships in a single call for complex views
  • Much faster speeds in high-latency (e.g. mobile) apps
  • Streamline client development
  • Browsable APIs

Wiki

Most of the documentation is here: https://github.com/skyscreamer/yoga/wiki

Quickstart

% git clone [email protected]:skyscreamer/yoga.git
% cd yoga
% mvn install
% cd yoga-demos/yoga-demo-jersey
% mvn jetty:run

Inspiration

Yoga was initially inspired by LinkedIn’s JavaOne presentation on building flexible REST interfaces (http://blog.linkedin.com/2009/07/08/brandon-duncan-java-one-building-consistent-restful-apis-in-a-high-performance-environment/), and it continues to be influenced by GData selectors, and ongoing discussions of HATEOAS.

How does this work?

For an example, we'll use a hypothetical music-oriented social network site. If I'm a user of that site, one of the first things I'd like to do is see my friends' favorite bands. A standard RESTful navigation approach involves two steps:

  1. Get my friends
  2. Get their favorite artists

If I only have two dozen friends on this site, I'm already making 25 queries using pure REST.

With Yoga, you can do it in one call:

GET /user/1.json?selector=friends(favoriteArtists)

In a more complicated example, let's say I want to compile a play list of songs from my friend's favorite artists. This could involve thousands of queries in strict RESTful navigation, but it can still be aggregated as a single query:

GET /user/1.json?selector=friends(favoriteArtists(albums(songs)))

The other option is to program custom controller methods, but the point here is to avoid that, since there's a cost to that and specific client requirements frequently change.

Find a more detailed explanation of our selectors here: https://github.com/skyscreamer/yoga/wiki/REST-Selectors

How Do I Use It?

Yoga works with existing frameworks. To hook it up, you need to add some annotations and a few lines of configuration. Check out the documentation on our wiki for a more detailed explanation.

For advanced users, we provide hooks to further extend Yoga's capabilities.

Once Yoga has been set up, clients can build and modify their own relational queries without any server-side programming.

POM?

Right here:

<dependency>
    <groupId>org.skyscreamer</groupId>
    <artifactId>yoga-core</artifactId>
    <version>1.0.6</version>
</dependency>

And pick one of the integration packages:

<dependency>
    <groupId>org.skyscreamer</groupId>
    <artifactId>yoga-springmvc</artifactId>
    <version>1.0.6</version>
</dependency>

or

<dependency>
    <groupId>org.skyscreamer</groupId>
    <artifactId>yoga-jaxrs</artifactId>
    <version>1.0.6</version>
</dependency>

If this version was recently released, it may take a couple of days for it to propagate to all repositories.

yoga's People

Contributors

carterpage avatar sduskis avatar cepage avatar filaraujo avatar dstine avatar kentongray avatar spollapa avatar johnhearn avatar

Watchers

James Cloos avatar Romain Maneschi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.