Jump to: navigation, search

Difference between revisions of "OpenStack-SDK-PHP/Design/JSON-schema"

Line 13: Line 13:
 
* As we add new features, we don't need to write new unit tests because the parsing feature is already fully tested
 
* As we add new features, we don't need to write new unit tests because the parsing feature is already fully tested
 
* It's more scalable and responsive
 
* It's more scalable and responsive
 +
  
 
A parsing feature should:
 
A parsing feature should:

Revision as of 10:30, 8 April 2014

We've discussed several times the best way to define services in the SDK. These are our three options:

  1. JSON-schema
  2. Guzzle's DSL
  3. Hand-coding everything

Based on our discussions, we seem to have agreed that JSON schemas were the best options, because:

  • It's a standard format that lots of APIs use, including: OpenStack Glance, OpenStack Keystone (future), Google Discovery API, Heroku
  • It's being implemented into OpenStack common soon
  • It avoids duplication
  • It allows us to RAPIDLY implement new features. For example, I defined the Compute API in 1 day. To do that in normal code would have take 3-5 days.
  • As we add new features, we don't need to write new unit tests because the parsing feature is already fully tested
  • It's more scalable and responsive


A parsing feature should:

  • Validate data according to a schema
  • Consume remote schemas (from an API) or local schema files
  • Parse data into models objects for users to use