$schema: http://json-schema.org/draft-07/schema#
$defs:
  JSONRPC2Object:
    type: object
    required:
    - jsonrpc
    properties:
      jsonrpc:
        const: '2.0'
        x-jsonld-id: http://json-rpc.org/ontology#version
        x-jsonld-type: http://www.w3.org/2001/XMLSchema#string
  IDObject:
    allOf:
    - $ref: '#/$defs/JSONRPC2Object'
    - type: object
      properties:
        id:
          type:
          - string
          - integer
          - 'null'
          x-jsonld-id: http://json-rpc.org/ontology#hasId
          x-jsonld-type: '@id'
  ErrorObject:
    type: object
    required:
    - code
    - message
    properties:
      code:
        type: integer
        x-jsonld-id: http://json-rpc.org/ontology#hasErrorCode
        x-jsonld-type: http://www.w3.org/2001/XMLSchema#integer
      message:
        type: string
        x-jsonld-id: http://json-rpc.org/ontology#hasErrorMessage
        x-jsonld-type: http://www.w3.org/2001/XMLSchema#string
      data:
        x-jsonld-id: http://json-rpc.org/ontology#hasErrorData
        x-jsonld-type: '@json'
  Notification:
    $anchor: Notification
    allOf:
    - $ref: '#/$defs/JSONRPC2Object'
    - type: object
      required:
      - method
      properties:
        method:
          type: string
          x-jsonld-id: http://json-rpc.org/ontology#hasMethod
          x-jsonld-type: http://www.w3.org/2001/XMLSchema#string
        params:
          type:
          - object
          - array
          x-jsonld-id: http://json-rpc.org/ontology#hasParameters
          x-jsonld-type: '@json'
  Request:
    $anchor: Request
    allOf:
    - $ref: '#/$defs/IDObject'
    - $ref: '#/$defs/Notification'
  Response:
    $anchor: Response
    allOf:
    - $ref: '#/$defs/IDObject'
    - oneOf:
      - required:
        - result
        properties:
          result:
            x-jsonld-id: http://json-rpc.org/ontology#hasResult
            x-jsonld-type: '@json'
      - required:
        - error
        properties:
          error:
            $ref: '#/$defs/ErrorObject'
            x-jsonld-id: http://json-rpc.org/ontology#hasError
            x-jsonld-type: '@id'
  BatchRequest:
    $anchor: BatchRequest
    type: array
    items:
      $ref: '#/$defs/Request'
  BatchResponse:
    $anchor: BatchResponse
    type: array
    items:
      $ref: '#/$defs/Response'
oneOf:
- $ref: '#/$defs/Request'
- $ref: '#/$defs/Notification'
- $ref: '#/$defs/Response'
- $ref: '#/$defs/BatchRequest'
- $ref: '#/$defs/BatchResponse'
x-jsonld-extra-terms:
  Message:
    x-jsonld-id: http://json-rpc.org/ontology#Message
    x-jsonld-type: '@id'
  Request:
    x-jsonld-id: http://json-rpc.org/ontology#Request
    x-jsonld-type: '@id'
  Notification:
    x-jsonld-id: http://json-rpc.org/ontology#Notification
    x-jsonld-type: '@id'
  Response:
    x-jsonld-id: http://json-rpc.org/ontology#Response
    x-jsonld-type: '@id'
  ErrorResponse:
    x-jsonld-id: http://json-rpc.org/ontology#ErrorResponse
    x-jsonld-type: '@id'
  Error:
    x-jsonld-id: http://json-rpc.org/ontology#Error
    x-jsonld-type: '@id'
  RequestId:
    x-jsonld-id: http://json-rpc.org/ontology#RequestId
    x-jsonld-type: '@id'
  StringId:
    x-jsonld-id: http://json-rpc.org/ontology#StringId
    x-jsonld-type: '@id'
  NumberId:
    x-jsonld-id: http://json-rpc.org/ontology#NumberId
    x-jsonld-type: '@id'
  NullId:
    x-jsonld-id: http://json-rpc.org/ontology#NullId
    x-jsonld-type: '@id'
  stringValue:
    x-jsonld-id: http://json-rpc.org/ontology#hasStringValue
    x-jsonld-type: http://www.w3.org/2001/XMLSchema#string
  numberValue:
    x-jsonld-id: http://json-rpc.org/ontology#hasNumberValue
    x-jsonld-type: http://www.w3.org/2001/XMLSchema#decimal
  ParseError:
    x-jsonld-id: http://json-rpc.org/ontology#ParseError
    x-jsonld-type: '@id'
  InvalidRequest:
    x-jsonld-id: http://json-rpc.org/ontology#InvalidRequest
    x-jsonld-type: '@id'
  MethodNotFound:
    x-jsonld-id: http://json-rpc.org/ontology#MethodNotFound
    x-jsonld-type: '@id'
  InvalidParams:
    x-jsonld-id: http://json-rpc.org/ontology#InvalidParams
    x-jsonld-type: '@id'
  InternalError:
    x-jsonld-id: http://json-rpc.org/ontology#InternalError
    x-jsonld-type: '@id'
  ServerError:
    x-jsonld-id: http://json-rpc.org/ontology#ServerError
    x-jsonld-type: '@id'
x-jsonld-base: https://override-me-for-custom-content.eg/
x-jsonld-prefixes:
  jrpc: http://json-rpc.org/ontology#
  xsd: http://www.w3.org/2001/XMLSchema#
  rdfs: http://www.w3.org/2000/01/rdf-schema#
