@tsed/schema 8.0.0-beta.9 → 8.0.0-rc.2

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.
@@ -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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,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 async function generateSpec({ tokens, ...options }) {
27
- const { version = "1.0.0", acceptMimes, specPath, specVersion } = options;
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,QA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AI,eAAe,GAAQ,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,SAAS,CAAC,WAAW,EAAE,eAAe,CAA0B,CAAC;IAE9E,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAC7B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;YAC9C,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,KAAK,SAAS,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,cAAc,CAAC,IAAI,CAAQ,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -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): Promise<OpenSpec2 | OpenSpec3>;
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-beta.9",
5
+ "version": "8.0.0-rc.2",
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-beta.9",
39
+ "@tsed/openspec": "8.0.0-rc.2",
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-beta.9",
50
- "@tsed/core": "8.0.0-beta.9",
51
- "@tsed/openspec": "8.0.0-beta.9",
52
- "@tsed/typescript": "8.0.0-beta.9",
49
+ "@tsed/barrels": "8.0.0-rc.2",
50
+ "@tsed/core": "8.0.0-rc.2",
51
+ "@tsed/openspec": "8.0.0-rc.2",
52
+ "@tsed/typescript": "8.0.0-rc.2",
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-beta.9",
66
- "@tsed/openspec": "8.0.0-beta.9"
65
+ "@tsed/core": "8.0.0-rc.2",
66
+ "@tsed/openspec": "8.0.0-rc.2"
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": "beta"
84
+ "tag": "rc"
85
85
  }
86
86
  }