All files / schemas/.history/oada/websockets request.schema_20211222150444.ts

0% Statements 0/46
0% Branches 0/1
0% Functions 0/1
0% Lines 0/46

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47                                                                                             
import { JSONSchema8 as Schema } from 'jsonschema8';

const schema: Schema = {
  $id: 'https://formats.openag.io/oada/websockets/request.schema.json',
  $schema: 'http://json-schema.org/draft-07/schema#',
  description:
    'This is the format of an OADA websocket request (client to server)',
  definitions: {
    id: {
      type: 'string',
    },
  },
  type: 'object',
  required: ['requestId', 'path', 'method', 'headers'],
  properties: {
    requestId: { $ref: '#/definitions/id' },
    path: { $ref: '../../oada.schema.json#/definitions/path' },
    method: {
      anyOf: [
        { $ref: '../../oada.schema.json#/definitions/method' },
        {
          enum: [
            'watch',
            'unwatch',
            'head-watch',
            'get-watch',
            'put-watch',
            'post-watch',
            'watch-post',
            'ping',
          ],
        },
      ],
    },
    headers: {
      type: 'object',
      required: ['authorization'],
      properties: { authorization: { type: 'string' } },
    },
    data: {
      description: 'The optional data payload of the request',
    },
  },
};

export default schema;