Skip to content

JSON Schema that closely resembles an HTTP Response Message but is completely decoupled from any specific application protocol, such as HTTP.

Notifications You must be signed in to change notification settings

HyperJSON/HyperJSON-Response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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'
}

About

JSON Schema that closely resembles an HTTP Response Message but is completely decoupled from any specific application protocol, such as HTTP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published