@adaptivestone/framework 3.4.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,7 @@
1
+ ### 3.4.1
2
+
3
+ [FIX] fix documentation generation
4
+
1
5
  ### 3.4.0
2
6
 
3
7
  [NEW] now we pass 'req' to validation and casting as a second parameter. This done mostly for custom validators
@@ -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
- let fullName = authParam.name;
99
+ const fullName = authParam.name;
100
100
  if (permissions) {
101
- fullName = `${fullName}-permissions-${permissions}`;
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 = routeDescription;
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptivestone/framework",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "Adaptive stone node js framework",
5
5
  "main": "src/index.js",
6
6
  "engines": {