@tsed/schema 8.26.0 → 8.26.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/esm/components/default/schemaMapper.js +0 -1
- package/lib/esm/decorators/operations/inFile.js +2 -3
- package/lib/esm/decorators/operations/returns.js +1 -0
- package/lib/esm/domain/JsonMethodStore.js +6 -4
- package/lib/esm/domain/JsonOperation.js +1 -0
- package/lib/esm/domain/JsonResponse.js +1 -0
- package/lib/esm/utils/mergeSchema.js +2 -4
- package/lib/types/components/open-spec/pathsMapper.d.ts +2 -1
- package/lib/types/domain/JsonParameter.d.ts +1 -1
- package/lib/types/domain/JsonParameterStore.d.ts +3 -3
- package/lib/types/domain/JsonSchema.d.ts +2 -1
- package/package.json +8 -8
|
@@ -29,7 +29,6 @@ function shouldMapAlias(key, value, useAlias) {
|
|
|
29
29
|
*/
|
|
30
30
|
function shouldSkipKey(key, { specType = SpecTypes.JSON, customKeys = false }) {
|
|
31
31
|
return (IGNORES.includes(key) ||
|
|
32
|
-
key.startsWith("x-") ||
|
|
33
32
|
(key.startsWith("#") && (!customKeys || specType !== SpecTypes.JSON)) ||
|
|
34
33
|
(specType !== SpecTypes.JSON && IGNORES_OPENSPEC.includes(key)));
|
|
35
34
|
}
|
|
@@ -29,12 +29,11 @@ import { Returns } from "./returns.js";
|
|
|
29
29
|
* @param name
|
|
30
30
|
*/
|
|
31
31
|
export function InFile(name) {
|
|
32
|
-
return (
|
|
33
|
-
const [target, propertyKey, index] = args;
|
|
32
|
+
return (target, propertyKey, index) => {
|
|
34
33
|
const multiple = Metadata.getParamTypes(target, propertyKey)[index] === Array;
|
|
35
34
|
name = (typeof name === "object" ? undefined : name);
|
|
36
35
|
const expression = [name, !multiple && "0"].filter(Boolean).join(".");
|
|
37
36
|
const decorators = useDecorators(In(JsonParameterTypes.FILES), Name(expression), useMethodDecorators(Returns(400).Description(`<File too long | Too many parts | Too many files | Field name too long | Field value too long | Too many fields | Unexpected field> [fieldName] Example: File too long file1`), Consumes("multipart/form-data")));
|
|
38
|
-
decorators(
|
|
37
|
+
decorators(target, propertyKey, index);
|
|
39
38
|
};
|
|
40
39
|
}
|
|
@@ -199,10 +199,12 @@ let JsonMethodStore = class JsonMethodStore extends JsonEntityStore {
|
|
|
199
199
|
return deepMerge(ctrlValue, this.store.get(key));
|
|
200
200
|
}
|
|
201
201
|
getParamTypes() {
|
|
202
|
-
return [...this.children.values()].reduce((obj, item) =>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
return [...this.children.values()].reduce((obj, item) => {
|
|
203
|
+
if (item.paramType) {
|
|
204
|
+
obj[item.paramType] = true;
|
|
205
|
+
}
|
|
206
|
+
return obj;
|
|
207
|
+
}, {});
|
|
206
208
|
}
|
|
207
209
|
build() {
|
|
208
210
|
this.parent.children.set(this.propertyName, this);
|
|
@@ -26,10 +26,8 @@ function mergeManyOf(kind, schema1, schema2) {
|
|
|
26
26
|
const { [kind]: kind1, ...$rest1 } = schema1;
|
|
27
27
|
const { [kind]: kind2, ...$rest2 } = schema2;
|
|
28
28
|
let hasRef = false;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
.filter(Boolean)
|
|
32
|
-
.reduce((map, schema, index) => {
|
|
29
|
+
const schemas = [kind1, $rest1, kind2, $rest2].flat().filter(Boolean);
|
|
30
|
+
const map = schemas.reduce((map, schema, index) => {
|
|
33
31
|
schema = cleanObject(schema);
|
|
34
32
|
if (schema.$ref) {
|
|
35
33
|
hasRef = true;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { OS3Paths } from "@tsed/openspec";
|
|
1
2
|
import { JsonSchemaOptions } from "../../interfaces/JsonSchemaOptions.js";
|
|
2
|
-
export declare function pathsMapper(model: any, { paths, rootPath, ...options }: JsonSchemaOptions):
|
|
3
|
+
export declare function pathsMapper(model: any, { paths, rootPath, ...options }: JsonSchemaOptions): OS3Paths<import("@tsed/openspec").OS3Schema>;
|
|
@@ -39,7 +39,7 @@ import { JsonSchema } from "./JsonSchema.js";
|
|
|
39
39
|
*/
|
|
40
40
|
export declare class JsonParameter extends JsonMap<OS3Parameter<JsonSchema>> {
|
|
41
41
|
$kind: string;
|
|
42
|
-
expression: string;
|
|
42
|
+
expression: string | undefined;
|
|
43
43
|
constructor(obj?: Partial<OS3Parameter<JsonSchema>>);
|
|
44
44
|
getName(): any;
|
|
45
45
|
name(name: string): this;
|
|
@@ -108,9 +108,9 @@ export interface PipeMethods<T = any, R = any> {
|
|
|
108
108
|
* @public
|
|
109
109
|
*/
|
|
110
110
|
export declare class JsonParameterStore extends JsonEntityStore {
|
|
111
|
-
paramType
|
|
112
|
-
expression
|
|
113
|
-
dataPath
|
|
111
|
+
paramType?: string;
|
|
112
|
+
expression?: string;
|
|
113
|
+
dataPath?: string;
|
|
114
114
|
/**
|
|
115
115
|
* Define pipes can be called by the framework to transform input parameter
|
|
116
116
|
*/
|
|
@@ -20,6 +20,7 @@ import type { Infer, PropsToShape, SchemaKey, SchemaMerge, SchemaOmit, SchemaPar
|
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
22
|
export interface JsonSchemaObject extends Omit<JSONSchema7, "type" | "additionalProperties" | "items" | "pattern"> {
|
|
23
|
+
[key: `x-${string}`]: unknown;
|
|
23
24
|
type?: JSONSchema7["type"] | Type | null | (String | null | Date | Number | Object | Boolean)[];
|
|
24
25
|
additionalProperties?: JsonSchemaObject | boolean | Type | JsonSchema;
|
|
25
26
|
items?: JsonSchemaObject | boolean | Type | JsonSchema | (JsonSchemaObject | Type | JsonSchema)[];
|
|
@@ -96,7 +97,7 @@ export declare class JsonSchema<T = JSONSchema7Type> extends Map<string, any> {
|
|
|
96
97
|
readonly $isJsonDocument = true;
|
|
97
98
|
readonly $hooks: Hooks;
|
|
98
99
|
readonly $allow: any[];
|
|
99
|
-
$selfRequired
|
|
100
|
+
$selfRequired?: boolean;
|
|
100
101
|
$ignore: boolean | IgnoreCallback;
|
|
101
102
|
isDiscriminatorKey: boolean;
|
|
102
103
|
isDiscriminator: boolean;
|
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.26.
|
|
5
|
+
"version": "8.26.1",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"tsed"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tsed/openspec": "8.26.
|
|
37
|
+
"@tsed/openspec": "8.26.1",
|
|
38
38
|
"change-case": "^5.4.4",
|
|
39
39
|
"json-schema": "0.4.0",
|
|
40
40
|
"picomatch": "4.0.4",
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@apidevtools/swagger-parser": "10.1.0",
|
|
46
|
-
"@tsed/barrels": "8.26.
|
|
47
|
-
"@tsed/core": "8.26.
|
|
48
|
-
"@tsed/hooks": "8.26.
|
|
49
|
-
"@tsed/openspec": "8.26.
|
|
50
|
-
"@tsed/typescript": "8.26.
|
|
46
|
+
"@tsed/barrels": "8.26.1",
|
|
47
|
+
"@tsed/core": "8.26.1",
|
|
48
|
+
"@tsed/hooks": "8.26.1",
|
|
49
|
+
"@tsed/openspec": "8.26.1",
|
|
50
|
+
"@tsed/typescript": "8.26.1",
|
|
51
51
|
"@types/fs-extra": "11.0.4",
|
|
52
52
|
"@types/json-schema": "7.0.15",
|
|
53
53
|
"@types/picomatch": "3.0.2",
|
|
54
54
|
"@types/statuses": "2.0.5",
|
|
55
55
|
"ajv": "^8.17.1",
|
|
56
56
|
"eslint": "9.12.0",
|
|
57
|
-
"typescript": "
|
|
57
|
+
"typescript": "6.0.2",
|
|
58
58
|
"vitest": "3.2.4"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|