@ibabkin/openapi-express-server 1.2.0 → 1.4.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routeExtractor.d.ts","sourceRoot":"","sources":["../lib/routeExtractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routeExtractor.d.ts","sourceRoot":"","sources":["../lib/routeExtractor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,GAAG,aAAa,EAAE,CA0CvE;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvE"}
|
package/esm/routeExtractor.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toIdentifier } from '@ibabkin/openapi-to-server/identifier';
|
|
1
2
|
export function extractRoutes(spec) {
|
|
2
3
|
const routes = [];
|
|
3
4
|
if (!spec.paths) {
|
|
@@ -18,7 +19,7 @@ export function extractRoutes(spec) {
|
|
|
18
19
|
console.warn(`Operation ${operation.operationId} has no tags, skipping`);
|
|
19
20
|
continue;
|
|
20
21
|
}
|
|
21
|
-
const controllerName =
|
|
22
|
+
const controllerName = toIdentifier(firstTag);
|
|
22
23
|
const methodName = operation.operationId;
|
|
23
24
|
routes.push({
|
|
24
25
|
path,
|
|
@@ -32,9 +33,6 @@ export function extractRoutes(spec) {
|
|
|
32
33
|
}
|
|
33
34
|
return routes;
|
|
34
35
|
}
|
|
35
|
-
function capitalizeFirst(str) {
|
|
36
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
37
|
-
}
|
|
38
36
|
export function convertOpenAPIPathToExpress(openApiPath) {
|
|
39
37
|
return openApiPath.replace(/{([^}]+)}/g, ':$1');
|
|
40
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routeExtractor.js","sourceRoot":"","sources":["../lib/routeExtractor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routeExtractor.js","sourceRoot":"","sources":["../lib/routeExtractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAIrE,MAAM,UAAU,aAAa,CAAC,IAAwB;IACpD,MAAM,MAAM,GAAoB,EAAE,CAAC;IAEnC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,QAAQ;YAAE,SAAS;QAExB,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;QAEtF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAA0C,CAAC;YAE5E,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;gBACzC,SAAS;YACX,CAAC;YAED,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAEzB,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,CAAC,IAAI,CAAC,aAAa,SAAS,CAAC,WAAW,wBAAwB,CAAC,CAAC;gBACzE,SAAS;YACX,CAAC;YAED,MAAM,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC9C,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC;YAEzC,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI;gBACJ,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE;gBAC5B,WAAW,EAAE,SAAS,CAAC,WAAW;gBAClC,IAAI;gBACJ,cAAc;gBACd,UAAU;aACX,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,WAAmB;IAC7D,OAAO,WAAW,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibabkin/openapi-express-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"reflect-metadata": "^0.2.2",
|
|
44
44
|
"ts-ioc-container": "^68.0.0",
|
|
45
45
|
"zod": "^4.6.5",
|
|
46
|
-
"@ibabkin/openapi-to-server": "
|
|
47
|
-
"@ibabkin/openapi-to-zod": "1.4.
|
|
46
|
+
"@ibabkin/openapi-to-server": "2.0.1",
|
|
47
|
+
"@ibabkin/openapi-to-zod": "1.4.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@jest/test-sequencer": "29.7.0",
|