autocomplete-openapi
Advanced tools
Comparing version
{ | ||
"name": "autocomplete-openapi", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Autocompletes different parts of an OpenAPI spec", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
export class OpenAPIMethod { | ||
constructor(method, path, body) { | ||
constructor(method, path, body, operationId, tags) { | ||
this.method = method; | ||
this.path = path; | ||
this.body = body; // defiition of the body | ||
this.body = body; // definition of the body | ||
this.operationId=operationId; | ||
this.tags=tags; | ||
} | ||
@@ -24,3 +26,5 @@ } | ||
path, | ||
this.openapi.paths[path][method]?.requestBody?.content?.['application/json']?.schema?.['$ref'] | ||
this.openapi.paths[path][method]?.requestBody?.content?.['application/json']?.schema?.['$ref'], | ||
this.openapi.paths[path][method].operationId, | ||
this.openapi.paths[path][method].tags | ||
)); | ||
@@ -27,0 +31,0 @@ } |
@@ -20,2 +20,11 @@ "use strict"; | ||
it("should extract all method definitions", () => { | ||
let allMethods = new OpenAPIExtractor(openapi).getAllMethods(); | ||
for (const method of allMethods){ | ||
if (method.path == '/telemetry'){ | ||
assert.equal(method.tags[0], 'service') | ||
} | ||
} | ||
}) | ||
it("should extract model object by ref", () => { | ||
@@ -27,3 +36,2 @@ let objects = new OpenAPIExtractor(openapi).objectByRef("#/components/schemas/CreateCollection"); | ||
it("should extract model object by path", () => { | ||
@@ -30,0 +38,0 @@ let objects = []; |
284739
1.01%18
12.5%9256
0.79%