@adaptivestone/framework 3.3.0 → 3.4.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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
### 3.4.1
|
|
2
|
+
|
|
3
|
+
[FIX] fix documentation generation
|
|
4
|
+
|
|
5
|
+
### 3.4.0
|
|
6
|
+
|
|
7
|
+
[NEW] now we pass 'req' to validation and casting as a second parameter. This done mostly for custom validators
|
|
8
|
+
|
|
1
9
|
### 3.3.0
|
|
2
10
|
|
|
3
11
|
[NEW] new command 'SyncIndexes' to sync indexes for mongodb https://framework.adaptivestone.com/docs/cli#syncindexes
|
|
@@ -90,15 +90,15 @@ class GetOpenApiJson extends AbstractCommand {
|
|
|
90
90
|
];
|
|
91
91
|
|
|
92
92
|
const securitySchemaNames = [];
|
|
93
|
-
|
|
93
|
+
let permissionString = '';
|
|
94
94
|
if (middlewares?.length) {
|
|
95
95
|
for (const middleware of middlewares) {
|
|
96
96
|
if (middleware?.authParams?.length) {
|
|
97
97
|
for (const authParam of middleware.authParams) {
|
|
98
98
|
const { permissions, ...mainFields } = authParam;
|
|
99
|
-
|
|
99
|
+
const fullName = authParam.name;
|
|
100
100
|
if (permissions) {
|
|
101
|
-
|
|
101
|
+
permissionString = permissions;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
if (!openApi.components.securitySchemes[fullName]) {
|
|
@@ -148,10 +148,12 @@ class GetOpenApiJson extends AbstractCommand {
|
|
|
148
148
|
openApi.paths[routeName] = {};
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
const methodName = route[Object.keys(route)[0]].method.toLowerCase();
|
|
152
|
-
const routeTitle = route[Object.keys(route)[0]].name;
|
|
153
151
|
const routeDescription =
|
|
154
152
|
route[Object.keys(route)[0]]?.description || 'empty description';
|
|
153
|
+
const routeDescriptionWithPermissions = `${permissionString} ${routeDescription}`;
|
|
154
|
+
const methodName = route[Object.keys(route)[0]].method.toLowerCase();
|
|
155
|
+
const routeTitle = route[Object.keys(route)[0]].name;
|
|
156
|
+
|
|
155
157
|
const routeFields = route[Object.keys(route)[0]].fields;
|
|
156
158
|
|
|
157
159
|
if (!openApi.paths[routeName][methodName]) {
|
|
@@ -165,7 +167,8 @@ class GetOpenApiJson extends AbstractCommand {
|
|
|
165
167
|
);
|
|
166
168
|
|
|
167
169
|
openApi.paths[routeName][methodName].summary = routeTitle;
|
|
168
|
-
openApi.paths[routeName][methodName].description =
|
|
170
|
+
openApi.paths[routeName][methodName].description =
|
|
171
|
+
routeDescriptionWithPermissions;
|
|
169
172
|
openApi.paths[routeName][methodName].parameters = [];
|
|
170
173
|
openApi.paths[routeName][methodName].security = securitySchemaNames;
|
|
171
174
|
|
|
@@ -210,6 +210,7 @@ class AbstractController extends Base {
|
|
|
210
210
|
try {
|
|
211
211
|
await routeObject.request.validate(bodyAndQuery, {
|
|
212
212
|
abortEarly: controllerValidationAbortEarly,
|
|
213
|
+
req,
|
|
213
214
|
});
|
|
214
215
|
} catch (e) {
|
|
215
216
|
let { errors } = e;
|
|
@@ -243,6 +244,7 @@ class AbstractController extends Base {
|
|
|
243
244
|
bodyAndQuery,
|
|
244
245
|
{
|
|
245
246
|
stripUnknown: true,
|
|
247
|
+
req,
|
|
246
248
|
},
|
|
247
249
|
);
|
|
248
250
|
}
|