mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
Added tests and updated openapi3_parser.py
This commit is contained in:
@@ -2,7 +2,10 @@ from urllib.parse import urlparse
|
||||
|
||||
from openapi_parser import parse
|
||||
|
||||
from base_parser import BaseParser
|
||||
try:
|
||||
from scripts.parser.file.base_parser import BaseParser
|
||||
except:
|
||||
from base_parser import BaseParser
|
||||
|
||||
|
||||
class OpenAPI3Parser(BaseParser):
|
||||
@@ -20,11 +23,12 @@ class OpenAPI3Parser(BaseParser):
|
||||
|
||||
def get_info_from_paths(self, path):
|
||||
info = ""
|
||||
for operation in path.operations:
|
||||
info += (
|
||||
f"\n{operation.method.value}="
|
||||
f"{operation.responses[0].description}"
|
||||
)
|
||||
if(path.operations):
|
||||
for operation in path.operations:
|
||||
info += (
|
||||
f"\n{operation.method.value}="
|
||||
f"{operation.responses[0].description}"
|
||||
)
|
||||
return info
|
||||
|
||||
def parse_file(self, file_path):
|
||||
@@ -42,5 +46,9 @@ class OpenAPI3Parser(BaseParser):
|
||||
f"parameters: {path.parameters}\nmethods: {info}\n"
|
||||
)
|
||||
i += 1
|
||||
if(i==2):
|
||||
with open("reff.txt", "w") as f:
|
||||
f.write(str(path))
|
||||
with open("results.txt", "w") as f:
|
||||
f.write(results)
|
||||
return results
|
||||
Reference in New Issue
Block a user