@allgemein/schema-api 1.7.1 → 1.8.1
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/README.md +104 -1
- package/api/IBaseRef.d.ts +2 -2
- package/api/IBaseRef.js +1 -2
- package/api/IBuildOptions.d.ts +2 -2
- package/api/IBuildOptions.js +1 -2
- package/api/IClassRef.d.ts +5 -5
- package/api/IClassRef.js +3 -6
- package/api/IClassRef.js.map +1 -1
- package/api/IEntityRef.d.ts +5 -5
- package/api/IEntityRef.js +3 -6
- package/api/IEntityRef.js.map +1 -1
- package/api/IJsonSchema.d.ts +4 -4
- package/api/IJsonSchema.js +3 -8
- package/api/IJsonSchema.js.map +1 -1
- package/api/ILookupRegistry.d.ts +6 -6
- package/api/ILookupRegistry.js +6 -9
- package/api/ILookupRegistry.js.map +1 -1
- package/api/IPropertyExtentions.d.ts +1 -1
- package/api/IPropertyExtentions.js +1 -2
- package/api/IPropertyExtentions.js.map +1 -1
- package/api/IPropertyRef.d.ts +3 -3
- package/api/IPropertyRef.js +3 -6
- package/api/IPropertyRef.js.map +1 -1
- package/api/ISchemaRef.d.ts +2 -2
- package/api/ISchemaRef.js +1 -2
- package/api/ISerializeSupport.d.ts +4 -4
- package/api/ISerializeSupport.js +3 -8
- package/api/ISerializeSupport.js.map +1 -1
- package/browser.d.ts +65 -65
- package/browser.js +43 -112
- package/browser.js.map +1 -1
- package/decorators/Embeddable.d.ts +1 -1
- package/decorators/Embeddable.js +4 -7
- package/decorators/Embeddable.js.map +1 -1
- package/decorators/Entity.d.ts +1 -1
- package/decorators/Entity.js +4 -7
- package/decorators/Entity.js.map +1 -1
- package/decorators/Namespace.js +7 -10
- package/decorators/Namespace.js.map +1 -1
- package/decorators/Property.d.ts +1 -1
- package/decorators/Property.js +20 -23
- package/decorators/Property.js.map +1 -1
- package/decorators/PropertyOf.d.ts +1 -1
- package/decorators/PropertyOf.js +6 -9
- package/decorators/PropertyOf.js.map +1 -1
- package/decorators/Schema.d.ts +1 -1
- package/decorators/Schema.js +4 -7
- package/decorators/Schema.js.map +1 -1
- package/decorators/validate/Hostname.d.ts +2 -3
- package/decorators/validate/Hostname.js +12 -16
- package/decorators/validate/Hostname.js.map +1 -1
- package/decorators/validate/Ip4.d.ts +1 -1
- package/decorators/validate/Ip4.js +11 -15
- package/decorators/validate/Ip4.js.map +1 -1
- package/decorators/validate/Ip6.d.ts +2 -3
- package/decorators/validate/Ip6.js +12 -15
- package/decorators/validate/Ip6.js.map +1 -1
- package/decorators/validate/IsEmail.d.ts +2 -3
- package/decorators/validate/IsEmail.js +10 -14
- package/decorators/validate/IsEmail.js.map +1 -1
- package/decorators/validate/IsNotEmpty.d.ts +1 -1
- package/decorators/validate/IsNotEmpty.js +11 -14
- package/decorators/validate/IsNotEmpty.js.map +1 -1
- package/decorators/validate/MaxLength.d.ts +1 -1
- package/decorators/validate/MaxLength.js +9 -12
- package/decorators/validate/MaxLength.js.map +1 -1
- package/decorators/validate/MinLength.d.ts +1 -1
- package/decorators/validate/MinLength.js +9 -12
- package/decorators/validate/MinLength.js.map +1 -1
- package/decorators/validate/Regex.d.ts +1 -1
- package/decorators/validate/Regex.js +10 -13
- package/decorators/validate/Regex.js.map +1 -1
- package/decorators/validate/Required.d.ts +1 -1
- package/decorators/validate/Required.js +9 -12
- package/decorators/validate/Required.js.map +1 -1
- package/decorators/validate/index.d.ts +8 -8
- package/decorators/validate/index.js +9 -19
- package/decorators/validate/index.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -17
- package/index.js.map +1 -1
- package/lib/AbstractRef.d.ts +4 -4
- package/lib/AbstractRef.js +29 -33
- package/lib/AbstractRef.js.map +1 -1
- package/lib/AnnotationsHelper.d.ts +2 -2
- package/lib/AnnotationsHelper.js +32 -36
- package/lib/AnnotationsHelper.js.map +1 -1
- package/lib/ClassRef.d.ts +7 -7
- package/lib/ClassRef.js +69 -73
- package/lib/ClassRef.js.map +1 -1
- package/lib/Constants.d.ts +1 -3
- package/lib/Constants.js +42 -45
- package/lib/Constants.js.map +1 -1
- package/lib/DataContainer.d.ts +6 -6
- package/lib/DataContainer.js +20 -25
- package/lib/DataContainer.js.map +1 -1
- package/lib/LookupRegistry.js +13 -17
- package/lib/LookupRegistry.js.map +1 -1
- package/lib/SchemaRef.d.ts +7 -7
- package/lib/SchemaRef.js +11 -15
- package/lib/SchemaRef.js.map +1 -1
- package/lib/SchemaUtils.d.ts +3 -3
- package/lib/SchemaUtils.js +23 -27
- package/lib/SchemaUtils.js.map +1 -1
- package/lib/functions.d.ts +2 -2
- package/lib/functions.js +7 -10
- package/lib/functions.js.map +1 -1
- package/lib/json-schema/Constants.js +3 -6
- package/lib/json-schema/Constants.js.map +1 -1
- package/lib/json-schema/IJsonSchemaSerializeOptions.d.ts +4 -4
- package/lib/json-schema/IJsonSchemaSerializeOptions.js +1 -2
- package/lib/json-schema/IJsonSchemaSerializer.d.ts +3 -3
- package/lib/json-schema/IJsonSchemaSerializer.js +1 -2
- package/lib/json-schema/IJsonSchemaUnserializeOptions.d.ts +3 -3
- package/lib/json-schema/IJsonSchemaUnserializeOptions.js +1 -2
- package/lib/json-schema/IJsonSchemaUnserializer.d.ts +1 -1
- package/lib/json-schema/IJsonSchemaUnserializer.js +1 -2
- package/lib/json-schema/IParseOptions.d.ts +2 -2
- package/lib/json-schema/IParseOptions.js +1 -4
- package/lib/json-schema/IParseOptions.js.map +1 -1
- package/lib/json-schema/JsonSchema.d.ts +10 -10
- package/lib/json-schema/JsonSchema.js +26 -30
- package/lib/json-schema/JsonSchema.js.map +1 -1
- package/lib/json-schema/JsonSchema7.d.ts +2 -2
- package/lib/json-schema/JsonSchema7.js +3 -8
- package/lib/json-schema/JsonSchema7.js.map +1 -1
- package/lib/json-schema/JsonSchema7Serializer.d.ts +9 -9
- package/lib/json-schema/JsonSchema7Serializer.js +96 -100
- package/lib/json-schema/JsonSchema7Serializer.js.map +1 -1
- package/lib/json-schema/JsonSchema7Unserializer.d.ts +12 -12
- package/lib/json-schema/JsonSchema7Unserializer.js +99 -103
- package/lib/json-schema/JsonSchema7Unserializer.js.map +1 -1
- package/lib/json-schema/functions.d.ts +2 -2
- package/lib/json-schema/functions.js +8 -12
- package/lib/json-schema/functions.js.map +1 -1
- package/lib/options/IAbstractOptions.d.ts +1 -1
- package/lib/options/IAbstractOptions.js +1 -2
- package/lib/options/IAttributeOptions.d.ts +2 -2
- package/lib/options/IAttributeOptions.js +1 -2
- package/lib/options/IEntityOptions.d.ts +2 -2
- package/lib/options/IEntityOptions.js +1 -2
- package/lib/options/INamedOptions.js +1 -2
- package/lib/options/IObjectOptions.d.ts +2 -2
- package/lib/options/IObjectOptions.js +1 -2
- package/lib/options/IPropertyOptions.d.ts +2 -2
- package/lib/options/IPropertyOptions.js +1 -2
- package/lib/options/ISchemaOptions.d.ts +2 -2
- package/lib/options/ISchemaOptions.js +1 -2
- package/lib/registry/AbstractRegistry.d.ts +8 -8
- package/lib/registry/AbstractRegistry.js +19 -23
- package/lib/registry/AbstractRegistry.js.map +1 -1
- package/lib/registry/Binding.d.ts +1 -1
- package/lib/registry/Binding.js +2 -6
- package/lib/registry/Binding.js.map +1 -1
- package/lib/registry/DefaultEntityRef.d.ts +9 -9
- package/lib/registry/DefaultEntityRef.js +10 -14
- package/lib/registry/DefaultEntityRef.js.map +1 -1
- package/lib/registry/DefaultNamespacedRegistry.d.ts +14 -14
- package/lib/registry/DefaultNamespacedRegistry.js +123 -127
- package/lib/registry/DefaultNamespacedRegistry.js.map +1 -1
- package/lib/registry/DefaultPropertyRef.d.ts +7 -7
- package/lib/registry/DefaultPropertyRef.js +42 -46
- package/lib/registry/DefaultPropertyRef.js.map +1 -1
- package/lib/registry/IRegistryOptions.js +1 -2
- package/lib/registry/MetadataRegistry.d.ts +10 -10
- package/lib/registry/MetadataRegistry.js +30 -36
- package/lib/registry/MetadataRegistry.js.map +1 -1
- package/lib/registry/RegistryFactory.d.ts +3 -3
- package/lib/registry/RegistryFactory.js +19 -25
- package/lib/registry/RegistryFactory.js.map +1 -1
- package/lib/serializer/ISerializeOptions.js +1 -2
- package/lib/serializer/ISerializer.d.ts +2 -2
- package/lib/serializer/ISerializer.js +1 -2
- package/lib/serializer/ISerializerFactory.d.ts +6 -6
- package/lib/serializer/ISerializerFactory.js +1 -2
- package/lib/serializer/IUnserializeOptions.js +1 -2
- package/lib/serializer/IUnserializer.d.ts +2 -2
- package/lib/serializer/IUnserializer.js +1 -2
- package/lib/serializer/SerializerRegistry.d.ts +1 -1
- package/lib/serializer/SerializerRegistry.js +3 -7
- package/lib/serializer/SerializerRegistry.js.map +1 -1
- package/lib/validation/DefaultValidator.d.ts +5 -5
- package/lib/validation/DefaultValidator.js +33 -37
- package/lib/validation/DefaultValidator.js.map +1 -1
- package/lib/validation/IValidateOptions.js +1 -2
- package/lib/validation/IValidationError.js +1 -2
- package/lib/validation/IValidationMessage.js +1 -2
- package/lib/validation/IValidationOptions.d.ts +1 -0
- package/lib/validation/IValidationOptions.js +1 -0
- package/lib/validation/IValidationOptions.js.map +1 -1
- package/lib/validation/IValidationResult.d.ts +1 -1
- package/lib/validation/IValidationResult.js +1 -2
- package/lib/validation/IValidator.d.ts +1 -1
- package/lib/validation/IValidator.js +1 -2
- package/lib/validation/IValidatorEntry.d.ts +1 -1
- package/lib/validation/IValidatorEntry.js +1 -2
- package/lib/validation/IValidatorHandle.js +1 -2
- package/lib/validation/Validator.d.ts +4 -4
- package/lib/validation/Validator.js +7 -11
- package/lib/validation/Validator.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const base_1 = require("@allgemein/base");
|
|
8
|
-
const JsonSchema7Unserializer_1 = require("./JsonSchema7Unserializer");
|
|
9
|
-
class JsonSchema {
|
|
1
|
+
import { defaults, get, isString } from '@allgemein/base';
|
|
2
|
+
import { JsonSchema7Serializer } from './JsonSchema7Serializer.js';
|
|
3
|
+
import { DRAFT_07, JSON_SCHEMA_SERIALIZER } from './Constants.js';
|
|
4
|
+
import { PlatformUtils } from '@allgemein/base';
|
|
5
|
+
import { JsonSchema7Unserializer } from './JsonSchema7Unserializer.js';
|
|
6
|
+
export class JsonSchema {
|
|
10
7
|
static async request(addr, opts = {}) {
|
|
11
8
|
try {
|
|
12
9
|
if (addr.startsWith('file:///')) {
|
|
13
|
-
const buffer = await
|
|
14
|
-
const strValue = buffer.toString(
|
|
10
|
+
const buffer = await PlatformUtils.readFile(addr.replace('file://', ''));
|
|
11
|
+
const strValue = buffer.toString(get(opts, 'encoding', 'utf8'));
|
|
15
12
|
return JSON.parse(strValue);
|
|
16
13
|
}
|
|
17
14
|
else if (addr.startsWith('.')) {
|
|
18
15
|
const cwd = opts.cwd ? opts.cwd : process.cwd();
|
|
19
|
-
const path =
|
|
20
|
-
const buffer = await
|
|
21
|
-
const strValue = buffer.toString(
|
|
16
|
+
const path = PlatformUtils.join(cwd, addr);
|
|
17
|
+
const buffer = await PlatformUtils.readFile(path);
|
|
18
|
+
const strValue = buffer.toString(get(opts, 'encoding', 'utf8'));
|
|
22
19
|
return JSON.parse(strValue);
|
|
23
20
|
}
|
|
24
|
-
else if (
|
|
25
|
-
const buffer = await
|
|
26
|
-
const strValue = buffer.toString(
|
|
21
|
+
else if (PlatformUtils.isAbsolute(addr)) {
|
|
22
|
+
const buffer = await PlatformUtils.readFile(addr);
|
|
23
|
+
const strValue = buffer.toString(get(opts, 'encoding', 'utf8'));
|
|
27
24
|
return JSON.parse(strValue);
|
|
28
25
|
}
|
|
29
26
|
else {
|
|
30
|
-
const got =
|
|
27
|
+
const got = PlatformUtils.load('got');
|
|
31
28
|
const response = await got(addr, opts);
|
|
32
29
|
return JSON.parse(response.body);
|
|
33
30
|
}
|
|
@@ -37,21 +34,21 @@ class JsonSchema {
|
|
|
37
34
|
return {};
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
|
-
static getSerializer(options = { version:
|
|
37
|
+
static getSerializer(options = { version: DRAFT_07 }) {
|
|
41
38
|
options = options || {};
|
|
42
|
-
|
|
39
|
+
defaults(options, { version: DRAFT_07 });
|
|
43
40
|
switch (options.version) {
|
|
44
|
-
case
|
|
45
|
-
return new
|
|
41
|
+
case DRAFT_07:
|
|
42
|
+
return new JsonSchema7Serializer(options);
|
|
46
43
|
}
|
|
47
44
|
return null;
|
|
48
45
|
}
|
|
49
|
-
static getUnserializer(options = { version:
|
|
46
|
+
static getUnserializer(options = { version: DRAFT_07 }) {
|
|
50
47
|
options = options || {};
|
|
51
|
-
|
|
48
|
+
defaults(options, { version: DRAFT_07 });
|
|
52
49
|
switch (options.version) {
|
|
53
|
-
case
|
|
54
|
-
return new
|
|
50
|
+
case DRAFT_07:
|
|
51
|
+
return new JsonSchema7Unserializer(options);
|
|
55
52
|
}
|
|
56
53
|
return null;
|
|
57
54
|
}
|
|
@@ -66,9 +63,9 @@ class JsonSchema {
|
|
|
66
63
|
const serializer = this.getUnserializer(options);
|
|
67
64
|
return serializer.unserialize(data);
|
|
68
65
|
}
|
|
69
|
-
static detectSchemaVersion(schema, fallback =
|
|
66
|
+
static detectSchemaVersion(schema, fallback = DRAFT_07) {
|
|
70
67
|
if (schema['$schema']) {
|
|
71
|
-
if (
|
|
68
|
+
if (isString(schema['$schema'])) {
|
|
72
69
|
const match = schema['$schema'].match(/json-schema.org\/(.*)\/schema/);
|
|
73
70
|
if (match && match[1]) {
|
|
74
71
|
return match[1];
|
|
@@ -78,7 +75,7 @@ class JsonSchema {
|
|
|
78
75
|
return fallback;
|
|
79
76
|
}
|
|
80
77
|
getName() {
|
|
81
|
-
return
|
|
78
|
+
return JSON_SCHEMA_SERIALIZER;
|
|
82
79
|
}
|
|
83
80
|
getSerializer(options) {
|
|
84
81
|
return JsonSchema.getSerializer(options);
|
|
@@ -93,5 +90,4 @@ class JsonSchema {
|
|
|
93
90
|
return JsonSchema.unserialize(data, options);
|
|
94
91
|
}
|
|
95
92
|
}
|
|
96
|
-
exports.JsonSchema = JsonSchema;
|
|
97
93
|
//# sourceMappingURL=JsonSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonSchema.js","sourceRoot":"","sources":["../../../../src/lib/json-schema/JsonSchema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JsonSchema.js","sourceRoot":"","sources":["../../../../src/lib/json-schema/JsonSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAIxD,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAAC,QAAQ,EAAE,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAMrE,MAAM,OAAO,UAAU;IAGrB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,IAAI,GAAQ,EAAE;QAC/C,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBAChC,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;gBACzE,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;gBAChE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC9B,CAAC;iBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,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AAC,CAAC,EAAE,CAAC;gBAChC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBACvE,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;oBACtB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO;QACL,OAAO,sBAAsB,CAAC;IAChC,CAAC;IAED,aAAa,CAAC,OAAqC;QACjD,OAAO,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,eAAe,CAAC,OAAuC;QACrD,OAAO,UAAU,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS,CAAC,KAAiD,EAAE,OAAqC;QAChG,OAAO,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,WAAW,CAAC,IAAY,EAAE,OAAuC;QAC/D,OAAO,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;CAGF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
|
-
import { IClassRef } from '../../api/IClassRef';
|
|
3
|
-
import { IEntityRef } from '../../api/IEntityRef';
|
|
2
|
+
import { IClassRef } from '../../api/IClassRef.js';
|
|
3
|
+
import { IEntityRef } from '../../api/IEntityRef.js';
|
|
4
4
|
export interface IJsonSchema7 extends JSONSchema7 {
|
|
5
5
|
$target?: Function | IClassRef | IEntityRef;
|
|
6
6
|
definitions?: {
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSON_SCHEMA_7_TYPES = void 0;
|
|
4
|
-
exports.hasClassInDefinition = hasClassInDefinition;
|
|
5
|
-
exports.hasClassPropertiesInDefinition = hasClassPropertiesInDefinition;
|
|
6
|
-
exports.JSON_SCHEMA_7_TYPES = [
|
|
1
|
+
export const JSON_SCHEMA_7_TYPES = [
|
|
7
2
|
'string',
|
|
8
3
|
'number',
|
|
9
4
|
'integer',
|
|
@@ -12,10 +7,10 @@ exports.JSON_SCHEMA_7_TYPES = [
|
|
|
12
7
|
'array',
|
|
13
8
|
'null'
|
|
14
9
|
];
|
|
15
|
-
function hasClassInDefinition(name, def) {
|
|
10
|
+
export function hasClassInDefinition(name, def) {
|
|
16
11
|
return def && def.definitions && def.definitions[name];
|
|
17
12
|
}
|
|
18
|
-
function hasClassPropertiesInDefinition(name, def) {
|
|
13
|
+
export function hasClassPropertiesInDefinition(name, def) {
|
|
19
14
|
return hasClassInDefinition(name, def) && def.definitions[name].properties;
|
|
20
15
|
}
|
|
21
16
|
//# sourceMappingURL=JsonSchema7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonSchema7.js","sourceRoot":"","sources":["../../../../src/lib/json-schema/JsonSchema7.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JsonSchema7.js","sourceRoot":"","sources":["../../../../src/lib/json-schema/JsonSchema7.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,QAAQ;IACN,QAAQ;IACR,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;IACP,MAAM;CACT,CAAC;AAGF,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,GAAiB;IAClE,OAAO,GAAG,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,IAAY,EAAE,GAAiB;IAC5E,OAAO,oBAAoB,CAAC,IAAI,EAAE,GAAG,CAAC,IAAK,GAAG,CAAC,WAAW,CAAC,IAAI,CAAkB,CAAC,UAAU,CAAC;AAC/F,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IJsonSchema7, IJsonSchema7Definition } from './JsonSchema7';
|
|
2
|
-
import { IClassRef } from '../../api/IClassRef';
|
|
3
|
-
import { IPropertyRef } from '../../api/IPropertyRef';
|
|
4
|
-
import { IJsonSchemaSerializer } from './IJsonSchemaSerializer';
|
|
5
|
-
import { IEntityRef } from '../../api/IEntityRef';
|
|
6
|
-
import { IJsonSchemaSerializeOptions } from './IJsonSchemaSerializeOptions';
|
|
7
|
-
import { IEntityOptions } from '../options/IEntityOptions';
|
|
8
|
-
import { IPropertyOptions } from '../options/IPropertyOptions';
|
|
1
|
+
import { IJsonSchema7, IJsonSchema7Definition } from './JsonSchema7.js';
|
|
2
|
+
import { IClassRef } from '../../api/IClassRef.js';
|
|
3
|
+
import { IPropertyRef } from '../../api/IPropertyRef.js';
|
|
4
|
+
import { IJsonSchemaSerializer } from './IJsonSchemaSerializer.js';
|
|
5
|
+
import { IEntityRef } from '../../api/IEntityRef.js';
|
|
6
|
+
import { IJsonSchemaSerializeOptions } from './IJsonSchemaSerializeOptions.js';
|
|
7
|
+
import { IEntityOptions } from '../options/IEntityOptions.js';
|
|
8
|
+
import { IPropertyOptions } from '../options/IPropertyOptions.js';
|
|
9
9
|
export declare class JsonSchema7Serializer implements IJsonSchemaSerializer {
|
|
10
10
|
options: IJsonSchemaSerializeOptions;
|
|
11
11
|
data: IJsonSchema7;
|
|
@@ -32,7 +32,7 @@ export declare class JsonSchema7Serializer implements IJsonSchemaSerializer {
|
|
|
32
32
|
describePropertiesForRef(klass: IClassRef): {
|
|
33
33
|
[k: string]: IJsonSchema7Definition;
|
|
34
34
|
};
|
|
35
|
-
isAppendTargetSet():
|
|
35
|
+
isAppendTargetSet(): any;
|
|
36
36
|
describePropertyForFunction(klass: Function | IClassRef, propertyName: string, instance?: any): IJsonSchema7Definition;
|
|
37
37
|
appendAdditionalOptions(propMeta: any, data: IEntityOptions | IPropertyOptions): void;
|
|
38
38
|
/**
|