Giter Site home page Giter Site logo

API versioning via Accept header about eve HOT 4 CLOSED

pyeve avatar pyeve commented on July 23, 2024
API versioning via Accept header

from eve.

Comments (4)

nicolaiarocci avatar nicolaiarocci commented on July 23, 2024

Yes, interesting. I like keeping URIs clean too. Will brainstorm a little and get back to you.

from eve.

nicolaiarocci avatar nicolaiarocci commented on July 23, 2024

Support for dynamic versioning implies that the API is aware of different schemas (in Eve jargon, one DOMAIN per version). And that's not taking global configuration settings (RESOURCE_METHODS, CACHE_CONTROL, etc) into account. It's doable, at the inevitable cost of configuration complexity. A couple options come to mind:

Multiple, isolated, settings files, one per version. Users could always use imports to easily replicate common settings.

Or,

One file as it is now, but split the version configuration somehow, maybe with a dictionary. Something like:

{
 'v1': {
    RESOURCE_METHODS: ['GET'], 
    ...
    DOMAIN: {...},
 }
{
 'v2': {
   RESOURCE_METHODS: ['GET'],
   ...
   DOMAIN: {...},
 }
}

It gets simpler if we'd only allow for domain deltas between versions:

DOMAIN: {
  'v1': {...},
  'v2': {...},
}

Of course both designs could be merged:

{
 'v1': 'settings-v1.py',
 'v2': 'settings-v2.py'
}

The trick is to balance flexibility with complexity. Mind you, I'm just brainstorming in the open, so to speak.

from eve.

nicolaiarocci avatar nicolaiarocci commented on July 23, 2024

Also, I should add that I'm not too fond of API versioning. I believe that clients should be intelligent enough to deal with API updates transparently, especially since Eve-powered API support HATEOAS.

from eve.

nicolaiarocci avatar nicolaiarocci commented on July 23, 2024

On second thought I believe that different API versions should be totally isolated instances since so many things would/could be different between versions: caching, URIs, schemas, validation, and so on. For example, since URL mappings are loaded at startup, dynamically handling different mappings would be impossible without a rewrite of the core. Also, URI versioning (http://api.example.com/v1/...), which is already supported, is build around isolated API instances.

I'm keeping this on hold for the time being.

from eve.

Related Issues (20)

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.