2023-06-18 23:29:57 +02:00
|
|
|
namespace _heimdall.helpers.json_schema
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
2023-07-06 16:13:26 +02:00
|
|
|
/*
|
2023-06-19 18:27:04 +02:00
|
|
|
type type_name = (
|
2023-06-18 23:29:57 +02:00
|
|
|
"null"
|
|
|
|
|
|
|
|
|
|
|
"boolean"
|
|
|
|
|
|
|
|
|
|
|
"integer"
|
|
|
|
|
|
|
|
|
|
|
"float"
|
|
|
|
|
|
|
|
|
|
|
"string"
|
|
|
|
|
|
|
|
|
|
|
"array"
|
|
|
|
|
|
|
|
|
|
|
"object"
|
|
|
|
|
);
|
2023-07-06 16:13:26 +02:00
|
|
|
*/
|
2023-06-18 23:29:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2023-06-19 18:27:04 +02:00
|
|
|
* @see https://json-schema.org/
|
|
|
|
|
* @see https://json-schema.org/understanding-json-schema/reference/type.html
|
2023-06-18 23:29:57 +02:00
|
|
|
*/
|
2023-06-19 18:27:04 +02:00
|
|
|
export type type_schema = (
|
|
|
|
|
{
|
|
|
|
|
description ?: string;
|
|
|
|
|
deprecated ?: boolean;
|
|
|
|
|
}
|
|
|
|
|
&
|
|
|
|
|
(
|
2023-07-27 17:37:45 +02:00
|
|
|
{
|
|
|
|
|
type : "any";
|
|
|
|
|
default ?: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-06-19 18:27:04 +02:00
|
|
|
{
|
|
|
|
|
type : "null";
|
2023-07-27 17:37:45 +02:00
|
|
|
default ?: null;
|
2023-06-19 18:27:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
type : "boolean";
|
|
|
|
|
default ?: boolean;
|
|
|
|
|
enum ?: Array<boolean>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
type : "integer";
|
|
|
|
|
default ?: int;
|
|
|
|
|
enum ?: Array<int>;
|
|
|
|
|
minimum ?: int;
|
|
|
|
|
exclusiveMinimum ?: int;
|
|
|
|
|
maximum ?: int;
|
|
|
|
|
exclusiveMaximum ?: int;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
type : "number";
|
|
|
|
|
default ?: float;
|
|
|
|
|
enum ?: Array<float>;
|
|
|
|
|
minimum ?: float;
|
|
|
|
|
exclusiveMinimum ?: float;
|
|
|
|
|
maximum ?: float;
|
|
|
|
|
exclusiveMaximum ?: float;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
type : "string";
|
|
|
|
|
default ?: string;
|
|
|
|
|
enum ?: Array<string>;
|
|
|
|
|
minLength ?: int;
|
|
|
|
|
maxLength ?: int;
|
|
|
|
|
pattern ?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @see https://json-schema.org/understanding-json-schema/reference/object.html#object
|
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
type : "object";
|
|
|
|
|
additionalProperties ?: (
|
|
|
|
|
false
|
|
|
|
|
|
|
|
|
|
|
type_schema
|
|
|
|
|
);
|
|
|
|
|
properties ?: Record<string, type_schema>;
|
|
|
|
|
required ?: Array<string>;
|
|
|
|
|
unevaluatedProperties ?: boolean;
|
|
|
|
|
default ?: Object;
|
|
|
|
|
enum ?: Array<Object>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
{
|
2023-07-06 16:13:26 +02:00
|
|
|
type : "array";
|
2023-06-19 18:27:04 +02:00
|
|
|
items ?: type_schema;
|
|
|
|
|
default ?: Array<any>;
|
|
|
|
|
enum ?: Array<Array<any>>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
{
|
2023-07-27 17:37:45 +02:00
|
|
|
anyOf : Array<type_schema>;
|
|
|
|
|
default ?: any;
|
2023-06-19 18:27:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
{
|
2023-07-27 17:37:45 +02:00
|
|
|
allOf : Array<type_schema>;
|
|
|
|
|
default ?: any;
|
2023-06-19 18:27:04 +02:00
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
);
|
2023-06-18 23:29:57 +02:00
|
|
|
|
|
|
|
|
}
|