@nestia/sdk 9.0.0 → 9.0.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.
- package/lib/generates/internal/FilePrinter.js +9 -1
- package/lib/generates/internal/FilePrinter.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.js +35 -29
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
- package/package.json +4 -4
- package/src/generates/internal/FilePrinter.ts +9 -1
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +23 -38
|
@@ -21,7 +21,15 @@ var FilePrinter;
|
|
|
21
21
|
FilePrinter.description = (node, comment) => {
|
|
22
22
|
if (comment.length === 0)
|
|
23
23
|
return node;
|
|
24
|
-
typescript_1.default.addSyntheticLeadingComment(node, typescript_1.default.SyntaxKind.MultiLineCommentTrivia, [
|
|
24
|
+
typescript_1.default.addSyntheticLeadingComment(node, typescript_1.default.SyntaxKind.MultiLineCommentTrivia, [
|
|
25
|
+
"*",
|
|
26
|
+
...comment
|
|
27
|
+
.split("\r\n")
|
|
28
|
+
.join("\n")
|
|
29
|
+
.split("\n")
|
|
30
|
+
.map((str) => ` * ${str.split("*/").join("*\\/")}`),
|
|
31
|
+
"",
|
|
32
|
+
].join("\n"), true);
|
|
25
33
|
return node;
|
|
26
34
|
};
|
|
27
35
|
FilePrinter.enter = () => typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createIdentifier("\n"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePrinter.js","sourceRoot":"","sources":["../../../src/generates/internal/FilePrinter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,uCAAkC;AAClC,4DAA4B;AAE5B,IAAiB,WAAW,
|
|
1
|
+
{"version":3,"file":"FilePrinter.js","sourceRoot":"","sources":["../../../src/generates/internal/FilePrinter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,uCAAk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AC,EAC1C,MAAM,CACP,CAAC;IACJ,CAAC,CAAA,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAO,MAAc,EAAmB,EAAE;QACzD,IAAI,CAAC;YACH,OAAO,MAAM,IAAA,iBAAM,EAAC,MAAM,EAAE;gBAC1B,MAAM,EAAE,YAAY;aACrB,CAAC,CAAC;QACL,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EAxDgB,WAAW,2BAAX,WAAW,QAwD3B"}
|
|
@@ -29,33 +29,33 @@ var SwaggerOperationParameterComposer;
|
|
|
29
29
|
},
|
|
30
30
|
}, required: props.parameter.metadata.isRequired() }, (props.parameter.encrypted ? { "x-nestia-encrypted": true } : {}));
|
|
31
31
|
};
|
|
32
|
-
SwaggerOperationParameterComposer.path = (props) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
jsDocTags: props.parameter.jsDocTags,
|
|
42
|
-
kind: "title",
|
|
43
|
-
})), { example: props.parameter.example, examples: props.parameter.examples }));
|
|
44
|
-
};
|
|
32
|
+
SwaggerOperationParameterComposer.path = (props) => ({
|
|
33
|
+
name: props.parameter.field,
|
|
34
|
+
in: "path",
|
|
35
|
+
schema: props.schema,
|
|
36
|
+
required: props.parameter.metadata.isRequired(),
|
|
37
|
+
description: parameterDescription(props),
|
|
38
|
+
example: props.parameter.example,
|
|
39
|
+
examples: props.parameter.examples,
|
|
40
|
+
});
|
|
45
41
|
SwaggerOperationParameterComposer.query = (props) => decomposible(props);
|
|
46
42
|
SwaggerOperationParameterComposer.header = (props) => decomposible(props);
|
|
43
|
+
const parameterDescription = (props) => {
|
|
44
|
+
var _a, _b, _c, _d, _e, _f;
|
|
45
|
+
return ((_d = (_a = props.parameter.description) !== null && _a !== void 0 ? _a : (_c = (_b = props.parameter.jsDocTags.find((tag) => tag.name === "description")) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c[0].text) !== null && _d !== void 0 ? _d : (_f = (_e = props.jsDocTags
|
|
46
|
+
.find((tag) => { var _a; return tag.name === "param" && ((_a = tag.text) === null || _a === void 0 ? void 0 : _a[0].text) === props.parameter.name; })) === null || _e === void 0 ? void 0 : _e.text) === null || _f === void 0 ? void 0 : _f.map((e) => e.text).join("").substring(props.parameter.name.length).trim());
|
|
47
|
+
};
|
|
47
48
|
const decomposible = (props) => {
|
|
48
|
-
var _a
|
|
49
|
-
const param =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
})), { required: props.parameter.metadata.isRequired(), example: props.parameter.example, examples: props.parameter.examples });
|
|
49
|
+
var _a;
|
|
50
|
+
const param = {
|
|
51
|
+
name: (_a = props.parameter.field) !== null && _a !== void 0 ? _a : props.parameter.name,
|
|
52
|
+
in: props.parameter.category === "query" ? "query" : "header",
|
|
53
|
+
schema: props.schema,
|
|
54
|
+
description: parameterDescription(props),
|
|
55
|
+
required: props.parameter.metadata.isRequired(),
|
|
56
|
+
example: props.parameter.example,
|
|
57
|
+
examples: props.parameter.examples,
|
|
58
|
+
};
|
|
59
59
|
if (props.config.decompose === false ||
|
|
60
60
|
props.parameter.metadata.objects.length === 0)
|
|
61
61
|
return [param];
|
|
@@ -73,11 +73,17 @@ var SwaggerOperationParameterComposer;
|
|
|
73
73
|
(_c = (_f = props.document.components).schemas) !== null && _c !== void 0 ? _c : (_f.schemas = {});
|
|
74
74
|
Object.assign(props.document.components.schemas, json.components.schemas);
|
|
75
75
|
}
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
return {
|
|
77
|
+
name: p.key.constants[0].values[0].value,
|
|
78
|
+
in: props.parameter.category === "query" ? "query" : "header",
|
|
79
|
+
schema: json.schemas[0],
|
|
80
|
+
required: p.value.isRequired(),
|
|
81
|
+
description: SwaggerDescriptionComposer_1.SwaggerDescriptionComposer.compose({
|
|
82
|
+
description: (_d = p.description) !== null && _d !== void 0 ? _d : null,
|
|
83
|
+
jsDocTags: p.jsDocTags,
|
|
84
|
+
kind: "title",
|
|
85
|
+
}).description,
|
|
86
|
+
};
|
|
81
87
|
});
|
|
82
88
|
};
|
|
83
89
|
})(SwaggerOperationParameterComposer || (exports.SwaggerOperationParameterComposer = SwaggerOperationParameterComposer = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwaggerOperationParameterComposer.js","sourceRoot":"","sources":["../../../src/generates/internal/SwaggerOperationParameterComposer.ts"],"names":[],"mappings":";;;AACA,+BAAyC;AAEzC,4FAAyF;AAIzF,6EAA0E;AAE1E,IAAiB,iCAAiC,
|
|
1
|
+
{"version":3,"file":"SwaggerOperationParameterComposer.js","sourceRoot":"","sources":["../../../src/generates/internal/SwaggerOperationParameterComposer.ts"],"names":[],"mappings":";;;AACA,+BAAyC;AAEzC,4FAAyF;AAIzF,6EAA0E;AAE1E,IAAiB,iCAAiC,CAuIjD;AAvID,WAAiB,iCAAiC;IASnC,yCAAO,GAAG,CACrB,KAAuC,EACN,EAAE,CACnC,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,MAAM;QACjC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,OAAO;YACpC,CAAC,CAAC,CAAC,kCAAA,IAAI,iCAAM,KAAK,KAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAAG,CAAC;YAClD,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,OAAO;gBACpC,CAAC,CAAC,kCAAA,KAAK,iCAAM,KAAK,KAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAAG;gBACjD,CAAC,CAAC,kCAAA,MAAM,iCAAM,KAAK,KAAE,SAAS,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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/sdk",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "Nestia SDK and Swagger generator",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://nestia.io",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nestia/core": "^9.0.
|
|
36
|
-
"@nestia/fetcher": "^9.0.
|
|
35
|
+
"@nestia/core": "^9.0.2",
|
|
36
|
+
"@nestia/fetcher": "^9.0.2",
|
|
37
37
|
"@samchon/openapi": "^5.0.0",
|
|
38
38
|
"cli": "^1.0.1",
|
|
39
39
|
"get-function-location": "^2.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typia": "^10.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@nestia/core": ">=9.0.
|
|
50
|
+
"@nestia/core": ">=9.0.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@nestjs/common": "^11.0.13",
|
|
@@ -11,7 +11,15 @@ export namespace FilePrinter {
|
|
|
11
11
|
ts.addSyntheticLeadingComment(
|
|
12
12
|
node,
|
|
13
13
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
14
|
-
[
|
|
14
|
+
[
|
|
15
|
+
"*",
|
|
16
|
+
...comment
|
|
17
|
+
.split("\r\n")
|
|
18
|
+
.join("\n")
|
|
19
|
+
.split("\n")
|
|
20
|
+
.map((str) => ` * ${str.split("*/").join("*\\/")}`),
|
|
21
|
+
"",
|
|
22
|
+
].join("\n"),
|
|
15
23
|
true,
|
|
16
24
|
);
|
|
17
25
|
return node;
|
|
@@ -59,24 +59,7 @@ export namespace SwaggerOperationParameterComposer {
|
|
|
59
59
|
in: "path",
|
|
60
60
|
schema: props.schema,
|
|
61
61
|
required: props.parameter.metadata.isRequired(),
|
|
62
|
-
|
|
63
|
-
description:
|
|
64
|
-
props.parameter.description ??
|
|
65
|
-
props.parameter.jsDocTags.find((tag) => tag.name === "description")
|
|
66
|
-
?.text?.[0].text ??
|
|
67
|
-
props.jsDocTags
|
|
68
|
-
.find(
|
|
69
|
-
(tag) =>
|
|
70
|
-
tag.name === "param" &&
|
|
71
|
-
tag.text?.[0].text === props.parameter.name,
|
|
72
|
-
)
|
|
73
|
-
?.text?.map((e) => e.text)
|
|
74
|
-
.join("")
|
|
75
|
-
.substring(props.parameter.name.length) ??
|
|
76
|
-
null,
|
|
77
|
-
jsDocTags: props.parameter.jsDocTags,
|
|
78
|
-
kind: "title",
|
|
79
|
-
}),
|
|
62
|
+
description: parameterDescription(props),
|
|
80
63
|
example: props.parameter.example,
|
|
81
64
|
examples: props.parameter.examples,
|
|
82
65
|
});
|
|
@@ -89,6 +72,25 @@ export namespace SwaggerOperationParameterComposer {
|
|
|
89
72
|
props: IProps<ITypedHttpRouteParameter.IHeaders>,
|
|
90
73
|
): OpenApi.IOperation.IParameter[] => decomposible(props);
|
|
91
74
|
|
|
75
|
+
const parameterDescription = (
|
|
76
|
+
props: Pick<IProps<ITypedHttpRouteParameter>, "parameter" | "jsDocTags">,
|
|
77
|
+
): string | undefined => {
|
|
78
|
+
return (
|
|
79
|
+
props.parameter.description ??
|
|
80
|
+
props.parameter.jsDocTags.find((tag) => tag.name === "description")
|
|
81
|
+
?.text?.[0].text ??
|
|
82
|
+
props.jsDocTags
|
|
83
|
+
.find(
|
|
84
|
+
(tag) =>
|
|
85
|
+
tag.name === "param" && tag.text?.[0].text === props.parameter.name,
|
|
86
|
+
)
|
|
87
|
+
?.text?.map((e) => e.text)
|
|
88
|
+
.join("")
|
|
89
|
+
.substring(props.parameter.name.length)
|
|
90
|
+
.trim()
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
92
94
|
const decomposible = (
|
|
93
95
|
props: IProps<
|
|
94
96
|
ITypedHttpRouteParameter.IHeaders | ITypedHttpRouteParameter.IQuery
|
|
@@ -98,24 +100,7 @@ export namespace SwaggerOperationParameterComposer {
|
|
|
98
100
|
name: props.parameter.field ?? props.parameter.name,
|
|
99
101
|
in: props.parameter.category === "query" ? "query" : "header",
|
|
100
102
|
schema: props.schema,
|
|
101
|
-
|
|
102
|
-
description:
|
|
103
|
-
props.parameter.description ??
|
|
104
|
-
props.parameter.jsDocTags.find((tag) => tag.name === "description")
|
|
105
|
-
?.text?.[0].text ??
|
|
106
|
-
props.jsDocTags
|
|
107
|
-
.find(
|
|
108
|
-
(tag) =>
|
|
109
|
-
tag.name === "param" &&
|
|
110
|
-
tag.text?.[0].text === props.parameter.name,
|
|
111
|
-
)
|
|
112
|
-
?.text?.map((e) => e.text)
|
|
113
|
-
.join("")
|
|
114
|
-
.substring(props.parameter.name.length) ??
|
|
115
|
-
null,
|
|
116
|
-
jsDocTags: props.jsDocTags,
|
|
117
|
-
kind: "title",
|
|
118
|
-
}),
|
|
103
|
+
description: parameterDescription(props),
|
|
119
104
|
required: props.parameter.metadata.isRequired(),
|
|
120
105
|
example: props.parameter.example,
|
|
121
106
|
examples: props.parameter.examples,
|
|
@@ -149,11 +134,11 @@ export namespace SwaggerOperationParameterComposer {
|
|
|
149
134
|
in: props.parameter.category === "query" ? "query" : "header",
|
|
150
135
|
schema: json.schemas[0],
|
|
151
136
|
required: p.value.isRequired(),
|
|
152
|
-
|
|
137
|
+
description: SwaggerDescriptionComposer.compose({
|
|
153
138
|
description: p.description ?? null,
|
|
154
139
|
jsDocTags: p.jsDocTags,
|
|
155
140
|
kind: "title",
|
|
156
|
-
}),
|
|
141
|
+
}).description,
|
|
157
142
|
};
|
|
158
143
|
});
|
|
159
144
|
};
|