Interface INopeDescriptor

INopeDescriptor

A generic descriptor of data or a function. This descriptors will be used to describe NoPE data-points or functions. The Descriptor is based on JSON-Schemas (see here for more details).

Describing data

A valid example - describing some data - is given below (in the form of JSON-data). This example matches a JSON-Schema: *

{
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}

Describing functions

A valid example - describing a function - is given below (in the form of JSON-data):

{
"type": "function",
"description": "A Sample Function",
"inputs": [
{
"name": "parameter_01",
"description": "The first Parameter of the Function",
"schema": {
"type":"string",
"maxLength": 10
}
},
{
"name": "parameter_02",
"description": "The second Parameter of the Function. This is optional",
"optional": true,
"schema": {
"type":"boolean"
}
}
]
}

Export

INopeDescriptor

Hierarchy

  • INopeDescriptor

Properties

$id?: string

This is important because it tells refs where the root of the document is located

$ref?: string
$schema?: string
additionalItems?: boolean | INopeDescriptor
additionalProperties?: boolean | INopeDescriptor
allOf?: INopeDescriptor[]
anyOf?: INopeDescriptor[]
default?: any

Default json for the object represented by

definitions?: {
    [key: string]: INopeDescriptor;
}

Holds simple JSON Schema definitions for referencing from elsewhere.

Type declaration

dependencies?: {
    [key: string]: INopeDescriptor | string[];
}

If the key is present as a property then the string of properties must also be present. If the value is a JSON Schema then it must also be valid for the object if the key is present.

Type declaration

description?: string

Schema description

enum?: any[]

Enumerates the values that this schema can be e.g.

{ "type": "string", "enum": ["red", "green", "blue"] }

examples?: any
exclusiveMaximum?: boolean

If true maximum must be > value, >= otherwise

exclusiveMinimum?: boolean

If true minimum must be < value, <= otherwise

Data-Field, which must be filled out, if we are describing a function. This will describe the entire data of the inputs.

maxItems?: number

max. amount of items, the array is allwoed to contain.

maxLength?: number

Max length of the string.

maxProperties?: number
maximum?: number
minItems?: number

min. amount of items, the array must contain.

minLength?: number

Min length of the string.

minProperties?: number
minimum?: number
multipleOf?: number

The value must be a multiple of the number (e.g. 10 is a multiple of 5)

The entity being validated must not match this schema

oneOf?: INopeDescriptor[]

The Return (output) of a function. This must be provided if the type is set to function type

pattern?: string

This is a regex string that the value must conform to

patternProperties?: {
    [pattern: string]: INopeDescriptor;
}

The key of this object is a regex for which properties the schema applies to

Type declaration

properties?: {
    [property: string]: INopeDescriptor;
}

The keys that can exist on the object with the json schema that should validate their value

Type declaration

required?: string[]

Props that must be integrated

title?: string

Title of the schema

The basic type of this schema, can be one of ['string' | 'number' | 'object' | 'array' | 'boolean' | 'null'] or an array of the acceptable types

uniqueItems?: boolean

Flag, to define, that every item in the array must be unique.

Generated using TypeDoc