npolar / api.npolar.no

Searchable data storage
https://api.npolar.no
4 stars 0 forks source link

Schema API should switch to file backend #51

Closed cnrdh closed 9 years ago

cnrdh commented 9 years ago

To avoid inconsistency issues, we switch /schema to a file system backed API.

There are 4 simple rules to follow

  1. Naming convention is semantic like /schema/dataset-1.x.y[.dev].json (where x is major and y minor edit number)
  2. Never update a file once published (increment version)
  3. Copy (don't symlink) latest versioned file into a file without versioning
  4. Always declare explicit versions on the client side
  5. User same version in filename and in schema's id
cnrdh commented 9 years ago

Rule 0 Never use the .json in URIs (but do use them in filenames)

Rule 2 cp dataset-1.y.z.json dataset.json

Rule 4 This makes sure that even if the URI "http://api.npolar.no/schema/project" is used, the errors will state schema version "http://api.npolar.no/schema/project-1.x.z"

cnrdh commented 9 years ago

In production, using Rack::TryStatic https://github.com/npolar/api.npolar.no/commit/308161fcaa6b176fb6e1521c2ff8cea5df39997a