forked from redhat-developer/yaml-language-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjsonSchema.ts
More file actions
95 lines (85 loc) · 3.01 KB
/
jsonSchema.ts
File metadata and controls
95 lines (85 loc) · 3.01 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CompletionItemKind } from 'vscode-json-languageservice';
import { SchemaVersions } from './yamlTypes';
export type JSONSchemaRef = JSONSchema | boolean;
export interface JSONSchema {
id?: string;
$id?: string;
$schema?: string;
url?: string;
type?: string | string[];
title?: string;
closestTitle?: string;
versions?: SchemaVersions;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
default?: any;
definitions?: { [name: string]: JSONSchema };
description?: string;
properties?: JSONSchemaMap;
patternProperties?: JSONSchemaMap;
additionalProperties?: boolean | JSONSchemaRef;
minProperties?: number;
maxProperties?: number;
dependencies?: JSONSchemaMap | { [prop: string]: string[] };
items?: JSONSchemaRef | JSONSchemaRef[];
minItems?: number;
maxItems?: number;
uniqueItems?: boolean;
additionalItems?: boolean | JSONSchemaRef;
pattern?: string;
minLength?: number;
maxLength?: number;
minimum?: number;
maximum?: number;
exclusiveMinimum?: boolean | number;
exclusiveMaximum?: boolean | number;
multipleOf?: number;
required?: string[];
$ref?: string;
_$ref?: string;
anyOf?: JSONSchemaRef[];
allOf?: JSONSchemaRef[];
oneOf?: JSONSchemaRef[];
not?: JSONSchemaRef;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
enum?: any[];
format?: string;
// schema draft 06
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const?: any;
contains?: JSONSchemaRef;
propertyNames?: JSONSchemaRef;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
examples?: any[];
// schema draft 07
$comment?: string;
if?: JSONSchemaRef;
then?: JSONSchemaRef;
else?: JSONSchemaRef;
// VSCode extensions
defaultSnippets?: {
label?: string;
description?: string;
markdownDescription?: string;
type?: string;
suggestionKind?: CompletionItemKind;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
body?: any;
bodyText?: string;
}[]; // VSCode extension: body: a object that will be converted to a JSON string. bodyText: text with \t and \n
errorMessage?: string; // VSCode extension
patternErrorMessage?: string; // VSCode extension
deprecationMessage?: string; // VSCode extension
enumDescriptions?: string[]; // VSCode extension
markdownEnumDescriptions?: string[]; // VSCode extension
markdownDescription?: string; // VSCode extension
doNotSuggest?: boolean; // VSCode extension
allowComments?: boolean; // VSCode extension
schemaSequence?: JSONSchema[]; // extension for multiple schemas related to multiple documents in single yaml file
}
export interface JSONSchemaMap {
[name: string]: JSONSchemaRef;
}