organizer-core
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -8,2 +8,3 @@ import SwaggerParser from '@apidevtools/swagger-parser'; | ||
summary: string; | ||
service: string; | ||
} | ||
@@ -17,3 +18,3 @@ interface Endpoints { | ||
parse(file: string): Promise<OpenAPI.Document>; | ||
getEndpointsByTags(file: string): Promise<Endpoints>; | ||
getEndpointsByTags(file: string, service: string): Promise<Endpoints>; | ||
private parseDefinition; | ||
@@ -20,0 +21,0 @@ private getEndpoint; |
@@ -30,7 +30,7 @@ "use strict"; | ||
} | ||
getEndpointsByTags(file) { | ||
getEndpointsByTags(file, service) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const definition = yield this.parse(file); | ||
return this.parseDefinition(definition); | ||
return this.parseDefinition(definition, service); | ||
} | ||
@@ -42,3 +42,3 @@ catch (e) { | ||
} | ||
parseDefinition(definition) { | ||
parseDefinition(definition, service) { | ||
const result = {}; | ||
@@ -48,3 +48,3 @@ for (const path in definition.paths) { | ||
for (const pathMethod in pathEntry) { | ||
const endpoint = this.getEndpoint(pathMethod, path, pathEntry[pathMethod]); | ||
const endpoint = this.getEndpoint(pathMethod, path, pathEntry[pathMethod], service); | ||
pathEntry[pathMethod].tags.map((tag) => { | ||
@@ -62,3 +62,3 @@ if (!result.hasOwnProperty(tag)) { | ||
} | ||
getEndpoint(method, path, pathItem) { | ||
getEndpoint(method, path, pathItem, service) { | ||
return { | ||
@@ -69,2 +69,3 @@ operationId: pathItem.operationId, | ||
summary: pathItem.summary, | ||
service, | ||
}; | ||
@@ -71,0 +72,0 @@ } |
import { NextFunction, Request, Response } from 'express'; | ||
declare const getDocHandler: (docPath: string) => (req: Request, res: Response, next: NextFunction) => Promise<void>; | ||
declare const getDocHandler: (docPath: string, service: string) => (req: Request, res: Response, next: NextFunction) => Promise<void>; | ||
export default getDocHandler; |
@@ -13,5 +13,5 @@ "use strict"; | ||
const index_1 = require("./index"); | ||
const getDocHandler = (docPath) => (req, res, next) => __awaiter(void 0, void 0, void 0, function* () { | ||
const getDocHandler = (docPath, service) => (req, res, next) => __awaiter(void 0, void 0, void 0, function* () { | ||
try { | ||
const result = yield index_1.DocParser.getEndpointsByTags(docPath); | ||
const result = yield index_1.DocParser.getEndpointsByTags(docPath, service); | ||
res.send(result); | ||
@@ -18,0 +18,0 @@ } |
@@ -9,3 +9,3 @@ "use strict"; | ||
if (docPath) { | ||
router.get('/doc', __1.getDocHandler(docPath)); | ||
router.get('/doc', __1.getDocHandler(docPath, appName)); | ||
} | ||
@@ -12,0 +12,0 @@ router.get('/', (req, res) => { |
{ | ||
"name": "organizer-core", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Core modules for organizer", | ||
@@ -14,3 +14,3 @@ "main": "./dist/index.js", | ||
}, | ||
"author": "Andrea Frittella <me.liveset@gmail.com>", | ||
"author": "Andrea Frittella <info@andreafrittella.com>", | ||
"license": "MIT", | ||
@@ -20,18 +20,16 @@ "devDependencies": { | ||
"@types/bcrypt": "^3.0.0", | ||
"@types/jest": "^26.0.4", | ||
"@types/jest": "^26.0.10", | ||
"@types/jsonwebtoken": "^8.5.0", | ||
"@types/node": "^14.0.23", | ||
"@types/node": "^14.6.0", | ||
"@types/source-map-support": "^0.5.2", | ||
"@types/supertest": "^2.0.10", | ||
"@typescript-eslint/eslint-plugin": "^3.6.1", | ||
"@typescript-eslint/parser": "^3.6.1", | ||
"eslint": "^7.4.0", | ||
"@typescript-eslint/eslint-plugin": "^3.9.1", | ||
"@typescript-eslint/parser": "^3.9.1", | ||
"eslint": "^7.7.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"jest": "^26.0.1", | ||
"jest": "^26.4.0", | ||
"prettier": "^2.0.5", | ||
"source-map-support": "^0.5.19", | ||
"supertest": "^4.0.2", | ||
"ts-jest": "^26.1.2", | ||
"typescript": "^3.9.6" | ||
"ts-jest": "^26.2.0", | ||
"typescript": "^3.9.7" | ||
}, | ||
@@ -44,4 +42,4 @@ "dependencies": { | ||
"jsonwebtoken": "^8.5.1", | ||
"swagger-parser": "^10.0.0" | ||
"organizer-openapi": "^0.1.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79889
16
1203
+ Addedorganizer-openapi@^0.1.1
+ Added@apidevtools/json-schema-ref-parser@9.0.6(transitive)
+ Added@apidevtools/swagger-parser@10.1.0(transitive)
+ Addedajv@8.16.0(transitive)
+ Addedajv-draft-04@1.0.0(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedjson-schema-traverse@1.0.0(transitive)
+ Addedopenapi-types@7.2.3(transitive)
+ Addedorganizer-openapi@0.1.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addeduri-js@4.4.1(transitive)
- Removedswagger-parser@^10.0.0
- Removed@apidevtools/json-schema-ref-parser@9.1.2(transitive)
- Removed@apidevtools/swagger-parser@10.0.3(transitive)
- Removed@types/json-schema@7.0.15(transitive)
- Removedargparse@2.0.1(transitive)
- Removedcommander@10.0.1(transitive)
- Removedjs-yaml@4.1.0(transitive)
- Removedlodash.get@4.4.2(transitive)
- Removedlodash.isequal@4.5.0(transitive)
- Removedopenapi-types@12.1.3(transitive)
- Removedswagger-parser@10.0.3(transitive)
- Removedvalidator@13.12.0(transitive)
- Removedz-schema@5.0.6(transitive)