@tsed/schema 8.0.0-beta.8 → 8.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/schema.umd.min.js +1 -1
- package/lib/browser/schema.umd.min.js.map +1 -1
- package/lib/esm/decorators/common/format.js +0 -6
- package/lib/esm/decorators/common/format.js.map +1 -1
- package/lib/esm/utils/generateSpec.js +7 -16
- package/lib/esm/utils/generateSpec.js.map +1 -1
- package/lib/types/decorators/common/format.d.ts +0 -6
- package/lib/types/utils/generateSpec.d.ts +3 -2
- package/package.json +9 -9
|
@@ -138,7 +138,6 @@ export const Format = withErrorMsg("format", (format) => {
|
|
|
138
138
|
* }
|
|
139
139
|
* ```
|
|
140
140
|
*
|
|
141
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
142
141
|
* @returns {Function}
|
|
143
142
|
* @decorator
|
|
144
143
|
* @validation
|
|
@@ -204,7 +203,6 @@ export const Email = withErrorMsg("format", () => {
|
|
|
204
203
|
* }
|
|
205
204
|
* ```
|
|
206
205
|
*
|
|
207
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
208
206
|
* @returns {Function}
|
|
209
207
|
* @decorator
|
|
210
208
|
* @validation
|
|
@@ -271,7 +269,6 @@ export const DateTime = withErrorMsg("format", () => {
|
|
|
271
269
|
* }
|
|
272
270
|
* ```
|
|
273
271
|
*
|
|
274
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
275
272
|
* @returns {Function}
|
|
276
273
|
* @decorator
|
|
277
274
|
* @validation
|
|
@@ -337,7 +334,6 @@ export const DateFormat = withErrorMsg("format", () => {
|
|
|
337
334
|
* }
|
|
338
335
|
* ```
|
|
339
336
|
*
|
|
340
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
341
337
|
* @returns {Function}
|
|
342
338
|
* @decorator
|
|
343
339
|
* @validation
|
|
@@ -403,7 +399,6 @@ export const TimeFormat = withErrorMsg("format", () => {
|
|
|
403
399
|
* }
|
|
404
400
|
* ```
|
|
405
401
|
*
|
|
406
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
407
402
|
* @returns {Function}
|
|
408
403
|
* @decorator
|
|
409
404
|
* @validation
|
|
@@ -469,7 +464,6 @@ export const Uri = withErrorMsg("format", () => {
|
|
|
469
464
|
* }
|
|
470
465
|
* ```
|
|
471
466
|
*
|
|
472
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
473
467
|
* @returns {Function}
|
|
474
468
|
* @decorator
|
|
475
469
|
* @validation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/decorators/common/format.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAkD,EAAE,EAAE;IAClG,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/decorators/common/format.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE;IAC7C,OAAO,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE;IAC7C,OAAO,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC"}
|
|
@@ -5,27 +5,13 @@ import { getSpecTypeFromSpec } from "./getSpecType.js";
|
|
|
5
5
|
import { mapOpenSpec } from "./mapOpenSpec.js";
|
|
6
6
|
import { mergeSpec } from "./mergeSpec.js";
|
|
7
7
|
import { transformToOS2 } from "./transformToOS2.js";
|
|
8
|
-
/* node_env:start */
|
|
9
|
-
async function readSpec(path) {
|
|
10
|
-
const { default: fs } = await import("fs-extra");
|
|
11
|
-
if (fs.existsSync(path)) {
|
|
12
|
-
try {
|
|
13
|
-
return await fs.readJSON(path, { encoding: "utf8" });
|
|
14
|
-
}
|
|
15
|
-
catch (e) { }
|
|
16
|
-
}
|
|
17
|
-
/* istanbul ignore next */
|
|
18
|
-
return {};
|
|
19
|
-
}
|
|
20
|
-
/* node_env:end */
|
|
21
8
|
/**
|
|
22
9
|
* Generate OpenAPI spec from multiple sources (models, files, conf)
|
|
23
10
|
* @param tokens
|
|
24
11
|
* @param options
|
|
25
12
|
*/
|
|
26
|
-
export
|
|
27
|
-
const { version = "1.0.0", acceptMimes,
|
|
28
|
-
const fileSpec = /* node_env:start */ specPath ? await readSpec(specPath) : /* node_env:end */ {};
|
|
13
|
+
export function generateSpec({ tokens, ...options }) {
|
|
14
|
+
const { version = "1.0.0", acceptMimes, fileSpec = {}, specVersion } = options;
|
|
29
15
|
const defaultSpec = mapOpenSpec(getValue(options, "spec", {}), {
|
|
30
16
|
fileSpec,
|
|
31
17
|
version,
|
|
@@ -35,6 +21,11 @@ export async function generateSpec({ tokens, ...options }) {
|
|
|
35
21
|
const specType = getSpecTypeFromSpec(defaultSpec);
|
|
36
22
|
let controllersSpec = getSpec(tokens, options);
|
|
37
23
|
const spec = mergeSpec(defaultSpec, controllersSpec);
|
|
24
|
+
if (options.sortPaths) {
|
|
25
|
+
spec.paths = Object.fromEntries(Object.entries(spec.paths).sort(([k1], [k2]) => {
|
|
26
|
+
return k1.localeCompare(k2);
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
38
29
|
if (specType === SpecTypes.SWAGGER) {
|
|
39
30
|
return transformToOS2(spec);
|
|
40
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSpec.js","sourceRoot":"","sources":["../../../src/utils/generateSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,OAAO,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"generateSpec.js","sourceRoot":"","sources":["../../../src/utils/generateSpec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAC,OAAO,EAA0C,MA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
|
|
@@ -133,7 +133,6 @@ export declare const Format: import("../../utils/withErrorMsg.js").ErrorChainedD
|
|
|
133
133
|
* }
|
|
134
134
|
* ```
|
|
135
135
|
*
|
|
136
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
137
136
|
* @returns {Function}
|
|
138
137
|
* @decorator
|
|
139
138
|
* @validation
|
|
@@ -197,7 +196,6 @@ export declare const Email: import("../../utils/withErrorMsg.js").ErrorChainedDe
|
|
|
197
196
|
* }
|
|
198
197
|
* ```
|
|
199
198
|
*
|
|
200
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
201
199
|
* @returns {Function}
|
|
202
200
|
* @decorator
|
|
203
201
|
* @validation
|
|
@@ -262,7 +260,6 @@ export declare const DateTime: import("../../utils/withErrorMsg.js").ErrorChaine
|
|
|
262
260
|
* }
|
|
263
261
|
* ```
|
|
264
262
|
*
|
|
265
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
266
263
|
* @returns {Function}
|
|
267
264
|
* @decorator
|
|
268
265
|
* @validation
|
|
@@ -326,7 +323,6 @@ export declare const DateFormat: import("../../utils/withErrorMsg.js").ErrorChai
|
|
|
326
323
|
* }
|
|
327
324
|
* ```
|
|
328
325
|
*
|
|
329
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
330
326
|
* @returns {Function}
|
|
331
327
|
* @decorator
|
|
332
328
|
* @validation
|
|
@@ -390,7 +386,6 @@ export declare const TimeFormat: import("../../utils/withErrorMsg.js").ErrorChai
|
|
|
390
386
|
* }
|
|
391
387
|
* ```
|
|
392
388
|
*
|
|
393
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
394
389
|
* @returns {Function}
|
|
395
390
|
* @decorator
|
|
396
391
|
* @validation
|
|
@@ -454,7 +449,6 @@ export declare const Uri: import("../../utils/withErrorMsg.js").ErrorChainedDeco
|
|
|
454
449
|
* }
|
|
455
450
|
* ```
|
|
456
451
|
*
|
|
457
|
-
* > See [Format](api/common/jsonschema/schema) decorator.
|
|
458
452
|
* @returns {Function}
|
|
459
453
|
* @decorator
|
|
460
454
|
* @validation
|
|
@@ -4,13 +4,14 @@ export interface GenerateSpecOptions extends Omit<SpecSerializerOptions, "specTy
|
|
|
4
4
|
tokens: JsonTokenOptions;
|
|
5
5
|
version?: string;
|
|
6
6
|
acceptMimes?: string;
|
|
7
|
-
specPath?: string;
|
|
8
7
|
specVersion?: string;
|
|
9
8
|
spec?: any;
|
|
9
|
+
fileSpec?: any;
|
|
10
|
+
sortPaths?: boolean;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Generate OpenAPI spec from multiple sources (models, files, conf)
|
|
13
14
|
* @param tokens
|
|
14
15
|
* @param options
|
|
15
16
|
*/
|
|
16
|
-
export declare function generateSpec({ tokens, ...options }: GenerateSpecOptions):
|
|
17
|
+
export declare function generateSpec({ tokens, ...options }: GenerateSpecOptions): OpenSpec2 | OpenSpec3;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/schema",
|
|
3
3
|
"description": "JsonSchema module for Ts.ED Framework",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.0.0-
|
|
5
|
+
"version": "8.0.0-rc.1",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"tsed"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@tsed/openspec": "8.0.0-
|
|
39
|
+
"@tsed/openspec": "8.0.0-rc.1",
|
|
40
40
|
"change-case": "^5.4.4",
|
|
41
41
|
"fs-extra": "^11.2.0",
|
|
42
42
|
"json-schema": "0.4.0",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@apidevtools/swagger-parser": "10.1.0",
|
|
49
|
-
"@tsed/barrels": "8.0.0-
|
|
50
|
-
"@tsed/core": "8.0.0-
|
|
51
|
-
"@tsed/openspec": "8.0.0-
|
|
52
|
-
"@tsed/typescript": "8.0.0-
|
|
49
|
+
"@tsed/barrels": "8.0.0-rc.1",
|
|
50
|
+
"@tsed/core": "8.0.0-rc.1",
|
|
51
|
+
"@tsed/openspec": "8.0.0-rc.1",
|
|
52
|
+
"@tsed/typescript": "8.0.0-rc.1",
|
|
53
53
|
"@types/fs-extra": "11.0.4",
|
|
54
54
|
"@types/json-schema": "7.0.15",
|
|
55
55
|
"@types/picomatch": "3.0.1",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"webpack": "^5.75.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@tsed/core": "8.0.0-
|
|
66
|
-
"@tsed/openspec": "8.0.0-
|
|
65
|
+
"@tsed/core": "8.0.0-rc.1",
|
|
66
|
+
"@tsed/openspec": "8.0.0-rc.1"
|
|
67
67
|
},
|
|
68
68
|
"peerDependenciesMeta": {
|
|
69
69
|
"@tsed/core": {
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
"author": "Romain Lenzotti",
|
|
82
82
|
"license": "MIT",
|
|
83
83
|
"publishConfig": {
|
|
84
|
-
"tag": "
|
|
84
|
+
"tag": "rc"
|
|
85
85
|
}
|
|
86
86
|
}
|