@datadayrepos/json-schema-types 0.0.1-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +46 -0
- package/dist/fieldProps.d.ts +20 -0
- package/dist/index.d.ts +2 -0
- package/dist/internalScema.d.ts +189 -0
- package/dist/jsonSchema.d.ts +147 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Ivar Strand
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# JSON SCHEMA TYPES
|
|
2
|
+
|
|
3
|
+
Support library for json-schema types used across libraries.
|
|
4
|
+
|
|
5
|
+
## 1. Install
|
|
6
|
+
Clone this template and navigate to the project directory. Use `pnpm` for installing dependencies:
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pnpm install @datadayrepos/json-schema-types -D
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## 2. Content
|
|
13
|
+
Exports the following:
|
|
14
|
+
```ts
|
|
15
|
+
export type {
|
|
16
|
+
ExtendedJson7,
|
|
17
|
+
JSONSchema7TypeName,
|
|
18
|
+
JSONSchema7Type,
|
|
19
|
+
JSONSchema7Object,
|
|
20
|
+
JSONSchema7Array,
|
|
21
|
+
JSONSchema7Version,
|
|
22
|
+
JSONSchema7Definition,
|
|
23
|
+
JSONSchema7
|
|
24
|
+
|
|
25
|
+
} from './jsonSchema'
|
|
26
|
+
|
|
27
|
+
export type {
|
|
28
|
+
GenericObjectType,
|
|
29
|
+
ABYSchema,
|
|
30
|
+
ABYAllSchemaPackage,
|
|
31
|
+
ABYSchemaDefinition,
|
|
32
|
+
ABYSchemaTypeName,
|
|
33
|
+
ABYSchemaType,
|
|
34
|
+
FieldsMap,
|
|
35
|
+
UISpec,
|
|
36
|
+
WidgetNames,
|
|
37
|
+
UISchema,
|
|
38
|
+
UISchemaDetail,
|
|
39
|
+
ErrSchema
|
|
40
|
+
|
|
41
|
+
} from './internalScema'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## 📄 License
|
|
46
|
+
[MIT](./LICENSE) License © 2023 [Ivar Strand](https://github.com/datadayrepos)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type FieldProps = {
|
|
2
|
+
/** Current node schema */
|
|
3
|
+
schema: object;
|
|
4
|
+
/** Current node uiSchema */
|
|
5
|
+
uiSchema: object;
|
|
6
|
+
/** Current node errorSchema */
|
|
7
|
+
errorSchema: object;
|
|
8
|
+
/** Custom verification rules */
|
|
9
|
+
customFormats: object;
|
|
10
|
+
/** Root node schema */
|
|
11
|
+
rootSchema: object;
|
|
12
|
+
/** Root node formData */
|
|
13
|
+
rootFormData: object;
|
|
14
|
+
/** Current node path */
|
|
15
|
+
curNodePath: string;
|
|
16
|
+
/** Is it required */
|
|
17
|
+
required: boolean;
|
|
18
|
+
/** Do you need to verify the data group */
|
|
19
|
+
needValidFieldGroup: boolean;
|
|
20
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { ExtendedJson7, JSONSchema7TypeName, JSONSchema7Type, JSONSchema7Object, JSONSchema7Array, JSONSchema7Version, JSONSchema7Definition, JSONSchema7, } from './jsonSchema';
|
|
2
|
+
export type { GenericObjectType, ABYSchema, ABYAllSchemaPackage, ABYSchemaDefinition, ABYSchemaTypeName, ABYSchemaType, FieldsMap, UISpec, WidgetNames, UISchema, UISchemaDetail, ErrSchema, } from './internalScema';
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/** ivar.strand 220831 - used as wrappers around json schema and for certain custom props*/
|
|
2
|
+
import type { ExtendedJson7, JSONSchema7Definition, JSONSchema7Type, JSONSchema7TypeName } from './jsonSchema';
|
|
3
|
+
import type { FieldProps } from './fieldProps';
|
|
4
|
+
/**
|
|
5
|
+
* The representation of any generic object type, usually used as an intersection on other types to make them more
|
|
6
|
+
* flexible in the properties they support (i.e. anything else)
|
|
7
|
+
*/
|
|
8
|
+
export type GenericObjectType = {
|
|
9
|
+
[name: string]: any;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Map the JSONSchema7 to our own type so that we can easily bump to JSONSchema8 at some future date and only have to
|
|
13
|
+
* update this one type.
|
|
14
|
+
*/
|
|
15
|
+
export type ABYSchema = ExtendedJson7;
|
|
16
|
+
/** Wrapper for all schema package */
|
|
17
|
+
export type ABYAllSchemaPackage = {
|
|
18
|
+
schema?: ABYSchema;
|
|
19
|
+
formFooter?: FormFooter;
|
|
20
|
+
formProps?: FormProps;
|
|
21
|
+
formMeta?: FormMeta;
|
|
22
|
+
uiSchema?: UISchema;
|
|
23
|
+
errorSchema?: UISchema;
|
|
24
|
+
customFormats?: object;
|
|
25
|
+
formData?: object;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Map the JSONSchema7Definition to our own type so that we can easily bump to JSONSchema8Definition at some future
|
|
29
|
+
* date and only have to update this one type.
|
|
30
|
+
*/
|
|
31
|
+
export type ABYSchemaDefinition = JSONSchema7Definition;
|
|
32
|
+
export type ABYSchemaTypeName = JSONSchema7TypeName;
|
|
33
|
+
export type ABYSchemaType = JSONSchema7Type;
|
|
34
|
+
export type FieldsMap = {
|
|
35
|
+
array: FieldsMapItem;
|
|
36
|
+
boolean: FieldsMapItem;
|
|
37
|
+
integer: FieldsMapItem;
|
|
38
|
+
number: FieldsMapItem;
|
|
39
|
+
object: FieldsMapItem;
|
|
40
|
+
string: FieldsMapItem;
|
|
41
|
+
null: object;
|
|
42
|
+
anyOf: FieldsMapItem;
|
|
43
|
+
oneOf: FieldsMapItem;
|
|
44
|
+
allOf: FieldsMapItem;
|
|
45
|
+
};
|
|
46
|
+
export type FieldsMapItem = {
|
|
47
|
+
name: string;
|
|
48
|
+
props?: FieldProps;
|
|
49
|
+
setup?: (props: any, context: any) => any;
|
|
50
|
+
};
|
|
51
|
+
export type UISpec = {
|
|
52
|
+
readonly?: ABYSchema['readOnly'];
|
|
53
|
+
step?: ABYSchema['multipleOf'];
|
|
54
|
+
min?: ABYSchema['minimum'];
|
|
55
|
+
max?: ABYSchema['maximum'];
|
|
56
|
+
minlength?: ABYSchema['minLength'];
|
|
57
|
+
maxlength?: ABYSchema['maxLength'];
|
|
58
|
+
title?: ABYSchema['title'];
|
|
59
|
+
description?: ABYSchema['description'];
|
|
60
|
+
isRange?: boolean;
|
|
61
|
+
isNumberValue?: boolean;
|
|
62
|
+
schemaType?: ABYSchema['type'];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* An `ErrorTransformer` function will take in a list of `errors` and potentially return a transformation of those
|
|
66
|
+
* errors in what ever way it deems necessary
|
|
67
|
+
*/
|
|
68
|
+
export type ErrorTransformer = (errors: RJSFValidationError[]) => RJSFValidationError[];
|
|
69
|
+
/** The type that describes the data that is returned from the `ValidatorType.validateFormData()` function */
|
|
70
|
+
export type ValidationData<T> = {
|
|
71
|
+
/** The validation errors as a list of `RJSFValidationError` objects */
|
|
72
|
+
errors: RJSFValidationError[];
|
|
73
|
+
/** The validation errors in the form of an `ErrorSchema` */
|
|
74
|
+
errorSchema: ErrorSchema<T>;
|
|
75
|
+
};
|
|
76
|
+
/** The type for error produced by RJSF schema validation */
|
|
77
|
+
export type RJSFValidationError = {
|
|
78
|
+
/** Name of the error, for example, "required" or "minLength" */
|
|
79
|
+
name?: string;
|
|
80
|
+
/** Message, for example, "is a required property" or "should NOT be shorter than 3 characters" */
|
|
81
|
+
message?: string;
|
|
82
|
+
/**
|
|
83
|
+
* An object with the error params returned by ajv
|
|
84
|
+
* ([see doc](https://github.com/ajv-validator/ajv/tree/6a671057ea6aae690b5967ee26a0ddf8452c6297#error-parameters)
|
|
85
|
+
* for more info)
|
|
86
|
+
*/
|
|
87
|
+
params?: any;
|
|
88
|
+
/**
|
|
89
|
+
* A string in Javascript property accessor notation to the data path of the field with the error. For example,
|
|
90
|
+
* `.name` or `['first-name']`
|
|
91
|
+
*/
|
|
92
|
+
property?: string;
|
|
93
|
+
/**
|
|
94
|
+
* JSON pointer to the schema of the keyword that failed validation. For example, `#/fields/firstName/required`.
|
|
95
|
+
* (Note: this may sometimes be wrong due to a [bug in ajv](https://github.com/ajv-validator/ajv/issues/512))
|
|
96
|
+
*/
|
|
97
|
+
schemaPath?: string;
|
|
98
|
+
/** Full error name, for example ".name is a required property" */
|
|
99
|
+
stack: string;
|
|
100
|
+
};
|
|
101
|
+
/** Type describing a recursive structure of `FieldErrors`s for an object with a non-empty set of keys */
|
|
102
|
+
export type ErrorSchema<T = any> = FieldErrors & {
|
|
103
|
+
[key in keyof T]?: ErrorSchema<T[key]>;
|
|
104
|
+
};
|
|
105
|
+
/** The type that describes an error in a field */
|
|
106
|
+
export type FieldError = string;
|
|
107
|
+
/** The type that describes the list of errors for a field */
|
|
108
|
+
export type FieldErrors = {
|
|
109
|
+
/** The list of errors for the field */
|
|
110
|
+
__errors?: FieldError[];
|
|
111
|
+
};
|
|
112
|
+
export type WidgetNames = 'CameraWidget' | 'AbyQrModule' | 'CheckboxWidget' | 'CheckboxesWidget' | 'DateWidget' | 'GeoWidget' | 'HiddenWidget' | 'RadioWidget' | 'SelectWidget' | 'SliderWidget' | 'SwitchWidget' | 'SwitchMiniWidget' | 'TagWidget' | 'TimeWidget' | 'UploadWidget' | 'hidden';
|
|
113
|
+
export type UISchema = {
|
|
114
|
+
[key: string]: UISchemaDetail;
|
|
115
|
+
};
|
|
116
|
+
export type UISchemaDetail = {
|
|
117
|
+
'ui:options'?: {
|
|
118
|
+
[uiOption: string]: any;
|
|
119
|
+
};
|
|
120
|
+
'ui:description'?: string;
|
|
121
|
+
'ui:enumNames'?: string[];
|
|
122
|
+
'ui:field'?: string;
|
|
123
|
+
'ui:hidden'?: string | boolean;
|
|
124
|
+
'ui:show'?: string | boolean;
|
|
125
|
+
'ui:title'?: string;
|
|
126
|
+
'ui:widget'?: WidgetNames;
|
|
127
|
+
'ui:disabled'?: string;
|
|
128
|
+
'ui:order'?: string[];
|
|
129
|
+
'ui:placeholder'?: string;
|
|
130
|
+
[uiProp: string]: any;
|
|
131
|
+
};
|
|
132
|
+
export type ErrSchema = {
|
|
133
|
+
[key: string]: ErrSchemaDetail;
|
|
134
|
+
};
|
|
135
|
+
export type ErrSchemaDetail = {
|
|
136
|
+
'err:options'?: {
|
|
137
|
+
[errOption: string]: any;
|
|
138
|
+
};
|
|
139
|
+
'err:required'?: boolean;
|
|
140
|
+
'err:unique'?: string;
|
|
141
|
+
[errProp: string]: any;
|
|
142
|
+
};
|
|
143
|
+
/** ********************** FormConfig */
|
|
144
|
+
export type FormConfig = {
|
|
145
|
+
formProps: FormProps;
|
|
146
|
+
formMeta: FormMeta;
|
|
147
|
+
formFooter: FormFooter;
|
|
148
|
+
};
|
|
149
|
+
export type FormFooter = {
|
|
150
|
+
cancelBtn?: string;
|
|
151
|
+
okBtn?: string;
|
|
152
|
+
show?: boolean;
|
|
153
|
+
};
|
|
154
|
+
export type FormMeta = {
|
|
155
|
+
$id?: string;
|
|
156
|
+
$schema?: string;
|
|
157
|
+
$$formtags?: string;
|
|
158
|
+
};
|
|
159
|
+
export type FormProps = {
|
|
160
|
+
title?: string;
|
|
161
|
+
description?: string;
|
|
162
|
+
backLbl?: string;
|
|
163
|
+
fwdLbl?: string;
|
|
164
|
+
inline?: boolean;
|
|
165
|
+
inlineFooter?: boolean;
|
|
166
|
+
isMiniDes?: boolean;
|
|
167
|
+
labelPosition?: 'left' | 'right' | 'top';
|
|
168
|
+
labelSuffix?: string;
|
|
169
|
+
labelWidth?: number | string;
|
|
170
|
+
layoutColumn?: number;
|
|
171
|
+
layoutSingleton?: boolean;
|
|
172
|
+
};
|
|
173
|
+
/** ********************** Main form emits */
|
|
174
|
+
export type FormChange = {
|
|
175
|
+
newValue: any;
|
|
176
|
+
oldValue: any;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* @items curVal - current value
|
|
180
|
+
* @items parentFormData - current value of parent form
|
|
181
|
+
* @items preVal - current value
|
|
182
|
+
* @items rootFormData - current value of root form, all data at root
|
|
183
|
+
*/
|
|
184
|
+
export type WidgetChange = {
|
|
185
|
+
curVal: any;
|
|
186
|
+
parentFormData: any;
|
|
187
|
+
preVal: any;
|
|
188
|
+
rootFormData: any;
|
|
189
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { ErrSchemaDetail, UISchemaDetail } from './internalScema';
|
|
2
|
+
/** Json schema with extended ui types */
|
|
3
|
+
export type ExtendedJson7 = {
|
|
4
|
+
enumNames?: string[];
|
|
5
|
+
_collapser?: ExtendedJson7;
|
|
6
|
+
$$itemRef?: string;
|
|
7
|
+
$$itemId?: string;
|
|
8
|
+
$$isSingle?: boolean;
|
|
9
|
+
$$isActive?: boolean;
|
|
10
|
+
$$isParent?: boolean;
|
|
11
|
+
$$notUniqueProperty?: boolean;
|
|
12
|
+
} & UISchemaDetail & ErrSchemaDetail & JSONSchema7;
|
|
13
|
+
/**
|
|
14
|
+
* Primitive type
|
|
15
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
16
|
+
*/
|
|
17
|
+
export type JSONSchema7TypeName = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
|
|
18
|
+
/**
|
|
19
|
+
* Primitive type
|
|
20
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
21
|
+
*/
|
|
22
|
+
export type JSONSchema7Type = string | number | boolean | JSONSchema7Object | JSONSchema7Array | null;
|
|
23
|
+
export type JSONSchema7Object = {
|
|
24
|
+
[key: string]: JSONSchema7Type;
|
|
25
|
+
};
|
|
26
|
+
export type JSONSchema7Array = Array<JSONSchema7Type>;
|
|
27
|
+
/**
|
|
28
|
+
* Meta schema
|
|
29
|
+
*
|
|
30
|
+
* Recommended values:
|
|
31
|
+
* - 'http://json-schema.org/schema#'
|
|
32
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
33
|
+
* - 'http://json-schema.org/draft-07/schema#'
|
|
34
|
+
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
35
|
+
*
|
|
36
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
37
|
+
*/
|
|
38
|
+
export type JSONSchema7Version = string;
|
|
39
|
+
/**
|
|
40
|
+
* JSON Schema v7 recursive
|
|
41
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
42
|
+
*/
|
|
43
|
+
export type JSONSchema7Definition = ExtendedJson7 | boolean;
|
|
44
|
+
export type JSONSchema7 = {
|
|
45
|
+
$id?: string | undefined;
|
|
46
|
+
$ref?: string | undefined;
|
|
47
|
+
$schema?: JSONSchema7Version | undefined;
|
|
48
|
+
$comment?: string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
51
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
52
|
+
*/
|
|
53
|
+
$defs?: {
|
|
54
|
+
[key: string]: JSONSchema7Definition;
|
|
55
|
+
} | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
58
|
+
*/
|
|
59
|
+
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
60
|
+
enum?: JSONSchema7Type[] | undefined;
|
|
61
|
+
const?: JSONSchema7Type | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
64
|
+
*/
|
|
65
|
+
multipleOf?: number | undefined;
|
|
66
|
+
maximum?: number | undefined;
|
|
67
|
+
exclusiveMaximum?: number | undefined;
|
|
68
|
+
minimum?: number | undefined;
|
|
69
|
+
exclusiveMinimum?: number | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
72
|
+
*/
|
|
73
|
+
maxLength?: number | undefined;
|
|
74
|
+
minLength?: number | undefined;
|
|
75
|
+
pattern?: string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
78
|
+
*/
|
|
79
|
+
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
80
|
+
additionalItems?: JSONSchema7Definition | undefined;
|
|
81
|
+
maxItems?: number | undefined;
|
|
82
|
+
minItems?: number | undefined;
|
|
83
|
+
uniqueItems?: boolean | undefined;
|
|
84
|
+
contains?: JSONSchema7 | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
87
|
+
*/
|
|
88
|
+
maxProperties?: number | undefined;
|
|
89
|
+
minProperties?: number | undefined;
|
|
90
|
+
required?: string[] | undefined;
|
|
91
|
+
properties?: {
|
|
92
|
+
[key: string]: JSONSchema7Definition;
|
|
93
|
+
} | undefined;
|
|
94
|
+
patternProperties?: {
|
|
95
|
+
[key: string]: JSONSchema7Definition;
|
|
96
|
+
} | undefined;
|
|
97
|
+
additionalProperties?: JSONSchema7Definition | undefined;
|
|
98
|
+
dependencies?: {
|
|
99
|
+
[key: string]: JSONSchema7Definition | string[];
|
|
100
|
+
} | undefined;
|
|
101
|
+
propertyNames?: JSONSchema7Definition | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
104
|
+
*/
|
|
105
|
+
if?: JSONSchema7Definition | undefined;
|
|
106
|
+
then?: JSONSchema7Definition | undefined;
|
|
107
|
+
else?: JSONSchema7Definition | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
110
|
+
*/
|
|
111
|
+
allOf?: JSONSchema7Definition[] | undefined;
|
|
112
|
+
anyOf?: JSONSchema7Definition[] | undefined;
|
|
113
|
+
oneOf?: JSONSchema7Definition[] | undefined;
|
|
114
|
+
not?: JSONSchema7Definition | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
117
|
+
*/
|
|
118
|
+
format?: string | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
121
|
+
*/
|
|
122
|
+
contentMediaType?: string | undefined;
|
|
123
|
+
contentEncoding?: string | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
126
|
+
*/
|
|
127
|
+
definitions?: {
|
|
128
|
+
[key: string]: JSONSchema7Definition;
|
|
129
|
+
} | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
132
|
+
*/
|
|
133
|
+
title?: string | undefined;
|
|
134
|
+
description?: string | undefined;
|
|
135
|
+
default?: JSONSchema7Type | undefined;
|
|
136
|
+
readOnly?: boolean | undefined;
|
|
137
|
+
writeOnly?: boolean | undefined;
|
|
138
|
+
examples?: JSONSchema7Type | undefined;
|
|
139
|
+
};
|
|
140
|
+
export type ValidationResult = {
|
|
141
|
+
valid: boolean;
|
|
142
|
+
errors: ValidationError[];
|
|
143
|
+
};
|
|
144
|
+
export type ValidationError = {
|
|
145
|
+
property: string;
|
|
146
|
+
message: string;
|
|
147
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@datadayrepos/json-schema-types",
|
|
3
|
+
"version": "0.0.1-beta.12",
|
|
4
|
+
"private": false,
|
|
5
|
+
"packageManager": "pnpm@8.9.0",
|
|
6
|
+
"description": "Types used for json schema render and editors",
|
|
7
|
+
"author": "Ivar Strand",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"homepage": "https://github.com/abyrint/json-schema-types#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/abyrint/json-schema-types.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/abyrint/json-schema-types/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"json-schema",
|
|
19
|
+
"types"
|
|
20
|
+
],
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"lint": "eslint --cache .",
|
|
27
|
+
"lint:fix": "eslint . --fix",
|
|
28
|
+
"release": "bumpp -r && pnpm -r publish",
|
|
29
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"build": "tsc --emitDeclarationOnly",
|
|
32
|
+
"pub": "npm publish --access public"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@datadayrepos/eslint-config": "^1.0.1-beta.11",
|
|
36
|
+
"@datadayrepos/eslint-plugin-datadayrepos": "1.0.0-Beta12",
|
|
37
|
+
"@datadayrepos/ni": "^0.21.8",
|
|
38
|
+
"@types/node": "^20.8.3",
|
|
39
|
+
"eslint": "^8.51.0",
|
|
40
|
+
"eslint-plugin-sort-keys": "^2.3.5",
|
|
41
|
+
"lint-staged": "^14.0.1",
|
|
42
|
+
"pnpm": "^8.8.0",
|
|
43
|
+
"typescript": "^5.2.2"
|
|
44
|
+
},
|
|
45
|
+
"lint-staged": {
|
|
46
|
+
"*.{js,ts,tsx,vue,md}": [
|
|
47
|
+
"eslint --cache --fix"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|