Skip to content

Latest commit

 

History

History
76 lines (67 loc) · 1.16 KB

README.md

File metadata and controls

76 lines (67 loc) · 1.16 KB

HyperJSON Response Message

Version 0.0.1

Prerequisites

Schema

./response-schema.json

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "name": "HyperJSON Response Message",
  "type": "object",
  "properties": {
    "status": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "required": [
          "code"
        ]
      }
    },
    "body": {
      "anyOf": [{
        "type": "array"
      }, {
        "type": "boolean"
      }, {
        "type": "integer"
      }, {
        "type": "number"
      }, {
        "type": "null"
      }, {
        "type": "object"
      }, {
        "type": "string"
      }]
    }
  },
  "required": [
    "status"
  ]
}

Valid Samples

// minimal
{
  status: {
    code: '200'
  }
}

// with an optional status message and body included
{
  status: {
    code: '200',
    message: 'Success'
  },
  body: 'rocking'
}