@tsed/schema 6.107.5 → 6.110.0
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/jest.config.js +2 -2
- package/lib/cjs/constants/httpStatusMessages.js +1 -1
- package/lib/cjs/constants/httpStatusMessages.js.map +1 -1
- package/lib/cjs/domain/JsonClassStore.js +1 -1
- package/lib/cjs/domain/JsonMethodStore.js +2 -2
- package/lib/cjs/domain/JsonOperation.js +8 -8
- package/lib/cjs/domain/JsonOperation.js.map +1 -1
- package/lib/cjs/domain/JsonParameterStore.js +2 -2
- package/lib/cjs/domain/JsonPropertyStore.js +1 -1
- package/lib/cjs/domain/JsonSchema.js +43 -43
- package/lib/cjs/domain/JsonSchema.js.map +1 -1
- package/lib/cjs/index.js +146 -146
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/generateSpec.js +2 -2
- package/lib/cjs/utils/generateSpec.js.map +1 -1
- package/lib/cjs/utils/matchGroups.js +1 -1
- package/lib/cjs/utils/matchGroups.js.map +1 -1
- package/package.json +15 -11
package/jest.config.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getStatusMessage = exports.getStatusConstant = exports.HTTP_STATUS_MESSAGES = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const statuses_1 =
|
|
5
|
+
const statuses_1 = tslib_1.__importDefault(require("statuses"));
|
|
6
6
|
const change_case_1 = require("change-case");
|
|
7
7
|
exports.HTTP_STATUS_MESSAGES = statuses_1.default.codes.reduce((map, code) => {
|
|
8
8
|
const message = String((0, statuses_1.default)(code));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpStatusMessages.js","sourceRoot":"","sources":["../../../src/constants/httpStatusMessages.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"httpStatusMessages.js","sourceRoot":"","sources":["../../../src/constants/httpStatusMessages.ts"],"names":[],"mappings":";;;;AAAA,gEAAgC;AAChC,6CAAyC;AAE5B,QAAA,oBAAoB,GAAG,kBAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAkD,EAAE,IAAY,EAAE,EAAE;IAC7H,MAAM,OAAO,GAAW,MAAM,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,OAAO;QACL,GAAG,GAAG;QACN,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAA,0BAAY,EAAC,OAAO,CAAC,EAAC;KAC9D,CAAC;AACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AAEP,4BAAoB,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC;AAC9C,4BAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC;AAE7C,SAAgB,iBAAiB,CAAC,MAAuB;;IACvD,OAAO,MAAC,4BAA4B,CAAC,MAAM,CAAC,0CAAE,IAAI,CAAC;AACrD,CAAC;AAFD,8CAEC;AAED,SAAgB,gBAAgB,CAAC,MAAuB;;IACtD,OAAO,MAAC,4BAA4B,CAAC,MAAM,CAAC,0CAAE,KAAK,CAAC;AACtD,CAAC;AAFD,4CAEC","sourcesContent":["import statuses from \"statuses\";\nimport {constantCase} from \"change-case\";\n\nexport const HTTP_STATUS_MESSAGES = statuses.codes.reduce((map: Record<string, {label: string; code: string}>, code: number) => {\n const message: string = String(statuses(code));\n return {\n ...map,\n [String(code)]: {label: message, code: constantCase(message)}\n };\n}, {});\n\nHTTP_STATUS_MESSAGES[\"200\"].label = \"Success\";\nHTTP_STATUS_MESSAGES[\"200\"].code = \"SUCCESS\";\n\nexport function getStatusConstant(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.code;\n}\n\nexport function getStatusMessage(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.label;\n}\n"]}
|
|
@@ -30,7 +30,7 @@ let JsonClassStore = class JsonClassStore extends JsonEntityStore_1.JsonEntitySt
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
JsonClassStore =
|
|
33
|
+
JsonClassStore = tslib_1.__decorate([
|
|
34
34
|
(0, jsonEntityComponent_1.JsonEntityComponent)(core_1.DecoratorTypes.CLASS)
|
|
35
35
|
], JsonClassStore);
|
|
36
36
|
exports.JsonClassStore = JsonClassStore;
|
|
@@ -128,9 +128,9 @@ let JsonMethodStore = class JsonMethodStore extends JsonEntityStore_1.JsonEntity
|
|
|
128
128
|
return JsonEntityStore_1.JsonEntityStore.from((0, core_1.prototypeOf)(target), propertyKey, descriptor);
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
|
-
JsonMethodStore =
|
|
131
|
+
JsonMethodStore = tslib_1.__decorate([
|
|
132
132
|
(0, jsonEntityComponent_1.JsonEntityComponent)(core_1.DecoratorTypes.METHOD),
|
|
133
|
-
|
|
133
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
134
134
|
], JsonMethodStore);
|
|
135
135
|
exports.JsonMethodStore = JsonMethodStore;
|
|
136
136
|
exports.EndpointMetadata = JsonMethodStore;
|
|
@@ -22,7 +22,7 @@ class JsonOperation extends JsonMap_1.JsonMap {
|
|
|
22
22
|
return this.getResponses().get(this.getStatus().toString());
|
|
23
23
|
}
|
|
24
24
|
get status() {
|
|
25
|
-
return
|
|
25
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonOperation_status, "f");
|
|
26
26
|
}
|
|
27
27
|
tags(tags) {
|
|
28
28
|
super.set("tags", tags);
|
|
@@ -45,27 +45,27 @@ class JsonOperation extends JsonMap_1.JsonMap {
|
|
|
45
45
|
return this;
|
|
46
46
|
}
|
|
47
47
|
defaultStatus(status) {
|
|
48
|
-
|
|
48
|
+
tslib_1.__classPrivateFieldSet(this, _JsonOperation_status, status, "f");
|
|
49
49
|
return this;
|
|
50
50
|
}
|
|
51
51
|
getStatus() {
|
|
52
|
-
return
|
|
52
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonOperation_status, "f") || 200;
|
|
53
53
|
}
|
|
54
54
|
setRedirection(status = 302) {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
tslib_1.__classPrivateFieldSet(this, _JsonOperation_redirection, true, "f");
|
|
56
|
+
tslib_1.__classPrivateFieldSet(this, _JsonOperation_status, status, "f");
|
|
57
57
|
return this;
|
|
58
58
|
}
|
|
59
59
|
isRedirection(status) {
|
|
60
|
-
if (
|
|
60
|
+
if (tslib_1.__classPrivateFieldGet(this, _JsonOperation_redirection, "f")) {
|
|
61
61
|
if (status) {
|
|
62
62
|
return (0, isSuccessStatus_1.isRedirectionStatus)(status);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonOperation_redirection, "f");
|
|
66
66
|
}
|
|
67
67
|
addResponse(statusCode, response) {
|
|
68
|
-
if (((0, isSuccessStatus_1.isSuccessStatus)(statusCode) || (0, isSuccessStatus_1.isRedirectionStatus)(statusCode)) && !
|
|
68
|
+
if (((0, isSuccessStatus_1.isSuccessStatus)(statusCode) || (0, isSuccessStatus_1.isRedirectionStatus)(statusCode)) && !tslib_1.__classPrivateFieldGet(this, _JsonOperation_status, "f")) {
|
|
69
69
|
const res = this.getResponseOf(200);
|
|
70
70
|
this.getResponses().set(statusCode.toString(), res).delete("200");
|
|
71
71
|
this.defaultStatus(Number(statusCode));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonOperation.js","sourceRoot":"","sources":["../../../src/domain/JsonOperation.ts"],"names":[],"mappings":";;;;;AAAA,qCAAmD;AAEnD,wEAAiE;AAGjE,8DAA8E;AAC9E,uCAAkC;AAElC,6DAAyE;AACzE,uDAAkD;AAClD,iDAA4C;AAC5C,6CAAwC;AAexC,MAAa,aAAc,SAAQ,iBAA6B;IAK9D,YAAY,MAA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I;aACzB,CACF,CAAC;YAEF,IAAI,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;gBAC7B,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aAC1B;YAED,WAAW,EAAE,CAAC;SACf;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,WAAW,EAAE;QAChB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;SAChB;KACF;IAED,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEtB,OAAO,EAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAC,CAAC;AACrE,CAAC","sourcesContent":["import {deepMerge, uniq, uniqBy} from \"@tsed/core\";\nimport {OpenSpecSecurity, OpenSpecTag, OS3Operation} from \"@tsed/openspec\";\nimport {getStatusMessage} from \"../constants/httpStatusMessages\";\nimport {JsonHeader} from \"../interfaces/JsonOpenSpec\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {isRedirectionStatus, isSuccessStatus} from \"../utils/isSuccessStatus\";\nimport {JsonMap} from \"./JsonMap\";\nimport {JsonParameter} from \"./JsonParameter\";\nimport {isParameterType, JsonParameterTypes} from \"./JsonParameterTypes\";\nimport {JsonRequestBody} from \"./JsonRequestBody\";\nimport {JsonResponse} from \"./JsonResponse\";\nimport {JsonSchema} from \"./JsonSchema\";\n\nexport interface JsonMethodPath {\n path: string | RegExp;\n method: string;\n isFinal?: boolean;\n\n [key: string]: any;\n}\n\nexport interface JsonOperationOptions extends OS3Operation<JsonSchema, JsonParameter, JsonMap<JsonResponse>> {\n consumes: string[];\n produces: string[];\n}\n\nexport class JsonOperation extends JsonMap<JsonOperationOptions> {\n readonly operationPaths: Map<string, JsonMethodPath> = new Map();\n #status: number;\n #redirection: boolean = false;\n\n constructor(obj: Partial<JsonOperationOptions> = {}) {\n super({parameters: [], responses: new JsonMap(), ...obj});\n }\n\n get response(): JsonResponse | undefined {\n return this.getResponses().get(this.getStatus().toString());\n }\n\n get status() {\n return this.#status;\n }\n\n tags(tags: OpenSpecTag[]): this {\n super.set(\"tags\", tags);\n\n return this;\n }\n\n addTags(tags: OpenSpecTag[]) {\n tags = uniqBy([...(this.get(\"tags\") || []), ...tags], \"name\");\n\n return this.tags(tags);\n }\n\n summary(summary: string): this {\n super.set(\"summary\", summary);\n\n return this;\n }\n\n operationId(operationId: string): this {\n this.set(\"operationId\", operationId);\n\n return this;\n }\n\n responses(responses: JsonMap<any>): this {\n this.set(\"responses\", responses);\n\n return this;\n }\n\n defaultStatus(status: number) {\n this.#status = status;\n\n return this;\n }\n\n getStatus() {\n return this.#status || 200;\n }\n\n setRedirection(status = 302) {\n this.#redirection = true;\n this.#status = status;\n return this;\n }\n\n isRedirection(status?: number) {\n if (this.#redirection) {\n if (status) {\n return isRedirectionStatus(status);\n }\n }\n\n return this.#redirection;\n }\n\n addResponse(statusCode: string | number, response: JsonResponse) {\n if ((isSuccessStatus(statusCode) || isRedirectionStatus(statusCode)) && !this.#status) {\n const res = this.getResponseOf(200);\n\n this.getResponses().set(statusCode.toString(), res).delete(\"200\");\n\n this.defaultStatus(Number(statusCode));\n }\n\n const currentCode = statusCode === \"default\" ? this.getStatus().toString() : statusCode.toString();\n const currentResponse = this.getResponses().get(currentCode);\n\n if (!currentResponse) {\n response.status = Number(currentCode);\n this.getResponses().set(currentCode, response);\n } else {\n response.forEach((value, key) => {\n if (![\"content\"].includes(key)) {\n currentResponse.set(key, deepMerge(currentResponse.get(key), value));\n }\n });\n currentResponse.status = Number(currentCode);\n }\n\n return this;\n }\n\n getResponses() {\n return this.get(\"responses\") as JsonMap<JsonResponse>;\n }\n\n getResponseOf(status: number | string): JsonResponse {\n return (status === \"default\" ? this.response : this.getResponses().get(String(status))) || new JsonResponse();\n }\n\n ensureResponseOf(status: number | string): JsonResponse {\n this.addResponse(status, this.getResponseOf(status));\n return this.getResponseOf(status);\n }\n\n getHeadersOf(status: number): Record<string, JsonHeader & {example: string}> {\n return this.getResponseOf(status).get(\"headers\") || {};\n }\n\n getContentTypeOf(status: number): any {\n return [...this.getResponseOf(status).get(\"content\").keys()].slice(-1)[0];\n }\n\n security(security: OpenSpecSecurity): this {\n this.set(\"security\", security);\n\n return this;\n }\n\n addSecurityScopes(name: string, scopes: string[]) {\n const security = this.get(\"security\") || {};\n security[name] = uniq([...(security[name] || []), ...scopes]);\n\n return this.security(security);\n }\n\n description(description: string): this {\n super.set(\"description\", description);\n\n return this;\n }\n\n deprecated(deprecated: boolean): this {\n super.set(\"deprecated\", deprecated);\n\n return this;\n }\n\n parameters(parameters: JsonParameter[]): this {\n super.set(\"parameters\", parameters);\n\n return this;\n }\n\n addParameter(index: number, parameter: JsonParameter) {\n if (index === -1) {\n index = this.get(\"parameters\").length;\n }\n this.get(\"parameters\")[index] = parameter;\n }\n\n consumes(consumes: string[]): this {\n super.set(\"consumes\", consumes);\n\n return this;\n }\n\n produces(produces: string[]): this {\n super.set(\"produces\", produces);\n\n return this;\n }\n\n addProduce(produce: string) {\n const produces = uniq([].concat(this.get(\"produces\"), produce as never)).filter(Boolean);\n\n this.set(\"produces\", produces);\n }\n\n addOperationPath(method: string, path: string | RegExp, options: any = {}) {\n this.operationPaths.set(String(method) + String(path), {\n ...options,\n method,\n path\n });\n\n return this;\n }\n\n toJSON(options: JsonSchemaOptions = {}): any {\n const operation = super.toJSON({...options, ignore: [\"parameters\"]});\n const bodyParameters: JsonParameter[] = [];\n const parameters: any[] = [];\n\n if (operation.security) {\n operation.security = [].concat(operation.security);\n }\n\n this.get(\"parameters\").forEach((parameter: JsonParameter) => {\n if (!isParameterType(this.get(\"in\"))) {\n if (parameter.get(\"in\")) {\n if ([JsonParameterTypes.BODY, JsonParameterTypes.FILES].includes(parameter.get(\"in\"))) {\n bodyParameters.push(parameter);\n } else {\n parameters.push(...[].concat(parameter.toJSON(options)));\n }\n }\n }\n });\n\n operation.parameters = parameters.filter(Boolean);\n\n if (this.get(\"responses\").size === 0) {\n operation.responses = {\n \"200\": {\n description: getStatusMessage(200)\n }\n };\n }\n\n if (bodyParameters.length) {\n const parameter = buildSchemaFromBodyParameters(bodyParameters, options);\n operation.requestBody = toRequestBody(this, parameter).toJSON(options);\n }\n\n delete operation.consumes;\n delete operation.produces;\n\n return operation;\n }\n}\n\nfunction toRequestBody(operation: JsonOperation, {schema, in: _, ...props}: any) {\n const requestBody = new JsonRequestBody(props);\n\n const consumes = operation.get(\"consumes\")?.length ? operation.get(\"consumes\") : [\"application/json\"];\n\n consumes.forEach((consume: string) => {\n requestBody.addContent(consume, schema);\n });\n\n return requestBody;\n}\n\nfunction buildSchemaFromBodyParameters(parameters: JsonParameter[], options: JsonSchemaOptions) {\n let schema = new JsonSchema();\n const props: any = {};\n const refs: JsonSchema[] = [];\n let propsLength = 0;\n\n parameters.forEach((parameter) => {\n const name = parameter.getName();\n\n Array.from(parameter.entries())\n .filter(([key]) => ![\"in\", \"name\"].includes(key))\n .forEach(([key, value]) => {\n if (props[key] === undefined) {\n props[key] = value;\n }\n });\n\n const jsonParameter = parameter.toJSON(options);\n\n if (name) {\n schema.addProperty(\n name,\n jsonParameter.schema || {\n type: jsonParameter.type\n }\n );\n\n if (parameter.get(\"required\")) {\n schema.addRequired(name);\n }\n\n propsLength++;\n } else {\n refs.push(jsonParameter);\n }\n });\n\n if (!propsLength) {\n if (refs.length === 1) {\n return refs[0];\n }\n }\n\n schema.type(\"object\");\n\n return {schema: schema.toJSON(options), required: false, ...props};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"JsonOperation.js","sourceRoot":"","sources":["../../../src/domain/JsonOperation.ts"],"names":[],"mappings":";;;;;AAAA,qCAAmD;AAEnD,wEAAiE;AAGjE,8DAA8E;AAC9E,uCAAkC;AAElC,6DAAy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R,MAAM,CAAC,WAAW,CAChB,IAAI,EACJ,aAAa,CAAC,MAAM,IAAI;gBACtB,IAAI,EAAE,aAAa,CAAC,IAAI;aACzB,CACF,CAAC;YAEF,IAAI,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;gBAC7B,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aAC1B;YAED,WAAW,EAAE,CAAC;SACf;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,WAAW,EAAE;QAChB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;SAChB;KACF;IAED,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEtB,OAAO,EAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAC,CAAC;AACrE,CAAC","sourcesContent":["import {deepMerge, uniq, uniqBy} from \"@tsed/core\";\nimport {OpenSpecSecurity, OpenSpecTag, OS3Operation} from \"@tsed/openspec\";\nimport {getStatusMessage} from \"../constants/httpStatusMessages\";\nimport {JsonHeader} from \"../interfaces/JsonOpenSpec\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {isRedirectionStatus, isSuccessStatus} from \"../utils/isSuccessStatus\";\nimport {JsonMap} from \"./JsonMap\";\nimport {JsonParameter} from \"./JsonParameter\";\nimport {isParameterType, JsonParameterTypes} from \"./JsonParameterTypes\";\nimport {JsonRequestBody} from \"./JsonRequestBody\";\nimport {JsonResponse} from \"./JsonResponse\";\nimport {JsonSchema} from \"./JsonSchema\";\n\nexport interface JsonMethodPath {\n path: string | RegExp;\n method: string;\n isFinal?: boolean;\n\n [key: string]: any;\n}\n\nexport interface JsonOperationOptions extends OS3Operation<JsonSchema, JsonParameter, JsonMap<JsonResponse>> {\n consumes: string[];\n produces: string[];\n}\n\nexport class JsonOperation extends JsonMap<JsonOperationOptions> {\n readonly operationPaths: Map<string, JsonMethodPath> = new Map();\n #status: number;\n #redirection: boolean = false;\n\n constructor(obj: Partial<JsonOperationOptions> = {}) {\n super({parameters: [], responses: new JsonMap(), ...obj});\n }\n\n get response(): JsonResponse | undefined {\n return this.getResponses().get(this.getStatus().toString());\n }\n\n get status() {\n return this.#status;\n }\n\n tags(tags: OpenSpecTag[]): this {\n super.set(\"tags\", tags);\n\n return this;\n }\n\n addTags(tags: OpenSpecTag[]) {\n tags = uniqBy([...(this.get(\"tags\") || []), ...tags], \"name\");\n\n return this.tags(tags);\n }\n\n summary(summary: string): this {\n super.set(\"summary\", summary);\n\n return this;\n }\n\n operationId(operationId: string): this {\n this.set(\"operationId\", operationId);\n\n return this;\n }\n\n responses(responses: JsonMap<any>): this {\n this.set(\"responses\", responses);\n\n return this;\n }\n\n defaultStatus(status: number) {\n this.#status = status;\n\n return this;\n }\n\n getStatus() {\n return this.#status || 200;\n }\n\n setRedirection(status = 302) {\n this.#redirection = true;\n this.#status = status;\n return this;\n }\n\n isRedirection(status?: number) {\n if (this.#redirection) {\n if (status) {\n return isRedirectionStatus(status);\n }\n }\n\n return this.#redirection;\n }\n\n addResponse(statusCode: string | number, response: JsonResponse) {\n if ((isSuccessStatus(statusCode) || isRedirectionStatus(statusCode)) && !this.#status) {\n const res = this.getResponseOf(200);\n\n this.getResponses().set(statusCode.toString(), res).delete(\"200\");\n\n this.defaultStatus(Number(statusCode));\n }\n\n const currentCode = statusCode === \"default\" ? this.getStatus().toString() : statusCode.toString();\n const currentResponse = this.getResponses().get(currentCode);\n\n if (!currentResponse) {\n response.status = Number(currentCode);\n this.getResponses().set(currentCode, response);\n } else {\n response.forEach((value, key) => {\n if (![\"content\"].includes(key)) {\n currentResponse.set(key, deepMerge(currentResponse.get(key), value));\n }\n });\n currentResponse.status = Number(currentCode);\n }\n\n return this;\n }\n\n getResponses() {\n return this.get(\"responses\") as JsonMap<JsonResponse>;\n }\n\n getResponseOf(status: number | string): JsonResponse {\n return (status === \"default\" ? this.response : this.getResponses().get(String(status))) || new JsonResponse();\n }\n\n ensureResponseOf(status: number | string): JsonResponse {\n this.addResponse(status, this.getResponseOf(status));\n return this.getResponseOf(status);\n }\n\n getHeadersOf(status: number): Record<string, JsonHeader & {example: string}> {\n return this.getResponseOf(status).get(\"headers\") || {};\n }\n\n getContentTypeOf(status: number): any {\n return [...this.getResponseOf(status).get(\"content\").keys()].slice(-1)[0];\n }\n\n security(security: OpenSpecSecurity): this {\n this.set(\"security\", security);\n\n return this;\n }\n\n addSecurityScopes(name: string, scopes: string[]) {\n const security = this.get(\"security\") || {};\n security[name] = uniq([...(security[name] || []), ...scopes]);\n\n return this.security(security);\n }\n\n description(description: string): this {\n super.set(\"description\", description);\n\n return this;\n }\n\n deprecated(deprecated: boolean): this {\n super.set(\"deprecated\", deprecated);\n\n return this;\n }\n\n parameters(parameters: JsonParameter[]): this {\n super.set(\"parameters\", parameters);\n\n return this;\n }\n\n addParameter(index: number, parameter: JsonParameter) {\n if (index === -1) {\n index = this.get(\"parameters\").length;\n }\n this.get(\"parameters\")[index] = parameter;\n }\n\n consumes(consumes: string[]): this {\n super.set(\"consumes\", consumes);\n\n return this;\n }\n\n produces(produces: string[]): this {\n super.set(\"produces\", produces);\n\n return this;\n }\n\n addProduce(produce: string) {\n const produces = uniq([].concat(this.get(\"produces\"), produce as never)).filter(Boolean);\n\n this.set(\"produces\", produces);\n }\n\n addOperationPath(method: string, path: string | RegExp, options: any = {}) {\n this.operationPaths.set(String(method) + String(path), {\n ...options,\n method,\n path\n });\n\n return this;\n }\n\n toJSON(options: JsonSchemaOptions = {}): any {\n const operation = super.toJSON({...options, ignore: [\"parameters\"]});\n const bodyParameters: JsonParameter[] = [];\n const parameters: any[] = [];\n\n if (operation.security) {\n operation.security = [].concat(operation.security);\n }\n\n this.get(\"parameters\").forEach((parameter: JsonParameter) => {\n if (!isParameterType(this.get(\"in\"))) {\n if (parameter.get(\"in\")) {\n if ([JsonParameterTypes.BODY, JsonParameterTypes.FILES].includes(parameter.get(\"in\"))) {\n bodyParameters.push(parameter);\n } else {\n parameters.push(...[].concat(parameter.toJSON(options)));\n }\n }\n }\n });\n\n operation.parameters = parameters.filter(Boolean);\n\n if (this.get(\"responses\").size === 0) {\n operation.responses = {\n \"200\": {\n description: getStatusMessage(200)\n }\n };\n }\n\n if (bodyParameters.length) {\n const parameter = buildSchemaFromBodyParameters(bodyParameters, options);\n operation.requestBody = toRequestBody(this, parameter).toJSON(options);\n }\n\n delete operation.consumes;\n delete operation.produces;\n\n return operation;\n }\n}\n\nfunction toRequestBody(operation: JsonOperation, {schema, in: _, ...props}: any) {\n const requestBody = new JsonRequestBody(props);\n\n const consumes = operation.get(\"consumes\")?.length ? operation.get(\"consumes\") : [\"application/json\"];\n\n consumes.forEach((consume: string) => {\n requestBody.addContent(consume, schema);\n });\n\n return requestBody;\n}\n\nfunction buildSchemaFromBodyParameters(parameters: JsonParameter[], options: JsonSchemaOptions) {\n let schema = new JsonSchema();\n const props: any = {};\n const refs: JsonSchema[] = [];\n let propsLength = 0;\n\n parameters.forEach((parameter) => {\n const name = parameter.getName();\n\n Array.from(parameter.entries())\n .filter(([key]) => ![\"in\", \"name\"].includes(key))\n .forEach(([key, value]) => {\n if (props[key] === undefined) {\n props[key] = value;\n }\n });\n\n const jsonParameter = parameter.toJSON(options);\n\n if (name) {\n schema.addProperty(\n name,\n jsonParameter.schema || {\n type: jsonParameter.type\n }\n );\n\n if (parameter.get(\"required\")) {\n schema.addRequired(name);\n }\n\n propsLength++;\n } else {\n refs.push(jsonParameter);\n }\n });\n\n if (!propsLength) {\n if (refs.length === 1) {\n return refs[0];\n }\n }\n\n schema.type(\"object\");\n\n return {schema: schema.toJSON(options), required: false, ...props};\n}\n"]}
|
|
@@ -90,9 +90,9 @@ let JsonParameterStore = class JsonParameterStore extends JsonEntityStore_1.Json
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
JsonParameterStore =
|
|
93
|
+
JsonParameterStore = tslib_1.__decorate([
|
|
94
94
|
(0, jsonEntityComponent_1.JsonEntityComponent)(core_1.DecoratorTypes.PARAM),
|
|
95
|
-
|
|
95
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
96
96
|
], JsonParameterStore);
|
|
97
97
|
exports.JsonParameterStore = JsonParameterStore;
|
|
98
98
|
exports.ParamMetadata = JsonParameterStore;
|
|
@@ -64,7 +64,7 @@ let JsonPropertyStore = class JsonPropertyStore extends JsonEntityStore_1.JsonEn
|
|
|
64
64
|
return JsonEntityStore_1.JsonEntityStore.from((0, core_1.prototypeOf)(target), propertyKey);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
JsonPropertyStore =
|
|
67
|
+
JsonPropertyStore = tslib_1.__decorate([
|
|
68
68
|
(0, jsonEntityComponent_1.JsonEntityComponent)(core_1.DecoratorTypes.PROP)
|
|
69
69
|
], JsonPropertyStore);
|
|
70
70
|
exports.JsonPropertyStore = JsonPropertyStore;
|
|
@@ -57,34 +57,34 @@ class JsonSchema extends Map {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
get alias() {
|
|
60
|
-
return
|
|
60
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_alias, "f");
|
|
61
61
|
}
|
|
62
62
|
get nestedGenerics() {
|
|
63
|
-
return
|
|
63
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_nestedGenerics, "f");
|
|
64
64
|
}
|
|
65
65
|
set nestedGenerics(value) {
|
|
66
|
-
|
|
66
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_nestedGenerics, value, "f");
|
|
67
67
|
}
|
|
68
68
|
get genericLabels() {
|
|
69
|
-
return
|
|
69
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_genericLabels, "f");
|
|
70
70
|
}
|
|
71
71
|
set genericLabels(value) {
|
|
72
|
-
|
|
72
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_genericLabels, value, "f");
|
|
73
73
|
}
|
|
74
74
|
get isClass() {
|
|
75
|
-
return (0, core_1.isClass)(this.class) && ![Map, Array, Set, Object, Date, Boolean, Number, String].includes(
|
|
75
|
+
return (0, core_1.isClass)(this.class) && ![Map, Array, Set, Object, Date, Boolean, Number, String].includes(tslib_1.__classPrivateFieldGet(this, _JsonSchema_target, "f"));
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Current schema is a collection
|
|
79
79
|
*/
|
|
80
80
|
get isCollection() {
|
|
81
|
-
return
|
|
81
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_isCollection, "f");
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Current schema is a generic
|
|
85
85
|
*/
|
|
86
86
|
get isGeneric() {
|
|
87
|
-
return
|
|
87
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_isGeneric, "f");
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Current schema has generics items
|
|
@@ -99,10 +99,10 @@ class JsonSchema extends Map {
|
|
|
99
99
|
return this.getComputedType();
|
|
100
100
|
}
|
|
101
101
|
get canRef() {
|
|
102
|
-
return
|
|
102
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_ref, "f");
|
|
103
103
|
}
|
|
104
104
|
get isNullable() {
|
|
105
|
-
return
|
|
105
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_nullable, "f") || this.$allow.includes(null);
|
|
106
106
|
}
|
|
107
107
|
get isReadOnly() {
|
|
108
108
|
return this.get("readOnly");
|
|
@@ -114,25 +114,25 @@ class JsonSchema extends Map {
|
|
|
114
114
|
return new JsonSchema(obj);
|
|
115
115
|
}
|
|
116
116
|
nullable(value) {
|
|
117
|
-
|
|
117
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_nullable, value, "f");
|
|
118
118
|
}
|
|
119
119
|
itemSchema(obj = {}) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return
|
|
120
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_itemSchema, tslib_1.__classPrivateFieldGet(this, _JsonSchema_itemSchema, "f") || mapToJsonSchema(obj), "f");
|
|
121
|
+
tslib_1.__classPrivateFieldGet(this, _JsonSchema_itemSchema, "f").assign(obj);
|
|
122
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_itemSchema, "f");
|
|
123
123
|
}
|
|
124
124
|
getAliasOf(property) {
|
|
125
|
-
return
|
|
125
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_alias, "f").get(property);
|
|
126
126
|
}
|
|
127
127
|
addAlias(property, alias) {
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
tslib_1.__classPrivateFieldGet(this, _JsonSchema_alias, "f").set(property, alias);
|
|
129
|
+
tslib_1.__classPrivateFieldGet(this, _JsonSchema_alias, "f").set(alias, property);
|
|
130
130
|
return this;
|
|
131
131
|
}
|
|
132
132
|
removeAlias(property) {
|
|
133
|
-
const alias =
|
|
134
|
-
alias &&
|
|
135
|
-
|
|
133
|
+
const alias = tslib_1.__classPrivateFieldGet(this, _JsonSchema_alias, "f").get(property);
|
|
134
|
+
alias && tslib_1.__classPrivateFieldGet(this, _JsonSchema_alias, "f").delete(alias);
|
|
135
|
+
tslib_1.__classPrivateFieldGet(this, _JsonSchema_alias, "f").delete(property);
|
|
136
136
|
return this;
|
|
137
137
|
}
|
|
138
138
|
$id($id) {
|
|
@@ -152,7 +152,7 @@ class JsonSchema extends Map {
|
|
|
152
152
|
* @param name
|
|
153
153
|
*/
|
|
154
154
|
label(name) {
|
|
155
|
-
|
|
155
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_ref, true, "f");
|
|
156
156
|
super.set("name", name);
|
|
157
157
|
return this;
|
|
158
158
|
}
|
|
@@ -236,7 +236,7 @@ class JsonSchema extends Map {
|
|
|
236
236
|
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9
|
|
237
237
|
*/
|
|
238
238
|
items(items) {
|
|
239
|
-
super.set("items", (
|
|
239
|
+
super.set("items", (tslib_1.__classPrivateFieldSet(this, _JsonSchema_itemSchema, mapToJsonSchema(items), "f")));
|
|
240
240
|
return this;
|
|
241
241
|
}
|
|
242
242
|
/**
|
|
@@ -522,24 +522,24 @@ class JsonSchema extends Map {
|
|
|
522
522
|
switch (type) {
|
|
523
523
|
case Map:
|
|
524
524
|
super.set("type", (0, getJsonType_1.getJsonType)(type));
|
|
525
|
-
|
|
526
|
-
|
|
525
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_target, type, "f");
|
|
526
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_isCollection, true, "f");
|
|
527
527
|
if (!this.has("additionalProperties")) {
|
|
528
528
|
super.set("additionalProperties", this.itemSchema({}));
|
|
529
529
|
}
|
|
530
530
|
break;
|
|
531
531
|
case Array:
|
|
532
532
|
super.set("type", (0, getJsonType_1.getJsonType)(type));
|
|
533
|
-
|
|
534
|
-
|
|
533
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_target, type, "f");
|
|
534
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_isCollection, true, "f");
|
|
535
535
|
if (!this.has("items")) {
|
|
536
536
|
super.set("items", this.itemSchema({}));
|
|
537
537
|
}
|
|
538
538
|
break;
|
|
539
539
|
case Set:
|
|
540
540
|
super.set("type", (0, getJsonType_1.getJsonType)(type));
|
|
541
|
-
|
|
542
|
-
|
|
541
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_target, type, "f");
|
|
542
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_isCollection, true, "f");
|
|
543
543
|
this.uniqueItems(true);
|
|
544
544
|
if (!this.has("items")) {
|
|
545
545
|
super.set("items", this.itemSchema({}));
|
|
@@ -555,7 +555,7 @@ class JsonSchema extends Map {
|
|
|
555
555
|
case Number:
|
|
556
556
|
case String:
|
|
557
557
|
super.set("type", (0, getJsonType_1.getJsonType)(type));
|
|
558
|
-
|
|
558
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_target, type, "f");
|
|
559
559
|
if (!this.has("properties")) {
|
|
560
560
|
super.set("properties", {});
|
|
561
561
|
}
|
|
@@ -563,7 +563,7 @@ class JsonSchema extends Map {
|
|
|
563
563
|
default:
|
|
564
564
|
if ((0, core_1.isClass)(type) || (0, core_1.isFunction)(type)) {
|
|
565
565
|
super.set("type", undefined);
|
|
566
|
-
|
|
566
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_target, type, "f");
|
|
567
567
|
if (!this.has("properties")) {
|
|
568
568
|
super.set("properties", {});
|
|
569
569
|
}
|
|
@@ -571,7 +571,7 @@ class JsonSchema extends Map {
|
|
|
571
571
|
else {
|
|
572
572
|
const jsonType = (0, getJsonType_1.getJsonType)(type);
|
|
573
573
|
if (jsonType === "generic") {
|
|
574
|
-
|
|
574
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_isGeneric, true, "f");
|
|
575
575
|
super.set("$ref", type);
|
|
576
576
|
}
|
|
577
577
|
else {
|
|
@@ -660,14 +660,14 @@ class JsonSchema extends Map {
|
|
|
660
660
|
obj.$required.forEach((key) => {
|
|
661
661
|
this.$required.add(key);
|
|
662
662
|
});
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
663
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_ref, tslib_1.__classPrivateFieldGet(obj, _JsonSchema_ref, "f"), "f");
|
|
664
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_alias, new Map(tslib_1.__classPrivateFieldGet(this, _JsonSchema_alias, "f").entries()), "f");
|
|
665
|
+
tslib_1.__classPrivateFieldGet(obj, _JsonSchema_genericLabels, "f") && (tslib_1.__classPrivateFieldSet(this, _JsonSchema_genericLabels, [...tslib_1.__classPrivateFieldGet(obj, _JsonSchema_genericLabels, "f")], "f"));
|
|
666
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_nestedGenerics, tslib_1.__classPrivateFieldGet(obj, _JsonSchema_nestedGenerics, "f").map((item) => [...item]), "f");
|
|
667
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_target, tslib_1.__classPrivateFieldGet(obj, _JsonSchema_target, "f"), "f");
|
|
668
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_isGeneric, tslib_1.__classPrivateFieldGet(obj, _JsonSchema_isGeneric, "f"), "f");
|
|
669
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_isCollection, tslib_1.__classPrivateFieldGet(obj, _JsonSchema_isCollection, "f"), "f");
|
|
670
|
+
tslib_1.__classPrivateFieldSet(this, _JsonSchema_ref, tslib_1.__classPrivateFieldGet(obj, _JsonSchema_ref, "f"), "f");
|
|
671
671
|
super.set("type", obj.get("type"));
|
|
672
672
|
}
|
|
673
673
|
return this;
|
|
@@ -687,10 +687,10 @@ class JsonSchema extends Map {
|
|
|
687
687
|
* the function will be called to get the right type.
|
|
688
688
|
*/
|
|
689
689
|
getComputedType() {
|
|
690
|
-
return (0, getComputedType_1.getComputedType)(
|
|
690
|
+
return (0, getComputedType_1.getComputedType)(tslib_1.__classPrivateFieldGet(this, _JsonSchema_target, "f"));
|
|
691
691
|
}
|
|
692
692
|
getComputedItemType() {
|
|
693
|
-
return
|
|
693
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_itemSchema, "f") ? tslib_1.__classPrivateFieldGet(this, _JsonSchema_itemSchema, "f").getComputedType() : this.getComputedType();
|
|
694
694
|
}
|
|
695
695
|
/**
|
|
696
696
|
* Return the Json type as string
|
|
@@ -699,13 +699,13 @@ class JsonSchema extends Map {
|
|
|
699
699
|
return this.get("type") || (0, getJsonType_1.getJsonType)(this.getComputedType());
|
|
700
700
|
}
|
|
701
701
|
getTarget() {
|
|
702
|
-
return
|
|
702
|
+
return tslib_1.__classPrivateFieldGet(this, _JsonSchema_target, "f");
|
|
703
703
|
}
|
|
704
704
|
/**
|
|
705
705
|
* Get the symbolic name of the entity
|
|
706
706
|
*/
|
|
707
707
|
getName() {
|
|
708
|
-
return this.get("name") || (
|
|
708
|
+
return this.get("name") || (tslib_1.__classPrivateFieldGet(this, _JsonSchema_target, "f") ? (0, core_1.nameOf)((0, core_1.classOf)(this.getComputedType())) : "");
|
|
709
709
|
}
|
|
710
710
|
clone() {
|
|
711
711
|
return new JsonSchema(this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonSchema.js","sourceRoot":"","sources":["../../../src/domain/JsonSchema.ts"],"names":[],"mappings":";;;;;AAAA,qCAA+G;AAI/G,uFAAmE;AAEnE,8DAAyD;AACzD,sDAAiD;AACjD,sDAAiD;AAIjD,uDAAkD;AAClD,sEAAiE;AAWjE,SAAS,aAAa,CAAC,UAA+B;IACpD,uBAAuB;IACvB,IAAI,UAAU,YAAY,UAAU,EAAE;QACpC,OAAO,UAAU,CAAC;KACnB;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAM,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE;QAC1E,UAAU,CAAC,IAAA,yBAAW,EAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QAEvD,OAAO,UAAU,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED,SAAS,eAAe,CAAC,IAAS;IAChC,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QACjB,OAAQ,IAAc,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;KAC7C;IAED,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,SAAS,EAAE;QACvD,OAAO,IAAI,CAAC;KACb;IAED,IAAI,IAAA,cAAO,EAAC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I,8BAAY,CAAC,CAAC,CAAC,oCAAA,IAAI,8BAAY,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IACxF,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAA,yBAAW,EAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,SAAS;QACP,OAAO,oCAAA,IAAI,0BAAQ,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAA,IAAI,0BAAQ,CAAC,CAAC,CAAC,IAAA,aAAM,EAAC,IAAA,cAAO,EAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,KAAK;QACH,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF;AAh1BD,gCAg1BC","sourcesContent":["import {classOf, Hooks, isArray, isClass, isFunction, isObject, nameOf, Type, uniq, ValueOf} from \"@tsed/core\";\nimport type {JSONSchema6, JSONSchema6Definition, JSONSchema6Type, JSONSchema6TypeName, JSONSchema6Version} from \"json-schema\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {IgnoreCallback} from \"../interfaces/IgnoreCallback\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {NestedGenerics} from \"../utils/generics\";\nimport {getComputedType} from \"../utils/getComputedType\";\nimport {getJsonType} from \"../utils/getJsonType\";\nimport {toJsonRegex} from \"../utils/toJsonRegex\";\nimport {AliasMap, AliasType} from \"./JsonAliasMap\";\nimport {JsonFormatTypes} from \"./JsonFormatTypes\";\nimport {JsonLazyRef} from \"./JsonLazyRef\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\nimport {serializeEnumValues} from \"../utils/serializeEnumValues\";\n\nexport interface JsonSchemaObject extends JSONSchema6, Record<string, any> {\n type: (any | JSONSchema6TypeName) | (any | JSONSchema6TypeName)[];\n additionalProperties?: boolean | JSONSchema6 | any;\n propertyNames?: boolean | JSONSchema6 | any;\n items?: (any | JSONSchema6Definition) | (any | JSONSchema6Definition)[];\n}\n\nexport type AnyJsonSchema = Partial<JsonSchemaObject> | JsonSchema | JsonLazyRef | any;\n\nfunction mapProperties(properties: Record<string, any>) {\n // istanbul ignore next\n if (properties instanceof JsonSchema) {\n return properties;\n }\n\n return Object.entries(properties).reduce<any>((properties, [key, schema]) => {\n properties[toJsonRegex(key)] = mapToJsonSchema(schema);\n\n return properties;\n }, {});\n}\n\nfunction mapToJsonSchema(item: any): any {\n if (isArray(item)) {\n return (item as any[]).map(mapToJsonSchema);\n }\n\n if (item.isStore || item.isJsonSchema || item.isLazyRef) {\n return item;\n }\n\n if (classOf(item) !== Object && isClass(item)) {\n return JsonEntityStore.from(item).schema;\n }\n\n if (isObject(item)) {\n return JsonSchema.from(item as any);\n }\n\n return item;\n}\n\nexport class JsonSchema extends Map<string, any> implements NestedGenerics {\n readonly isJsonSchema = true;\n readonly $hooks = new Hooks();\n readonly $required: Set<string> = new Set();\n readonly $allow: any[] = [];\n public $selfRequired: boolean;\n public $forwardGroups: boolean = false;\n\n #nullable: boolean = false;\n #genericLabels: string[];\n #nestedGenerics: Type<any>[][] = [];\n #alias: AliasMap = new Map();\n #itemSchema: JsonSchema;\n #target: Type<any>;\n #isGeneric: boolean = false;\n #isCollection: boolean = false;\n #ref: boolean = false;\n\n constructor(obj: JsonSchema | Partial<JsonSchemaObject> = {}) {\n super();\n\n if (obj) {\n this.assign(obj);\n }\n }\n\n get alias() {\n return this.#alias;\n }\n\n get nestedGenerics(): any[] {\n return this.#nestedGenerics;\n }\n\n set nestedGenerics(value: any[]) {\n this.#nestedGenerics = value;\n }\n\n get genericLabels(): string[] {\n return this.#genericLabels;\n }\n\n set genericLabels(value: string[]) {\n this.#genericLabels = value;\n }\n\n get isClass() {\n return isClass(this.class) && ![Map, Array, Set, Object, Date, Boolean, Number, String].includes(this.#target as any);\n }\n\n /**\n * Current schema is a collection\n */\n get isCollection() {\n return this.#isCollection;\n }\n\n /**\n * Current schema is a generic\n */\n get isGeneric() {\n return this.#isGeneric;\n }\n\n /**\n * Current schema has generics items\n */\n get hasGenerics(): boolean {\n return !!(this.nestedGenerics && this.nestedGenerics.length);\n }\n\n get genericType(): string {\n return this.get(\"$ref\");\n }\n\n get class() {\n return this.getComputedType();\n }\n\n get canRef(): boolean {\n return this.#ref;\n }\n\n get isNullable(): boolean {\n return this.#nullable || this.$allow.includes(null);\n }\n\n get isReadOnly() {\n return this.get(\"readOnly\");\n }\n\n get isWriteOnly() {\n return this.get(\"writeOnly\");\n }\n\n static from(obj: Partial<JsonSchemaObject> = {}) {\n return new JsonSchema(obj);\n }\n\n nullable(value: boolean) {\n this.#nullable = value;\n }\n\n itemSchema(obj: AnyJsonSchema = {}) {\n this.#itemSchema = this.#itemSchema || mapToJsonSchema(obj);\n this.#itemSchema.assign(obj);\n\n return this.#itemSchema;\n }\n\n getAliasOf(property: AliasType) {\n return this.#alias.get(property as any);\n }\n\n addAlias(property: AliasType, alias: AliasType) {\n this.#alias.set(property, alias);\n this.#alias.set(alias, property);\n\n return this;\n }\n\n removeAlias(property: AliasType) {\n const alias = this.#alias.get(property);\n alias && this.#alias.delete(alias);\n this.#alias.delete(property);\n\n return this;\n }\n\n $id($id: string) {\n super.set(\"$id\", $id);\n\n return this;\n }\n\n $ref($ref: string) {\n super.set(\"$ref\", $ref);\n\n return this;\n }\n\n $schema($schema: JSONSchema6Version) {\n super.set(\"$schema\", $schema);\n\n return this;\n }\n\n /**\n * Create a ref and use name to sharing schema\n * @param name\n */\n label(name: string) {\n this.#ref = true;\n\n super.set(\"name\", name);\n\n return this;\n }\n\n name(name: string) {\n super.set(\"name\", name);\n\n return this;\n }\n\n ignore(cb: boolean | IgnoreCallback) {\n if (typeof cb === \"boolean\") {\n const bool = cb;\n cb = () => bool;\n }\n\n this.$hooks.on(\"ignore\", cb);\n\n return this;\n }\n\n /**\n * This keyword can be used to supply a default JSON value associated with a particular schema.\n * It is RECOMMENDED that a default value be valid against the associated schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3\n */\n default(value: JSONSchema6Type) {\n super.set(\"default\", value);\n\n return this;\n }\n\n /**\n * More readible form of a one-element \"enum\"\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24\n */\n const(value: JSONSchema6Type) {\n super.set(\"const\", value);\n\n return this;\n }\n\n /**\n * This attribute is a string that provides a full description of the of purpose the instance property.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2\n */\n description(description: string) {\n super.set(\"description\", description);\n\n return this;\n }\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n * If \"items\" is an array of schemas, validation succeeds if every instance element\n * at a position greater than the size of \"items\" validates against \"additionalItems\".\n * Otherwise, \"additionalItems\" MUST be ignored, as the \"items\" schema\n * (possibly the default value of an empty schema) is applied to all elements.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10\n */\n additionalItems(additionalItems: boolean | AnyJsonSchema) {\n super.set(\"additionalItems\", mapToJsonSchema(additionalItems));\n\n return this;\n }\n\n /**\n * An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14\n */\n contains(contains: JSONSchema6Definition) {\n super.set(\"contains\", mapToJsonSchema(contains));\n\n return this;\n }\n\n /**\n * Array of examples with no validation effect the value of \"default\" is usable as an example without repeating it under this keyword\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4\n */\n examples(examples: JSONSchema6Type[]) {\n super.set(\"examples\", examples);\n\n return this;\n }\n\n /**\n * Array of examples with no validation effect the value of \"default\" is usable as an example without repeating it under this keyword\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4\n */\n example(...examples: JSONSchema6Type[]) {\n return this.examples(examples);\n }\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9\n */\n items(items: AnyJsonSchema | AnyJsonSchema[]) {\n super.set(\"items\", (this.#itemSchema = mapToJsonSchema(items)));\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An array instance is valid against \"maxItems\" if its size is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11\n */\n maxItems(maxItems: number) {\n super.set(\"maxItems\", maxItems);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An array instance is valid against \"maxItems\" if its size is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12\n */\n minItems(minItems: number) {\n super.set(\"minItems\", minItems);\n\n return this;\n }\n\n /**\n * If this keyword has boolean value false, the instance validates successfully.\n * If it has boolean value true, the instance validates successfully if all of its elements are unique.\n * Omitting this keyword has the same behavior as a value of false.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13\n */\n uniqueItems(uniqueItems: boolean) {\n super.set(\"uniqueItems\", uniqueItems);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An object instance is valid against \"maxProperties\" if its number of properties is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15\n */\n maxProperties(maxProperties: number) {\n super.set(\"maxProperties\", maxProperties);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An object instance is valid against \"maxProperties\" if its number of properties is greater than,\n * or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16\n */\n minProperties(minProperties: number) {\n super.set(\"minProperties\", minProperties);\n\n return this;\n }\n\n allow(...allow: any[]) {\n this.$allow.push(...allow);\n return this;\n }\n\n /**\n * Elements of this array must be unique.\n * An object instance is valid against this keyword if every item in the array is the name of a property in the instance.\n * Omitting this keyword has the same behavior as an empty array.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17\n */\n required(required: boolean | string[] = true) {\n if (isArray(required)) {\n this.$required.clear();\n\n required.forEach((value: any) => this.$required.add(value));\n } else {\n const schema = this.clone();\n schema.$selfRequired = required;\n return schema;\n }\n\n return this;\n }\n\n addRequired(property: string) {\n this.$required.add(property);\n\n return this;\n }\n\n removeRequired(property: string) {\n this.$required.delete(property);\n\n return this;\n }\n\n isRequired(property: string): boolean {\n return this.$required.has(property);\n }\n\n /**\n * This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.\n * Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value,\n * the child instance for that name successfully validates against the corresponding schema.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18\n */\n properties(properties: AnyJsonSchema | Record<string, AnyJsonSchema>) {\n super.set(\"properties\", mapProperties(properties));\n\n return this;\n }\n\n addProperty(key: string, schema: AnyJsonSchema) {\n const properties = this.get(\"properties\") || {};\n\n properties[key] = schema;\n\n super.set(\"properties\", mapProperties(properties));\n\n return this;\n }\n\n /**\n * This attribute is an object that defines the schema for a set of property names of an object instance.\n * The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema.\n * If the pattern matches the name of a property on the instance object, the value of the instance's property\n * MUST be valid against the pattern name's schema value.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19\n */\n patternProperties(patternProperties: Record<string, AnyJsonSchema>) {\n super.set(\"patternProperties\", mapProperties(patternProperties));\n\n return this;\n }\n\n /**\n * This attribute defines a schema for all properties that are not explicitly defined in an object type definition.\n * If specified, the value MUST be a schema or a boolean.\n * If false is provided, no additional properties are allowed beyond the properties defined in the schema.\n * The default value is an empty schema which allows any value for additional properties.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20\n */\n additionalProperties(additionalProperties: boolean | AnyJsonSchema) {\n super.set(\"additionalProperties\", mapToJsonSchema(additionalProperties));\n\n return this;\n }\n\n /**\n * This attribute defines a schema for all properties that are not explicitly defined in an object type definition.\n * If specified, the value MUST be a schema or a boolean.\n * If false is provided, no additional properties are allowed beyond the properties defined in the schema.\n * The default value is an empty schema which allows any value for additional properties.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20\n * @alias additionalProperties\n * @param unknown\n */\n unknown(unknown: boolean = true) {\n return this.additionalProperties(unknown);\n }\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.\n * Each property specifies a dependency.\n * If the dependency value is an array, each element in the array must be unique.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21\n */\n dependencies(dependencies: {[p: string]: JSONSchema6Definition | JsonSchema | string[]}) {\n super.set(\"dependencies\", mapProperties(dependencies));\n\n return this;\n }\n\n /**\n * Takes a schema which validates the names of all properties rather than their values.\n * Note the property name that the schema is testing will always be a string.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22\n */\n propertyNames(propertyNames: JSONSchema6Definition | JsonSchema) {\n super.set(\"propertyNames\", mapToJsonSchema(propertyNames));\n\n return this;\n }\n\n /**\n * This provides an enumeration of all possible values that are valid\n * for the instance property. This MUST be an array, and each item in\n * the array represents a possible value for the instance value. If\n * this attribute is defined, the instance value MUST be one of the\n * values in the array in order for the schema to be valid.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23\n */\n enum(...enumValues: any[]): this;\n enum(enumValue: any | any[], ...enumValues: any[]): this {\n const {values, types} = serializeEnumValues([enumValue, enumValues].flat());\n\n super.set(\"enum\", values).any(...types);\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1\n */\n definitions(definitions: Record<string, AnyJsonSchema>) {\n super.set(\"definitions\", mapProperties(definitions));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26\n */\n allOf(allOf: AnyJsonSchema[]) {\n super.set(\"allOf\", allOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27\n */\n anyOf(anyOf: AnyJsonSchema[]) {\n super.set(\"anyOf\", anyOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n */\n oneOf(oneOf: AnyJsonSchema[]) {\n super.set(\"oneOf\", oneOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29\n */\n not(not: AnyJsonSchema) {\n super.set(\"not\", mapToJsonSchema(not));\n\n return this;\n }\n\n /**\n * Must be strictly greater than 0.\n * A numeric instance is valid only if division by this keyword's value results in an integer.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1\n */\n multipleOf(multipleOf: number): this {\n super.set(\"multipleOf\", multipleOf);\n\n return this;\n }\n\n /**\n * Representing an inclusive upper limit for a numeric instance.\n * This keyword validates only if the instance is less than or exactly equal to \"maximum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2\n */\n maximum(maximum: number): this {\n super.set(\"maximum\", maximum);\n\n return this;\n }\n\n /**\n * Representing an exclusive upper limit for a numeric instance.\n * This keyword validates only if the instance is strictly less than (not equal to) to \"exclusiveMaximum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3\n */\n exclusiveMaximum(exclusiveMaximum: number): this {\n super.set(\"exclusiveMaximum\", exclusiveMaximum);\n\n return this;\n }\n\n /**\n * Representing an inclusive lower limit for a numeric instance.\n * This keyword validates only if the instance is greater than or exactly equal to \"minimum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4\n */\n minimum(minimum: number): this {\n super.set(\"minimum\", minimum);\n\n return this;\n }\n\n /**\n * Representing an exclusive lower limit for a numeric instance.\n * This keyword validates only if the instance is strictly greater than (not equal to) to \"exclusiveMinimum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5\n */\n exclusiveMinimum(exclusiveMinimum: number): this {\n super.set(\"exclusiveMinimum\", exclusiveMinimum);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6\n */\n maxLength(maxLength: number): this {\n super.set(\"maxLength\", maxLength);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7\n */\n minLength(minLength: number): this {\n super.set(\"minLength\", minLength);\n\n return this;\n }\n\n /**\n * Should be a valid regular expression, according to the ECMA 262 regular expression dialect.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8\n */\n pattern(pattern: string | RegExp): this {\n super.set(\"pattern\", toJsonRegex(pattern));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8\n */\n format(format: JsonFormatTypes | ValueOf<JsonFormatTypes>): this {\n super.set(\"format\", format);\n\n return this;\n }\n\n /**\n * A single type, or a union of simple types\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25\n */\n type(type: any | JSONSchema6TypeName | JSONSchema6TypeName[]): this {\n switch (type) {\n case Map:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n if (!this.has(\"additionalProperties\")) {\n super.set(\"additionalProperties\", this.itemSchema({}));\n }\n break;\n\n case Array:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n\n if (!this.has(\"items\")) {\n super.set(\"items\", this.itemSchema({}));\n }\n break;\n\n case Set:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n this.uniqueItems(true);\n\n if (!this.has(\"items\")) {\n super.set(\"items\", this.itemSchema({}));\n }\n break;\n\n case \"integer\":\n super.set(\"type\", getJsonType(type));\n this.integer();\n break;\n\n case Object:\n case Date:\n case Boolean:\n case Number:\n case String:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n if (!this.has(\"properties\")) {\n super.set(\"properties\", {});\n }\n break;\n\n default:\n if (isClass(type) || isFunction(type)) {\n super.set(\"type\", undefined);\n this.#target = type;\n\n if (!this.has(\"properties\")) {\n super.set(\"properties\", {});\n }\n } else {\n const jsonType = getJsonType(type);\n if (jsonType === \"generic\") {\n this.#isGeneric = true;\n super.set(\"$ref\", type);\n } else {\n super.set(\"type\", jsonType);\n }\n }\n }\n\n return this;\n }\n\n any(...types: any[]) {\n const hasClasses = types.filter((type) => isClass(type));\n\n if (hasClasses.length >= 2) {\n this.oneOf(\n types.filter((value) => {\n if (value !== null) {\n this.nullable(true);\n return true;\n }\n return false;\n })\n );\n } else {\n // TODO when OS3 will the only minimal supported version, we'll can remove this code\n if (types.length) {\n types = uniq(types).map(getJsonType);\n\n if (types.includes(\"null\")) {\n this.nullable(true);\n types = types.filter((o) => o !== \"null\");\n }\n } else {\n types = [\"integer\", \"number\", \"string\", \"boolean\", \"array\", \"object\"];\n this.nullable(true);\n }\n\n this.type(types.length === 1 ? types[0] : types);\n }\n\n return this;\n }\n\n integer() {\n super.set(\"type\", \"integer\");\n super.set(\"multipleOf\", 1.0);\n\n return this;\n }\n\n /**\n * This attribute is a string that provides a short description of the instance property.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2\n */\n title(title: string): this {\n super.set(\"title\", title);\n\n return this;\n }\n\n readOnly(readOnly: boolean): this {\n super.set(\"readOnly\", readOnly);\n\n return this;\n }\n\n writeOnly(readOnly: boolean): this {\n super.set(\"writeOnly\", readOnly);\n\n return this;\n }\n\n customKey(key: string, value: any) {\n super.set(`#${key}`, value);\n\n return this;\n }\n\n toObject(options?: JsonSchemaOptions) {\n return this.toJSON(options);\n }\n\n toJSON(options?: JsonSchemaOptions) {\n let addDef = false;\n\n if (!options) {\n addDef = true;\n options = {schemas: {}};\n }\n\n const schema = execMapper(\"schema\", this, options);\n\n if (addDef && options.schemas && Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n return schema;\n }\n\n assign(obj: JsonSchema | Partial<JsonSchemaObject> = {}) {\n const entries = obj instanceof JsonSchema ? [...obj.entries()] : Object.entries(obj);\n entries.forEach(([key, value]) => {\n this.set(key, value);\n });\n\n if (obj instanceof JsonSchema) {\n this.$selfRequired = obj.$selfRequired;\n\n obj.$required.forEach((key) => {\n this.$required.add(key);\n });\n\n this.#ref = obj.#ref;\n this.#alias = new Map(this.#alias.entries());\n obj.#genericLabels && (this.#genericLabels = [...obj.#genericLabels]);\n this.#nestedGenerics = obj.#nestedGenerics.map((item) => [...item]);\n this.#target = obj.#target;\n this.#isGeneric = obj.#isGeneric;\n this.#isCollection = obj.#isCollection;\n this.#ref = obj.#ref;\n\n super.set(\"type\", obj.get(\"type\"));\n }\n\n return this;\n }\n\n set(key: string, value: any): this {\n if (key in this) {\n isFunction((this as any)[key]) && (this as any)[key](value);\n } else {\n super.set(key, value);\n }\n\n return this;\n }\n\n /**\n * Return the itemSchema computed type.\n * If the type is a function used for recursive model,\n * the function will be called to get the right type.\n */\n getComputedType(): any {\n return getComputedType(this.#target);\n }\n\n getComputedItemType(): any {\n return this.#itemSchema ? this.#itemSchema.getComputedType() : this.getComputedType();\n }\n\n /**\n * Return the Json type as string\n */\n getJsonType(): string | string[] {\n return this.get(\"type\") || getJsonType(this.getComputedType());\n }\n\n getTarget() {\n return this.#target;\n }\n\n /**\n * Get the symbolic name of the entity\n */\n getName() {\n return this.get(\"name\") || (this.#target ? nameOf(classOf(this.getComputedType())) : \"\");\n }\n\n clone() {\n return new JsonSchema(this);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"JsonSchema.js","sourceRoot":"","sources":["../../../src/domain/JsonSchema.ts"],"names":[],"mappings":";;;;;AAAA,qCAA+G;AAI/G,uFAAmE;AAEnE,8DAAyD;AACzD,sDAAiD;AACjD,sDAAiD;AAIjD,uDAAkD;AAClD,sEAAiE;AAWjE,SAAS,aAAa,CAAC,UAA+B;IACpD,uBAAuB;IACvB,IAAI,UAAU,YAAY,UAAU,EAAE;QACpC,OAAO,UAAU,CAAC;KACnB;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAM,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE;QAC1E,UAAU,CAAC,IAAA,yBAAW,EAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QAEvD,OAAO,UAAU,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED,SAAS,eAAe,CAAC,IAAS;IAChC,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QACjB,OAAQ,IAAc,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;KAC7C;IAED,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,SAAS,EAAE;QACvD,OAAO,IAAI,CAAC;KACb;IAED,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,KAAK,MAAM,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QAC7C,OAAO,iCAAe,CAAC,IAAI,CAAC,I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,CAAC;IACxF,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAA,yBAAW,EAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,SAAS;QACP,OAAO,+BAAA,IAAI,0BAAQ,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,+BAAA,IAAI,0BAAQ,CAAC,CAAC,CAAC,IAAA,aAAM,EAAC,IAAA,cAAO,EAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,KAAK;QACH,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF;AAh1BD,gCAg1BC","sourcesContent":["import {classOf, Hooks, isArray, isClass, isFunction, isObject, nameOf, Type, uniq, ValueOf} from \"@tsed/core\";\nimport type {JSONSchema6, JSONSchema6Definition, JSONSchema6Type, JSONSchema6TypeName, JSONSchema6Version} from \"json-schema\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {IgnoreCallback} from \"../interfaces/IgnoreCallback\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {NestedGenerics} from \"../utils/generics\";\nimport {getComputedType} from \"../utils/getComputedType\";\nimport {getJsonType} from \"../utils/getJsonType\";\nimport {toJsonRegex} from \"../utils/toJsonRegex\";\nimport {AliasMap, AliasType} from \"./JsonAliasMap\";\nimport {JsonFormatTypes} from \"./JsonFormatTypes\";\nimport {JsonLazyRef} from \"./JsonLazyRef\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\nimport {serializeEnumValues} from \"../utils/serializeEnumValues\";\n\nexport interface JsonSchemaObject extends JSONSchema6, Record<string, any> {\n type: (any | JSONSchema6TypeName) | (any | JSONSchema6TypeName)[];\n additionalProperties?: boolean | JSONSchema6 | any;\n propertyNames?: boolean | JSONSchema6 | any;\n items?: (any | JSONSchema6Definition) | (any | JSONSchema6Definition)[];\n}\n\nexport type AnyJsonSchema = Partial<JsonSchemaObject> | JsonSchema | JsonLazyRef | any;\n\nfunction mapProperties(properties: Record<string, any>) {\n // istanbul ignore next\n if (properties instanceof JsonSchema) {\n return properties;\n }\n\n return Object.entries(properties).reduce<any>((properties, [key, schema]) => {\n properties[toJsonRegex(key)] = mapToJsonSchema(schema);\n\n return properties;\n }, {});\n}\n\nfunction mapToJsonSchema(item: any): any {\n if (isArray(item)) {\n return (item as any[]).map(mapToJsonSchema);\n }\n\n if (item.isStore || item.isJsonSchema || item.isLazyRef) {\n return item;\n }\n\n if (classOf(item) !== Object && isClass(item)) {\n return JsonEntityStore.from(item).schema;\n }\n\n if (isObject(item)) {\n return JsonSchema.from(item as any);\n }\n\n return item;\n}\n\nexport class JsonSchema extends Map<string, any> implements NestedGenerics {\n readonly isJsonSchema = true;\n readonly $hooks = new Hooks();\n readonly $required: Set<string> = new Set();\n readonly $allow: any[] = [];\n public $selfRequired: boolean;\n public $forwardGroups: boolean = false;\n\n #nullable: boolean = false;\n #genericLabels: string[];\n #nestedGenerics: Type<any>[][] = [];\n #alias: AliasMap = new Map();\n #itemSchema: JsonSchema;\n #target: Type<any>;\n #isGeneric: boolean = false;\n #isCollection: boolean = false;\n #ref: boolean = false;\n\n constructor(obj: JsonSchema | Partial<JsonSchemaObject> = {}) {\n super();\n\n if (obj) {\n this.assign(obj);\n }\n }\n\n get alias() {\n return this.#alias;\n }\n\n get nestedGenerics(): any[] {\n return this.#nestedGenerics;\n }\n\n set nestedGenerics(value: any[]) {\n this.#nestedGenerics = value;\n }\n\n get genericLabels(): string[] {\n return this.#genericLabels;\n }\n\n set genericLabels(value: string[]) {\n this.#genericLabels = value;\n }\n\n get isClass() {\n return isClass(this.class) && ![Map, Array, Set, Object, Date, Boolean, Number, String].includes(this.#target as any);\n }\n\n /**\n * Current schema is a collection\n */\n get isCollection() {\n return this.#isCollection;\n }\n\n /**\n * Current schema is a generic\n */\n get isGeneric() {\n return this.#isGeneric;\n }\n\n /**\n * Current schema has generics items\n */\n get hasGenerics(): boolean {\n return !!(this.nestedGenerics && this.nestedGenerics.length);\n }\n\n get genericType(): string {\n return this.get(\"$ref\");\n }\n\n get class() {\n return this.getComputedType();\n }\n\n get canRef(): boolean {\n return this.#ref;\n }\n\n get isNullable(): boolean {\n return this.#nullable || this.$allow.includes(null);\n }\n\n get isReadOnly() {\n return this.get(\"readOnly\");\n }\n\n get isWriteOnly() {\n return this.get(\"writeOnly\");\n }\n\n static from(obj: Partial<JsonSchemaObject> = {}) {\n return new JsonSchema(obj);\n }\n\n nullable(value: boolean) {\n this.#nullable = value;\n }\n\n itemSchema(obj: AnyJsonSchema = {}) {\n this.#itemSchema = this.#itemSchema || mapToJsonSchema(obj);\n this.#itemSchema.assign(obj);\n\n return this.#itemSchema;\n }\n\n getAliasOf(property: AliasType) {\n return this.#alias.get(property as any);\n }\n\n addAlias(property: AliasType, alias: AliasType) {\n this.#alias.set(property, alias);\n this.#alias.set(alias, property);\n\n return this;\n }\n\n removeAlias(property: AliasType) {\n const alias = this.#alias.get(property);\n alias && this.#alias.delete(alias);\n this.#alias.delete(property);\n\n return this;\n }\n\n $id($id: string) {\n super.set(\"$id\", $id);\n\n return this;\n }\n\n $ref($ref: string) {\n super.set(\"$ref\", $ref);\n\n return this;\n }\n\n $schema($schema: JSONSchema6Version) {\n super.set(\"$schema\", $schema);\n\n return this;\n }\n\n /**\n * Create a ref and use name to sharing schema\n * @param name\n */\n label(name: string) {\n this.#ref = true;\n\n super.set(\"name\", name);\n\n return this;\n }\n\n name(name: string) {\n super.set(\"name\", name);\n\n return this;\n }\n\n ignore(cb: boolean | IgnoreCallback) {\n if (typeof cb === \"boolean\") {\n const bool = cb;\n cb = () => bool;\n }\n\n this.$hooks.on(\"ignore\", cb);\n\n return this;\n }\n\n /**\n * This keyword can be used to supply a default JSON value associated with a particular schema.\n * It is RECOMMENDED that a default value be valid against the associated schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3\n */\n default(value: JSONSchema6Type) {\n super.set(\"default\", value);\n\n return this;\n }\n\n /**\n * More readible form of a one-element \"enum\"\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24\n */\n const(value: JSONSchema6Type) {\n super.set(\"const\", value);\n\n return this;\n }\n\n /**\n * This attribute is a string that provides a full description of the of purpose the instance property.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2\n */\n description(description: string) {\n super.set(\"description\", description);\n\n return this;\n }\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n * If \"items\" is an array of schemas, validation succeeds if every instance element\n * at a position greater than the size of \"items\" validates against \"additionalItems\".\n * Otherwise, \"additionalItems\" MUST be ignored, as the \"items\" schema\n * (possibly the default value of an empty schema) is applied to all elements.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10\n */\n additionalItems(additionalItems: boolean | AnyJsonSchema) {\n super.set(\"additionalItems\", mapToJsonSchema(additionalItems));\n\n return this;\n }\n\n /**\n * An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14\n */\n contains(contains: JSONSchema6Definition) {\n super.set(\"contains\", mapToJsonSchema(contains));\n\n return this;\n }\n\n /**\n * Array of examples with no validation effect the value of \"default\" is usable as an example without repeating it under this keyword\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4\n */\n examples(examples: JSONSchema6Type[]) {\n super.set(\"examples\", examples);\n\n return this;\n }\n\n /**\n * Array of examples with no validation effect the value of \"default\" is usable as an example without repeating it under this keyword\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4\n */\n example(...examples: JSONSchema6Type[]) {\n return this.examples(examples);\n }\n\n /**\n * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9\n */\n items(items: AnyJsonSchema | AnyJsonSchema[]) {\n super.set(\"items\", (this.#itemSchema = mapToJsonSchema(items)));\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An array instance is valid against \"maxItems\" if its size is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11\n */\n maxItems(maxItems: number) {\n super.set(\"maxItems\", maxItems);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An array instance is valid against \"maxItems\" if its size is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12\n */\n minItems(minItems: number) {\n super.set(\"minItems\", minItems);\n\n return this;\n }\n\n /**\n * If this keyword has boolean value false, the instance validates successfully.\n * If it has boolean value true, the instance validates successfully if all of its elements are unique.\n * Omitting this keyword has the same behavior as a value of false.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13\n */\n uniqueItems(uniqueItems: boolean) {\n super.set(\"uniqueItems\", uniqueItems);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An object instance is valid against \"maxProperties\" if its number of properties is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15\n */\n maxProperties(maxProperties: number) {\n super.set(\"maxProperties\", maxProperties);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * An object instance is valid against \"maxProperties\" if its number of properties is greater than,\n * or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16\n */\n minProperties(minProperties: number) {\n super.set(\"minProperties\", minProperties);\n\n return this;\n }\n\n allow(...allow: any[]) {\n this.$allow.push(...allow);\n return this;\n }\n\n /**\n * Elements of this array must be unique.\n * An object instance is valid against this keyword if every item in the array is the name of a property in the instance.\n * Omitting this keyword has the same behavior as an empty array.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17\n */\n required(required: boolean | string[] = true) {\n if (isArray(required)) {\n this.$required.clear();\n\n required.forEach((value: any) => this.$required.add(value));\n } else {\n const schema = this.clone();\n schema.$selfRequired = required;\n return schema;\n }\n\n return this;\n }\n\n addRequired(property: string) {\n this.$required.add(property);\n\n return this;\n }\n\n removeRequired(property: string) {\n this.$required.delete(property);\n\n return this;\n }\n\n isRequired(property: string): boolean {\n return this.$required.has(property);\n }\n\n /**\n * This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.\n * Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value,\n * the child instance for that name successfully validates against the corresponding schema.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18\n */\n properties(properties: AnyJsonSchema | Record<string, AnyJsonSchema>) {\n super.set(\"properties\", mapProperties(properties));\n\n return this;\n }\n\n addProperty(key: string, schema: AnyJsonSchema) {\n const properties = this.get(\"properties\") || {};\n\n properties[key] = schema;\n\n super.set(\"properties\", mapProperties(properties));\n\n return this;\n }\n\n /**\n * This attribute is an object that defines the schema for a set of property names of an object instance.\n * The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema.\n * If the pattern matches the name of a property on the instance object, the value of the instance's property\n * MUST be valid against the pattern name's schema value.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19\n */\n patternProperties(patternProperties: Record<string, AnyJsonSchema>) {\n super.set(\"patternProperties\", mapProperties(patternProperties));\n\n return this;\n }\n\n /**\n * This attribute defines a schema for all properties that are not explicitly defined in an object type definition.\n * If specified, the value MUST be a schema or a boolean.\n * If false is provided, no additional properties are allowed beyond the properties defined in the schema.\n * The default value is an empty schema which allows any value for additional properties.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20\n */\n additionalProperties(additionalProperties: boolean | AnyJsonSchema) {\n super.set(\"additionalProperties\", mapToJsonSchema(additionalProperties));\n\n return this;\n }\n\n /**\n * This attribute defines a schema for all properties that are not explicitly defined in an object type definition.\n * If specified, the value MUST be a schema or a boolean.\n * If false is provided, no additional properties are allowed beyond the properties defined in the schema.\n * The default value is an empty schema which allows any value for additional properties.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20\n * @alias additionalProperties\n * @param unknown\n */\n unknown(unknown: boolean = true) {\n return this.additionalProperties(unknown);\n }\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.\n * Each property specifies a dependency.\n * If the dependency value is an array, each element in the array must be unique.\n * Omitting this keyword has the same behavior as an empty object.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21\n */\n dependencies(dependencies: {[p: string]: JSONSchema6Definition | JsonSchema | string[]}) {\n super.set(\"dependencies\", mapProperties(dependencies));\n\n return this;\n }\n\n /**\n * Takes a schema which validates the names of all properties rather than their values.\n * Note the property name that the schema is testing will always be a string.\n * Omitting this keyword has the same behavior as an empty schema.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22\n */\n propertyNames(propertyNames: JSONSchema6Definition | JsonSchema) {\n super.set(\"propertyNames\", mapToJsonSchema(propertyNames));\n\n return this;\n }\n\n /**\n * This provides an enumeration of all possible values that are valid\n * for the instance property. This MUST be an array, and each item in\n * the array represents a possible value for the instance value. If\n * this attribute is defined, the instance value MUST be one of the\n * values in the array in order for the schema to be valid.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23\n */\n enum(...enumValues: any[]): this;\n enum(enumValue: any | any[], ...enumValues: any[]): this {\n const {values, types} = serializeEnumValues([enumValue, enumValues].flat());\n\n super.set(\"enum\", values).any(...types);\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1\n */\n definitions(definitions: Record<string, AnyJsonSchema>) {\n super.set(\"definitions\", mapProperties(definitions));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26\n */\n allOf(allOf: AnyJsonSchema[]) {\n super.set(\"allOf\", allOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27\n */\n anyOf(anyOf: AnyJsonSchema[]) {\n super.set(\"anyOf\", anyOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n */\n oneOf(oneOf: AnyJsonSchema[]) {\n super.set(\"oneOf\", oneOf.map(mapToJsonSchema));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29\n */\n not(not: AnyJsonSchema) {\n super.set(\"not\", mapToJsonSchema(not));\n\n return this;\n }\n\n /**\n * Must be strictly greater than 0.\n * A numeric instance is valid only if division by this keyword's value results in an integer.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1\n */\n multipleOf(multipleOf: number): this {\n super.set(\"multipleOf\", multipleOf);\n\n return this;\n }\n\n /**\n * Representing an inclusive upper limit for a numeric instance.\n * This keyword validates only if the instance is less than or exactly equal to \"maximum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2\n */\n maximum(maximum: number): this {\n super.set(\"maximum\", maximum);\n\n return this;\n }\n\n /**\n * Representing an exclusive upper limit for a numeric instance.\n * This keyword validates only if the instance is strictly less than (not equal to) to \"exclusiveMaximum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3\n */\n exclusiveMaximum(exclusiveMaximum: number): this {\n super.set(\"exclusiveMaximum\", exclusiveMaximum);\n\n return this;\n }\n\n /**\n * Representing an inclusive lower limit for a numeric instance.\n * This keyword validates only if the instance is greater than or exactly equal to \"minimum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4\n */\n minimum(minimum: number): this {\n super.set(\"minimum\", minimum);\n\n return this;\n }\n\n /**\n * Representing an exclusive lower limit for a numeric instance.\n * This keyword validates only if the instance is strictly greater than (not equal to) to \"exclusiveMinimum\".\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5\n */\n exclusiveMinimum(exclusiveMinimum: number): this {\n super.set(\"exclusiveMinimum\", exclusiveMinimum);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6\n */\n maxLength(maxLength: number): this {\n super.set(\"maxLength\", maxLength);\n\n return this;\n }\n\n /**\n * Must be a non-negative integer.\n * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.\n * Omitting this keyword has the same behavior as a value of 0.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7\n */\n minLength(minLength: number): this {\n super.set(\"minLength\", minLength);\n\n return this;\n }\n\n /**\n * Should be a valid regular expression, according to the ECMA 262 regular expression dialect.\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8\n */\n pattern(pattern: string | RegExp): this {\n super.set(\"pattern\", toJsonRegex(pattern));\n\n return this;\n }\n\n /**\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8\n */\n format(format: JsonFormatTypes | ValueOf<JsonFormatTypes>): this {\n super.set(\"format\", format);\n\n return this;\n }\n\n /**\n * A single type, or a union of simple types\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25\n */\n type(type: any | JSONSchema6TypeName | JSONSchema6TypeName[]): this {\n switch (type) {\n case Map:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n if (!this.has(\"additionalProperties\")) {\n super.set(\"additionalProperties\", this.itemSchema({}));\n }\n break;\n\n case Array:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n\n if (!this.has(\"items\")) {\n super.set(\"items\", this.itemSchema({}));\n }\n break;\n\n case Set:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n this.#isCollection = true;\n this.uniqueItems(true);\n\n if (!this.has(\"items\")) {\n super.set(\"items\", this.itemSchema({}));\n }\n break;\n\n case \"integer\":\n super.set(\"type\", getJsonType(type));\n this.integer();\n break;\n\n case Object:\n case Date:\n case Boolean:\n case Number:\n case String:\n super.set(\"type\", getJsonType(type));\n this.#target = type;\n if (!this.has(\"properties\")) {\n super.set(\"properties\", {});\n }\n break;\n\n default:\n if (isClass(type) || isFunction(type)) {\n super.set(\"type\", undefined);\n this.#target = type;\n\n if (!this.has(\"properties\")) {\n super.set(\"properties\", {});\n }\n } else {\n const jsonType = getJsonType(type);\n if (jsonType === \"generic\") {\n this.#isGeneric = true;\n super.set(\"$ref\", type);\n } else {\n super.set(\"type\", jsonType);\n }\n }\n }\n\n return this;\n }\n\n any(...types: any[]) {\n const hasClasses = types.filter((type) => isClass(type));\n\n if (hasClasses.length >= 2) {\n this.oneOf(\n types.filter((value) => {\n if (value !== null) {\n this.nullable(true);\n return true;\n }\n return false;\n })\n );\n } else {\n // TODO when OS3 will the only minimal supported version, we'll can remove this code\n if (types.length) {\n types = uniq(types).map(getJsonType);\n\n if (types.includes(\"null\")) {\n this.nullable(true);\n types = types.filter((o) => o !== \"null\");\n }\n } else {\n types = [\"integer\", \"number\", \"string\", \"boolean\", \"array\", \"object\"];\n this.nullable(true);\n }\n\n this.type(types.length === 1 ? types[0] : types);\n }\n\n return this;\n }\n\n integer() {\n super.set(\"type\", \"integer\");\n super.set(\"multipleOf\", 1.0);\n\n return this;\n }\n\n /**\n * This attribute is a string that provides a short description of the instance property.\n *\n * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2\n */\n title(title: string): this {\n super.set(\"title\", title);\n\n return this;\n }\n\n readOnly(readOnly: boolean): this {\n super.set(\"readOnly\", readOnly);\n\n return this;\n }\n\n writeOnly(readOnly: boolean): this {\n super.set(\"writeOnly\", readOnly);\n\n return this;\n }\n\n customKey(key: string, value: any) {\n super.set(`#${key}`, value);\n\n return this;\n }\n\n toObject(options?: JsonSchemaOptions) {\n return this.toJSON(options);\n }\n\n toJSON(options?: JsonSchemaOptions) {\n let addDef = false;\n\n if (!options) {\n addDef = true;\n options = {schemas: {}};\n }\n\n const schema = execMapper(\"schema\", this, options);\n\n if (addDef && options.schemas && Object.keys(options.schemas).length) {\n schema.definitions = options.schemas;\n }\n\n return schema;\n }\n\n assign(obj: JsonSchema | Partial<JsonSchemaObject> = {}) {\n const entries = obj instanceof JsonSchema ? [...obj.entries()] : Object.entries(obj);\n entries.forEach(([key, value]) => {\n this.set(key, value);\n });\n\n if (obj instanceof JsonSchema) {\n this.$selfRequired = obj.$selfRequired;\n\n obj.$required.forEach((key) => {\n this.$required.add(key);\n });\n\n this.#ref = obj.#ref;\n this.#alias = new Map(this.#alias.entries());\n obj.#genericLabels && (this.#genericLabels = [...obj.#genericLabels]);\n this.#nestedGenerics = obj.#nestedGenerics.map((item) => [...item]);\n this.#target = obj.#target;\n this.#isGeneric = obj.#isGeneric;\n this.#isCollection = obj.#isCollection;\n this.#ref = obj.#ref;\n\n super.set(\"type\", obj.get(\"type\"));\n }\n\n return this;\n }\n\n set(key: string, value: any): this {\n if (key in this) {\n isFunction((this as any)[key]) && (this as any)[key](value);\n } else {\n super.set(key, value);\n }\n\n return this;\n }\n\n /**\n * Return the itemSchema computed type.\n * If the type is a function used for recursive model,\n * the function will be called to get the right type.\n */\n getComputedType(): any {\n return getComputedType(this.#target);\n }\n\n getComputedItemType(): any {\n return this.#itemSchema ? this.#itemSchema.getComputedType() : this.getComputedType();\n }\n\n /**\n * Return the Json type as string\n */\n getJsonType(): string | string[] {\n return this.get(\"type\") || getJsonType(this.getComputedType());\n }\n\n getTarget() {\n return this.#target;\n }\n\n /**\n * Get the symbolic name of the entity\n */\n getName() {\n return this.get(\"name\") || (this.#target ? nameOf(classOf(this.getComputedType())) : \"\");\n }\n\n clone() {\n return new JsonSchema(this);\n }\n}\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -4,150 +4,150 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
7
|
+
tslib_1.__exportStar(require("./components/anyMapper"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./components/classMapper"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./components/genericsMapper"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./components/inheritedClassMapper"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./components/itemMapper"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./components/lazyRefMapper"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./components/mapMapper"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./components/objectMapper"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./components/ofMapper"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./components/propertiesMapper"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./components/schemaMapper"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./constants/httpMethods"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./constants/httpStatusMessages"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./decorators/class/children"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./decorators/collections/collectionContains"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./decorators/collections/collectionOf"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./decorators/collections/maxItems"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./decorators/collections/maxProperties"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./decorators/collections/minItems"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./decorators/collections/minProperties"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./decorators/collections/uniqueItems"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./decorators/common/additionalProperties"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./decorators/common/allOf"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./decorators/common/allow"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./decorators/common/any"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./decorators/common/anyOf"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./decorators/common/const"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./decorators/common/customKey"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./decorators/common/default"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./decorators/common/description"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./decorators/common/enum"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./decorators/common/example"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./decorators/common/examples"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./decorators/common/exclusiveMaximum"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./decorators/common/exclusiveMinimum"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./decorators/common/format"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./decorators/common/forwardGroups"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./decorators/common/groups"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./decorators/common/hidden"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./decorators/common/ignore"), exports);
|
|
47
|
+
tslib_1.__exportStar(require("./decorators/common/integer"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./decorators/common/jsonEntityFn"), exports);
|
|
49
|
+
tslib_1.__exportStar(require("./decorators/common/maxLength"), exports);
|
|
50
|
+
tslib_1.__exportStar(require("./decorators/common/maximum"), exports);
|
|
51
|
+
tslib_1.__exportStar(require("./decorators/common/minLength"), exports);
|
|
52
|
+
tslib_1.__exportStar(require("./decorators/common/minimum"), exports);
|
|
53
|
+
tslib_1.__exportStar(require("./decorators/common/multipleOf"), exports);
|
|
54
|
+
tslib_1.__exportStar(require("./decorators/common/name"), exports);
|
|
55
|
+
tslib_1.__exportStar(require("./decorators/common/nullable"), exports);
|
|
56
|
+
tslib_1.__exportStar(require("./decorators/common/oneOf"), exports);
|
|
57
|
+
tslib_1.__exportStar(require("./decorators/common/optional"), exports);
|
|
58
|
+
tslib_1.__exportStar(require("./decorators/common/pattern"), exports);
|
|
59
|
+
tslib_1.__exportStar(require("./decorators/common/property"), exports);
|
|
60
|
+
tslib_1.__exportStar(require("./decorators/common/readOnly"), exports);
|
|
61
|
+
tslib_1.__exportStar(require("./decorators/common/recordOf"), exports);
|
|
62
|
+
tslib_1.__exportStar(require("./decorators/common/required"), exports);
|
|
63
|
+
tslib_1.__exportStar(require("./decorators/common/requiredGroups"), exports);
|
|
64
|
+
tslib_1.__exportStar(require("./decorators/common/schema"), exports);
|
|
65
|
+
tslib_1.__exportStar(require("./decorators/common/title"), exports);
|
|
66
|
+
tslib_1.__exportStar(require("./decorators/common/writeOnly"), exports);
|
|
67
|
+
tslib_1.__exportStar(require("./decorators/config/jsonEntityComponent"), exports);
|
|
68
|
+
tslib_1.__exportStar(require("./decorators/generics/genericOf"), exports);
|
|
69
|
+
tslib_1.__exportStar(require("./decorators/generics/generics"), exports);
|
|
70
|
+
tslib_1.__exportStar(require("./decorators/operations/acceptMime"), exports);
|
|
71
|
+
tslib_1.__exportStar(require("./decorators/operations/consumes"), exports);
|
|
72
|
+
tslib_1.__exportStar(require("./decorators/operations/contentType"), exports);
|
|
73
|
+
tslib_1.__exportStar(require("./decorators/operations/deprecated"), exports);
|
|
74
|
+
tslib_1.__exportStar(require("./decorators/operations/header"), exports);
|
|
75
|
+
tslib_1.__exportStar(require("./decorators/operations/in"), exports);
|
|
76
|
+
tslib_1.__exportStar(require("./decorators/operations/inFile"), exports);
|
|
77
|
+
tslib_1.__exportStar(require("./decorators/operations/location"), exports);
|
|
78
|
+
tslib_1.__exportStar(require("./decorators/operations/operationId"), exports);
|
|
79
|
+
tslib_1.__exportStar(require("./decorators/operations/operationPath"), exports);
|
|
80
|
+
tslib_1.__exportStar(require("./decorators/operations/partial"), exports);
|
|
81
|
+
tslib_1.__exportStar(require("./decorators/operations/path"), exports);
|
|
82
|
+
tslib_1.__exportStar(require("./decorators/operations/produces"), exports);
|
|
83
|
+
tslib_1.__exportStar(require("./decorators/operations/redirect"), exports);
|
|
84
|
+
tslib_1.__exportStar(require("./decorators/operations/returns"), exports);
|
|
85
|
+
tslib_1.__exportStar(require("./decorators/operations/route"), exports);
|
|
86
|
+
tslib_1.__exportStar(require("./decorators/operations/security"), exports);
|
|
87
|
+
tslib_1.__exportStar(require("./decorators/operations/status"), exports);
|
|
88
|
+
tslib_1.__exportStar(require("./decorators/operations/summary"), exports);
|
|
89
|
+
tslib_1.__exportStar(require("./decorators/operations/tags"), exports);
|
|
90
|
+
tslib_1.__exportStar(require("./decorators/operations/view"), exports);
|
|
91
|
+
tslib_1.__exportStar(require("./domain/DecoratorContext"), exports);
|
|
92
|
+
tslib_1.__exportStar(require("./domain/JsonAliasMap"), exports);
|
|
93
|
+
tslib_1.__exportStar(require("./domain/JsonClassStore"), exports);
|
|
94
|
+
tslib_1.__exportStar(require("./domain/JsonEntityStore"), exports);
|
|
95
|
+
tslib_1.__exportStar(require("./domain/JsonFormatTypes"), exports);
|
|
96
|
+
tslib_1.__exportStar(require("./domain/JsonLazyRef"), exports);
|
|
97
|
+
tslib_1.__exportStar(require("./domain/JsonMap"), exports);
|
|
98
|
+
tslib_1.__exportStar(require("./domain/JsonMethodStore"), exports);
|
|
99
|
+
tslib_1.__exportStar(require("./domain/JsonOperation"), exports);
|
|
100
|
+
tslib_1.__exportStar(require("./domain/JsonOperationPathsMap"), exports);
|
|
101
|
+
tslib_1.__exportStar(require("./domain/JsonOperationRoute"), exports);
|
|
102
|
+
tslib_1.__exportStar(require("./domain/JsonParameter"), exports);
|
|
103
|
+
tslib_1.__exportStar(require("./domain/JsonParameterStore"), exports);
|
|
104
|
+
tslib_1.__exportStar(require("./domain/JsonParameterTypes"), exports);
|
|
105
|
+
tslib_1.__exportStar(require("./domain/JsonPropertyStore"), exports);
|
|
106
|
+
tslib_1.__exportStar(require("./domain/JsonRequestBody"), exports);
|
|
107
|
+
tslib_1.__exportStar(require("./domain/JsonResponse"), exports);
|
|
108
|
+
tslib_1.__exportStar(require("./domain/JsonSchema"), exports);
|
|
109
|
+
tslib_1.__exportStar(require("./domain/SpecTypes"), exports);
|
|
110
|
+
tslib_1.__exportStar(require("./hooks/alterIgnore"), exports);
|
|
111
|
+
tslib_1.__exportStar(require("./hooks/alterOneOf"), exports);
|
|
112
|
+
tslib_1.__exportStar(require("./hooks/alterRequiredGroups"), exports);
|
|
113
|
+
tslib_1.__exportStar(require("./interfaces/IgnoreCallback"), exports);
|
|
114
|
+
tslib_1.__exportStar(require("./interfaces/JsonHookContext"), exports);
|
|
115
|
+
tslib_1.__exportStar(require("./interfaces/JsonOpenSpec"), exports);
|
|
116
|
+
tslib_1.__exportStar(require("./interfaces/JsonSchemaOptions"), exports);
|
|
117
|
+
tslib_1.__exportStar(require("./registries/JsonSchemaMapperContainer"), exports);
|
|
118
|
+
tslib_1.__exportStar(require("./utils/buildPath"), exports);
|
|
119
|
+
tslib_1.__exportStar(require("./utils/concatParameters"), exports);
|
|
120
|
+
tslib_1.__exportStar(require("./utils/concatPath"), exports);
|
|
121
|
+
tslib_1.__exportStar(require("./utils/defineStatusModel"), exports);
|
|
122
|
+
tslib_1.__exportStar(require("./utils/from"), exports);
|
|
123
|
+
tslib_1.__exportStar(require("./utils/generateSpec"), exports);
|
|
124
|
+
tslib_1.__exportStar(require("./utils/generics"), exports);
|
|
125
|
+
tslib_1.__exportStar(require("./utils/getComputedType"), exports);
|
|
126
|
+
tslib_1.__exportStar(require("./utils/getInheritedStores"), exports);
|
|
127
|
+
tslib_1.__exportStar(require("./utils/getJsonEntityStore"), exports);
|
|
128
|
+
tslib_1.__exportStar(require("./utils/getJsonPathParameters"), exports);
|
|
129
|
+
tslib_1.__exportStar(require("./utils/getJsonSchema"), exports);
|
|
130
|
+
tslib_1.__exportStar(require("./utils/getJsonType"), exports);
|
|
131
|
+
tslib_1.__exportStar(require("./utils/getOperationsRoutes"), exports);
|
|
132
|
+
tslib_1.__exportStar(require("./utils/getOperationsStores"), exports);
|
|
133
|
+
tslib_1.__exportStar(require("./utils/getPropertiesStores"), exports);
|
|
134
|
+
tslib_1.__exportStar(require("./utils/getRequiredProperties"), exports);
|
|
135
|
+
tslib_1.__exportStar(require("./utils/getSpec"), exports);
|
|
136
|
+
tslib_1.__exportStar(require("./utils/getSpecType"), exports);
|
|
137
|
+
tslib_1.__exportStar(require("./utils/isSuccessStatus"), exports);
|
|
138
|
+
tslib_1.__exportStar(require("./utils/mapHeaders"), exports);
|
|
139
|
+
tslib_1.__exportStar(require("./utils/mapNullableType"), exports);
|
|
140
|
+
tslib_1.__exportStar(require("./utils/mapOpenSpec"), exports);
|
|
141
|
+
tslib_1.__exportStar(require("./utils/mapOpenSpec2"), exports);
|
|
142
|
+
tslib_1.__exportStar(require("./utils/mapOpenSpec3"), exports);
|
|
143
|
+
tslib_1.__exportStar(require("./utils/mapOpenSpecInfo"), exports);
|
|
144
|
+
tslib_1.__exportStar(require("./utils/mapRouteOptions"), exports);
|
|
145
|
+
tslib_1.__exportStar(require("./utils/matchGroups"), exports);
|
|
146
|
+
tslib_1.__exportStar(require("./utils/mergeOperation"), exports);
|
|
147
|
+
tslib_1.__exportStar(require("./utils/mergeSpec"), exports);
|
|
148
|
+
tslib_1.__exportStar(require("./utils/operationIdFormatter"), exports);
|
|
149
|
+
tslib_1.__exportStar(require("./utils/ref"), exports);
|
|
150
|
+
tslib_1.__exportStar(require("./utils/serializeEnumValues"), exports);
|
|
151
|
+
tslib_1.__exportStar(require("./utils/toJsonMapCollection"), exports);
|
|
152
|
+
tslib_1.__exportStar(require("./utils/toJsonRegex"), exports);
|
|
153
153
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iEAAuC;AACvC,mEAAyC;AACzC,sEAA4C;AAC5C,4EAAkD;AAClD,kEAAwC;AACxC,qEAA2C;AAC3C,iEAAuC;AACvC,oEAA0C;AAC1C,gEAAsC;AACtC,wEAA8C;AAC9C,oEAA0C;AAC1C,kEAAwC;AACxC,yEAA+C;AAC/C,sEAA4C;AAC5C,sFAA4D;AAC5D,gFAAsD;AACtD,4EAAkD;AAClD,iFAAuD;AACvD,4EAAkD;AAClD,iFAAuD;AACvD,+EAAqD;AACrD,mFAAyD;AACzD,oEAA0C;AAC1C,oEAA0C;AAC1C,kEAAwC;AACxC,oEAA0C;AAC1C,oEAA0C;AAC1C,wEAA8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EAA+C;AAC/C,iFAAuD;AACvD,4DAAkC;AAClC,mEAAyC;AACzC,6DAAmC;AACnC,oEAA0C;AAC1C,uDAA6B;AAC7B,+DAAqC;AACrC,2DAAiC;AACjC,kEAAwC;AACxC,qEAA2C;AAC3C,qEAA2C;AAC3C,wEAA8C;AAC9C,gEAAsC;AACtC,8DAAoC;AACpC,sEAA4C;AAC5C,sEAA4C;AAC5C,sEAA4C;AAC5C,wEAA8C;AAC9C,0DAAgC;AAChC,8DAAoC;AACpC,kEAAwC;AACxC,6DAAmC;AACnC,kEAAwC;AACxC,8DAAoC;AACpC,+DAAqC;AACrC,+DAAqC;AACrC,kEAAwC;AACxC,kEAAwC;AACxC,8DAAoC;AACpC,iEAAuC;AACvC,4DAAkC;AAClC,uEAA6C;AAC7C,sDAA4B;AAC5B,sEAA4C;AAC5C,sEAA4C;AAC5C,8DAAoC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./components/anyMapper\";\nexport * from \"./components/classMapper\";\nexport * from \"./components/genericsMapper\";\nexport * from \"./components/inheritedClassMapper\";\nexport * from \"./components/itemMapper\";\nexport * from \"./components/lazyRefMapper\";\nexport * from \"./components/mapMapper\";\nexport * from \"./components/objectMapper\";\nexport * from \"./components/ofMapper\";\nexport * from \"./components/propertiesMapper\";\nexport * from \"./components/schemaMapper\";\nexport * from \"./constants/httpMethods\";\nexport * from \"./constants/httpStatusMessages\";\nexport * from \"./decorators/class/children\";\nexport * from \"./decorators/collections/collectionContains\";\nexport * from \"./decorators/collections/collectionOf\";\nexport * from \"./decorators/collections/maxItems\";\nexport * from \"./decorators/collections/maxProperties\";\nexport * from \"./decorators/collections/minItems\";\nexport * from \"./decorators/collections/minProperties\";\nexport * from \"./decorators/collections/uniqueItems\";\nexport * from \"./decorators/common/additionalProperties\";\nexport * from \"./decorators/common/allOf\";\nexport * from \"./decorators/common/allow\";\nexport * from \"./decorators/common/any\";\nexport * from \"./decorators/common/anyOf\";\nexport * from \"./decorators/common/const\";\nexport * from \"./decorators/common/customKey\";\nexport * from \"./decorators/common/default\";\nexport * from \"./decorators/common/description\";\nexport * from \"./decorators/common/enum\";\nexport * from \"./decorators/common/example\";\nexport * from \"./decorators/common/examples\";\nexport * from \"./decorators/common/exclusiveMaximum\";\nexport * from \"./decorators/common/exclusiveMinimum\";\nexport * from \"./decorators/common/format\";\nexport * from \"./decorators/common/forwardGroups\";\nexport * from \"./decorators/common/groups\";\nexport * from \"./decorators/common/hidden\";\nexport * from \"./decorators/common/ignore\";\nexport * from \"./decorators/common/integer\";\nexport * from \"./decorators/common/jsonEntityFn\";\nexport * from \"./decorators/common/maxLength\";\nexport * from \"./decorators/common/maximum\";\nexport * from \"./decorators/common/minLength\";\nexport * from \"./decorators/common/minimum\";\nexport * from \"./decorators/common/multipleOf\";\nexport * from \"./decorators/common/name\";\nexport * from \"./decorators/common/nullable\";\nexport * from \"./decorators/common/oneOf\";\nexport * from \"./decorators/common/optional\";\nexport * from \"./decorators/common/pattern\";\nexport * from \"./decorators/common/property\";\nexport * from \"./decorators/common/readOnly\";\nexport * from \"./decorators/common/recordOf\";\nexport * from \"./decorators/common/required\";\nexport * from \"./decorators/common/requiredGroups\";\nexport * from \"./decorators/common/schema\";\nexport * from \"./decorators/common/title\";\nexport * from \"./decorators/common/writeOnly\";\nexport * from \"./decorators/config/jsonEntityComponent\";\nexport * from \"./decorators/generics/genericOf\";\nexport * from \"./decorators/generics/generics\";\nexport * from \"./decorators/operations/acceptMime\";\nexport * from \"./decorators/operations/consumes\";\nexport * from \"./decorators/operations/contentType\";\nexport * from \"./decorators/operations/deprecated\";\nexport * from \"./decorators/operations/header\";\nexport * from \"./decorators/operations/in\";\nexport * from \"./decorators/operations/inFile\";\nexport * from \"./decorators/operations/location\";\nexport * from \"./decorators/operations/operationId\";\nexport * from \"./decorators/operations/operationPath\";\nexport * from \"./decorators/operations/partial\";\nexport * from \"./decorators/operations/path\";\nexport * from \"./decorators/operations/produces\";\nexport * from \"./decorators/operations/redirect\";\nexport * from \"./decorators/operations/returns\";\nexport * from \"./decorators/operations/route\";\nexport * from \"./decorators/operations/security\";\nexport * from \"./decorators/operations/status\";\nexport * from \"./decorators/operations/summary\";\nexport * from \"./decorators/operations/tags\";\nexport * from \"./decorators/operations/view\";\nexport * from \"./domain/DecoratorContext\";\nexport * from \"./domain/JsonAliasMap\";\nexport * from \"./domain/JsonClassStore\";\nexport * from \"./domain/JsonEntityStore\";\nexport * from \"./domain/JsonFormatTypes\";\nexport * from \"./domain/JsonLazyRef\";\nexport * from \"./domain/JsonMap\";\nexport * from \"./domain/JsonMethodStore\";\nexport * from \"./domain/JsonOperation\";\nexport * from \"./domain/JsonOperationPathsMap\";\nexport * from \"./domain/JsonOperationRoute\";\nexport * from \"./domain/JsonParameter\";\nexport * from \"./domain/JsonParameterStore\";\nexport * from \"./domain/JsonParameterTypes\";\nexport * from \"./domain/JsonPropertyStore\";\nexport * from \"./domain/JsonRequestBody\";\nexport * from \"./domain/JsonResponse\";\nexport * from \"./domain/JsonSchema\";\nexport * from \"./domain/SpecTypes\";\nexport * from \"./hooks/alterIgnore\";\nexport * from \"./hooks/alterOneOf\";\nexport * from \"./hooks/alterRequiredGroups\";\nexport * from \"./interfaces/IgnoreCallback\";\nexport * from \"./interfaces/JsonHookContext\";\nexport * from \"./interfaces/JsonOpenSpec\";\nexport * from \"./interfaces/JsonSchemaOptions\";\nexport * from \"./registries/JsonSchemaMapperContainer\";\nexport * from \"./utils/buildPath\";\nexport * from \"./utils/concatParameters\";\nexport * from \"./utils/concatPath\";\nexport * from \"./utils/defineStatusModel\";\nexport * from \"./utils/from\";\nexport * from \"./utils/generateSpec\";\nexport * from \"./utils/generics\";\nexport * from \"./utils/getComputedType\";\nexport * from \"./utils/getInheritedStores\";\nexport * from \"./utils/getJsonEntityStore\";\nexport * from \"./utils/getJsonPathParameters\";\nexport * from \"./utils/getJsonSchema\";\nexport * from \"./utils/getJsonType\";\nexport * from \"./utils/getOperationsRoutes\";\nexport * from \"./utils/getOperationsStores\";\nexport * from \"./utils/getPropertiesStores\";\nexport * from \"./utils/getRequiredProperties\";\nexport * from \"./utils/getSpec\";\nexport * from \"./utils/getSpecType\";\nexport * from \"./utils/isSuccessStatus\";\nexport * from \"./utils/mapHeaders\";\nexport * from \"./utils/mapNullableType\";\nexport * from \"./utils/mapOpenSpec\";\nexport * from \"./utils/mapOpenSpec2\";\nexport * from \"./utils/mapOpenSpec3\";\nexport * from \"./utils/mapOpenSpecInfo\";\nexport * from \"./utils/mapRouteOptions\";\nexport * from \"./utils/matchGroups\";\nexport * from \"./utils/mergeOperation\";\nexport * from \"./utils/mergeSpec\";\nexport * from \"./utils/operationIdFormatter\";\nexport * from \"./utils/ref\";\nexport * from \"./utils/serializeEnumValues\";\nexport * from \"./utils/toJsonMapCollection\";\nexport * from \"./utils/toJsonRegex\";\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateSpec = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 =
|
|
5
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
6
|
const core_1 = require("@tsed/core");
|
|
7
7
|
const mapOpenSpec_1 = require("./mapOpenSpec");
|
|
8
8
|
const getSpec_1 = require("./getSpec");
|
|
@@ -37,7 +37,7 @@ async function generateSpec({ tokens, ...options }) {
|
|
|
37
37
|
let controllersSpec = (0, getSpec_1.getSpec)(tokens, options);
|
|
38
38
|
if (specType === SpecTypes_1.SpecTypes.SWAGGER) {
|
|
39
39
|
// @ts-ignore
|
|
40
|
-
const { convert } = await Promise.resolve().then(() =>
|
|
40
|
+
const { convert } = await Promise.resolve().then(() => tslib_1.__importStar(require("api-spec-converter")));
|
|
41
41
|
const { spec } = await convert({
|
|
42
42
|
from: "openapi_3",
|
|
43
43
|
to: "swagger_2",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSpec.js","sourceRoot":"","sources":["../../../src/utils/generateSpec.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"generateSpec.js","sourceRoot":"","sources":["../../../src/utils/generateSpec.ts"],"names":[],"mappings":";;;;AAAA,gEAA0B;AAC1B,qCAAoC;AAEpC,+CAA0C;AAC1C,uCAA2E;AAC3E,+CAAkD;AAClD,2CAAsC;AACtC,mDAA8C;AAW9C,KAAK,UAAU,QAAQ,CAAC,IAAY;IAClC,IAAI,kBAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACvB,IAAI;YACF,OAAO,MAAM,kBAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;SACpD;QAAC,OAAO,CAAC,EAAE,GAAE;KACf;IAED,0BAA0B;IAC1B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,YAAY,CAAC,EAAC,MAAM,EAAE,GAAG,OAAO,EAAsB;IAC1E,MAAM,EAAC,OAAO,GAAG,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAC,GAAG,OAAO,CAAC;IACxE,MAAM,QAAQ,GAAmC,QAAQ,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1F,MAAM,WAAW,GAAG,IAAA,yBAAW,EAAC,IAAA,eAAQ,EAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE;QAC7D,QAAQ;QACR,OAAO;QACP,WAAW;QACX,WAAW;KACZ,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAA,iCAAmB,EAAC,WAAW,CAAC,CAAC;IAElD,IAAI,eAAe,GAAG,IAAA,iBAAO,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/C,IAAI,QAAQ,KAAK,qBAAS,CAAC,OAAO,EAAE;QAClC,aAAa;QACb,MAAM,EAAC,OAAO,EAAC,GAAG,gEAAa,oBAAoB,GAAC,CAAC;QACrD,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,OAAO,CAAC;YAC3B,IAAI,EAAE,WAAW;YACjB,EAAE,EAAE,WAAW;YACf,MAAM,EAAE;gBACN,GAAG,eAAe;gBAClB,OAAO,EAAE,OAAO;aACjB;SACF,CAAC,CAAC;QACH,eAAe,GAAG,IAAI,CAAC;QACvB,OAAQ,eAAuB,CAAC,cAAc,CAAC,CAAC;KACjD;IAED,OAAO,IAAA,qBAAS,EAAC,WAAW,EAAE,eAAe,CAAQ,CAAC;AACxD,CAAC;AA/BD,oCA+BC","sourcesContent":["import fs from \"fs-extra\";\nimport {getValue} from \"@tsed/core\";\nimport {OpenSpec2, OpenSpec3} from \"@tsed/openspec\";\nimport {mapOpenSpec} from \"./mapOpenSpec\";\nimport {getSpec, JsonTokenOptions, SpecSerializerOptions} from \"./getSpec\";\nimport {getSpecTypeFromSpec} from \"./getSpecType\";\nimport {mergeSpec} from \"./mergeSpec\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\n\nexport interface GenerateSpecOptions extends Omit<SpecSerializerOptions, \"specType\"> {\n tokens: JsonTokenOptions;\n version?: string;\n acceptMimes?: string;\n specPath?: string;\n specVersion?: string;\n spec?: any;\n}\n\nasync function readSpec(path: string) {\n if (fs.existsSync(path)) {\n try {\n return await fs.readJSON(path, {encoding: \"utf8\"});\n } catch (e) {}\n }\n\n /* istanbul ignore next */\n return {};\n}\n\n/**\n * Generate OpenAPI spec from multiple sources (models, files, conf)\n * @param tokens\n * @param options\n */\nexport async function generateSpec({tokens, ...options}: GenerateSpecOptions): Promise<OpenSpec2 | OpenSpec3> {\n const {version = \"1.0.0\", acceptMimes, specPath, specVersion} = options;\n const fileSpec: Partial<OpenSpec2 | OpenSpec3> = specPath ? await readSpec(specPath) : {};\n\n const defaultSpec = mapOpenSpec(getValue(options, \"spec\", {}), {\n fileSpec,\n version,\n specVersion,\n acceptMimes\n });\n\n const specType = getSpecTypeFromSpec(defaultSpec);\n\n let controllersSpec = getSpec(tokens, options);\n\n if (specType === SpecTypes.SWAGGER) {\n // @ts-ignore\n const {convert} = await import(\"api-spec-converter\");\n const {spec} = await convert({\n from: \"openapi_3\",\n to: \"swagger_2\",\n source: {\n ...controllersSpec,\n openapi: \"3.0.1\"\n }\n });\n controllersSpec = spec;\n delete (controllersSpec as any)[\"x-components\"];\n }\n\n return mergeSpec(defaultSpec, controllersSpec) as any;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.matchGroups = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const micromatch_1 =
|
|
5
|
+
const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
|
|
6
6
|
/**
|
|
7
7
|
* @ignore
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchGroups.js","sourceRoot":"","sources":["../../../src/utils/matchGroups.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"matchGroups.js","sourceRoot":"","sources":["../../../src/utils/matchGroups.ts"],"names":[],"mappings":";;;;AAAA,oEAAoC;AAEpC;;GAEG;AACH,SAAgB,WAAW,CAAC,MAAgB,EAAE,cAAwB,EAAE;IACtE,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9G,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAExE,IAAI,cAAc,CAAC,MAAM,EAAE;QACzB,IAAI,WAAW,CAAC,MAAM,IAAI,IAAA,oBAAU,EAAC,cAAc,EAAE,WAAW,CAAC,CAAC,MAAM,EAAE;YACxE,OAAO,IAAI,CAAC;SACb;KACF;IAED,IAAI,cAAc,CAAC,MAAM,EAAE;QACzB,OAAO,CAAC,IAAA,oBAAU,EAChB,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAChD,WAAW,CACZ,CAAC,MAAM,CAAC;KACV;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAlBD,kCAkBC","sourcesContent":["import micromatch from \"micromatch\";\n\n/**\n * @ignore\n */\nexport function matchGroups(groups: string[], compareWith: string[] = []) {\n const groupsExcludes = groups.filter((group) => group.startsWith(\"!\")).map((group) => group.replace(\"!\", \"\"));\n const groupsIncludes = groups.filter((group) => !group.startsWith(\"!\"));\n\n if (groupsExcludes.length) {\n if (compareWith.length && micromatch(groupsExcludes, compareWith).length) {\n return true;\n }\n }\n\n if (groupsIncludes.length) {\n return !micromatch(\n groups.filter((group) => !group.startsWith(\"!\")),\n compareWith\n ).length;\n }\n\n return false;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/schema",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.110.0",
|
|
4
4
|
"description": "JsonSchema module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -32,29 +32,33 @@
|
|
|
32
32
|
"tsed"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tsed/openspec": "6.
|
|
35
|
+
"@tsed/openspec": "6.110.0",
|
|
36
36
|
"api-spec-converter": "2.12.0",
|
|
37
37
|
"camel-case": "4.1.2",
|
|
38
38
|
"fs-extra": "^10.0.1",
|
|
39
39
|
"json-schema": "0.4.0",
|
|
40
|
-
"micromatch": "4.0.
|
|
40
|
+
"micromatch": "4.0.5",
|
|
41
41
|
"pascal-case": "3.1.2",
|
|
42
42
|
"statuses": ">=2.0.1",
|
|
43
|
-
"tslib": "2.
|
|
43
|
+
"tslib": "2.3.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@apidevtools/swagger-parser": "10.0.
|
|
47
|
-
"@tsed/core": "6.
|
|
48
|
-
"@tsed/openspec": "6.
|
|
49
|
-
"@types/fs-extra": "9.0.
|
|
50
|
-
"@types/json-schema": "7.0.
|
|
51
|
-
"@types/micromatch": "4.0.
|
|
46
|
+
"@apidevtools/swagger-parser": "10.0.3",
|
|
47
|
+
"@tsed/core": "6.110.0",
|
|
48
|
+
"@tsed/openspec": "6.110.0",
|
|
49
|
+
"@types/fs-extra": "9.0.13",
|
|
50
|
+
"@types/json-schema": "7.0.11",
|
|
51
|
+
"@types/micromatch": "4.0.2",
|
|
52
52
|
"@types/statuses": "2.0.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@tsed/core": "^6.
|
|
55
|
+
"@tsed/core": "^6.110.0",
|
|
56
|
+
"@tsed/openspec": "^6.110.0"
|
|
56
57
|
},
|
|
57
58
|
"peerDependenciesMeta": {
|
|
59
|
+
"@tsed/openspec": {
|
|
60
|
+
"optional": false
|
|
61
|
+
},
|
|
58
62
|
"@tsed/core": {
|
|
59
63
|
"optional": false
|
|
60
64
|
}
|