-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (23 loc) · 748 Bytes
/
main.py
File metadata and controls
33 lines (23 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from fastapi import FastAPI
from pydantic import BaseModel
from java_class_analysis.lib import analysis, plantuml
app = FastAPI()
analyzer = analysis.Analyzer(r"/data/workspace/tmp/trunk", enable_method_filter=True)
@app.get("/")
async def root():
return {"message": "Hello World"}
class QueryModel(BaseModel):
name: str
method: str = None
@app.post("/query")
async def query(q: QueryModel):
global analyzer
arr = analyzer.parse(q.name)
mindmap = plantuml.mind_diagram(arr[0])
sequence_diagram = plantuml.sequence_diagram(arr[0])
repo_diagram = plantuml.repo_diagram(arr[0])
ret = dict()
ret['mindmap'] = mindmap
ret['sequence'] = sequence_diagram
ret['repo'] = repo_diagram
return ret