fastapi-voyager 0.11.11__tar.gz → 0.12.2__tar.gz
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.
- fastapi_voyager-0.12.2/PKG-INFO +182 -0
- fastapi_voyager-0.12.2/README.md +153 -0
- fastapi_voyager-0.12.2/docs/changelog.md +124 -0
- fastapi_voyager-0.12.2/docs/idea.md +22 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/server.py +23 -2
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/version.py +1 -1
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/component/schema-code-display.js +1 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/graph-ui.js +3 -8
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/index.html +7 -3
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/vue-main.js +71 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/programatic.py +2 -1
- fastapi_voyager-0.11.11/PKG-INFO +0 -350
- fastapi_voyager-0.11.11/README.md +0 -321
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/.github/workflows/publish.yml +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/.gitignore +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/.python-version +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/LICENSE +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/pyproject.toml +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/release.md +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/__init__.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/cli.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/filter.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/module.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/render.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/type.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/type_helper.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/voyager.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/component/render-graph.js +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/component/route-code-display.js +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/component/schema-field-filter.js +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/graphviz.svg.css +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/graphviz.svg.js +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/icon/android-chrome-192x192.png +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/icon/android-chrome-512x512.png +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/icon/apple-touch-icon.png +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/icon/favicon-16x16.png +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/icon/favicon-32x32.png +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/icon/favicon.ico +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/icon/site.webmanifest +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/quasar.min.css +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/src/fastapi_voyager/web/quasar.min.js +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/__init__.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/demo.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/demo_anno.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/service/__init__.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/service/schema.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/test_analysis.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/test_filter.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/test_generic.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/test_import.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/test_module.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/tests/test_type_helper.py +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/uv.lock +0 -0
- {fastapi_voyager-0.11.11 → fastapi_voyager-0.12.2}/voyager.jpg +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastapi-voyager
|
|
3
|
+
Version: 0.12.2
|
|
4
|
+
Summary: Visualize FastAPI application's routing tree and dependencies
|
|
5
|
+
Project-URL: Homepage, https://github.com/allmonday/fastapi-voyager
|
|
6
|
+
Project-URL: Source, https://github.com/allmonday/fastapi-voyager
|
|
7
|
+
Author-email: Tangkikodo <allmonday@126.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: fastapi,openapi,routing,visualization
|
|
11
|
+
Classifier: Framework :: FastAPI
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: fastapi>=0.110
|
|
23
|
+
Requires-Dist: pydantic-resolve>=1.13.2
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
26
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
27
|
+
Requires-Dist: uvicorn; extra == 'dev'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
[](https://pypi.python.org/pypi/fastapi-voyager)
|
|
31
|
+

|
|
32
|
+
[](https://pepy.tech/projects/fastapi-voyager)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
> This repo is still in early stage, it supports pydantic v2 only
|
|
36
|
+
|
|
37
|
+
Visualize your FastAPI endpoints, and explore them interactively.
|
|
38
|
+
|
|
39
|
+
[visit online demo](https://www.newsyeah.fun/voyager/) of project: [composition oriented development pattern](https://github.com/allmonday/composition-oriented-development-pattern)
|
|
40
|
+
|
|
41
|
+
<img width="1600" height="986" alt="image" src="https://github.com/user-attachments/assets/8829cda0-f42d-4c84-be2f-b019bb5fe7e1" />
|
|
42
|
+
|
|
43
|
+
## Plan & Raodmap
|
|
44
|
+
- [ideas](./docs/idea.md)
|
|
45
|
+
- [changelog & roadmap](./docs/changelog.md)
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install fastapi-voyager
|
|
51
|
+
# or
|
|
52
|
+
uv add fastapi-voyager
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```shell
|
|
56
|
+
voyager -m path.to.your.app.module --server
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
> [Sub-Application mounts](https://fastapi.tiangolo.com/advanced/sub-applications/) are not supported yet, but you can specify the name of the FastAPI application used with `--app`. Only a single application (default: 'app') can be selected, but in a scenario where `api` is attached through `app.mount("/api", api)`, you can select `api` like this:
|
|
60
|
+
|
|
61
|
+
```shell
|
|
62
|
+
voyager -m path.to.your.app.module --server --app api
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Mount into project
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from fastapi import FastAPI
|
|
69
|
+
from fastapi_voyager import create_voyager
|
|
70
|
+
from tests.demo import app
|
|
71
|
+
|
|
72
|
+
app.mount('/voyager', create_voyager(
|
|
73
|
+
app,
|
|
74
|
+
module_color={"tests.service": "red"},
|
|
75
|
+
module_prefix="tests.service"),
|
|
76
|
+
swagger_url="/docs")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Features
|
|
80
|
+
|
|
81
|
+
For scenarios of using FastAPI as internal API integration endpoints, `fastapi-voyager` helps to visualize the dependencies.
|
|
82
|
+
|
|
83
|
+
It is also an architecture inspection tool that can identify issues in data relationships during design phase before turly implemtatioin.
|
|
84
|
+
|
|
85
|
+
If the process of building the view model follows the ER model, the full potential of fastapi-voyager can be realized. It allows for quick identification of APIs that use entities, as well as which entities are used by a specific API
|
|
86
|
+
|
|
87
|
+
### highlight nodes and links
|
|
88
|
+
click a node to highlight it's upperstream and downstream nodes. figure out the related models of one page, or homw many pages are related with one model.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
<img width="1100" height="700" alt="image" src="https://github.com/user-attachments/assets/3e0369ea-5fa4-469a-82c1-ed57d407e53d" />
|
|
92
|
+
|
|
93
|
+
### focus on nodes
|
|
94
|
+
|
|
95
|
+
Double click a node, and then toggle focus to hide irrelevant nodes.
|
|
96
|
+
|
|
97
|
+
<img width="1061" height="937" alt="image" src="https://github.com/user-attachments/assets/79709b02-7571-43fc-abc9-17a287a97515" />
|
|
98
|
+
|
|
99
|
+
### view source code
|
|
100
|
+
|
|
101
|
+
double click a node or route to show source code or open file in vscode.
|
|
102
|
+
|
|
103
|
+
<img width="1297" height="940" alt="image" src="https://github.com/user-attachments/assets/c8bb2e7d-b727-42a6-8c9e-64dce297d2d8" />
|
|
104
|
+
|
|
105
|
+
<img width="1132" height="824" alt="image" src="https://github.com/user-attachments/assets/b706e879-e4fc-48dd-ace1-99bf97e3ed6a" />
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
## Command Line Usage
|
|
109
|
+
|
|
110
|
+
### open in browser
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# open in browser
|
|
114
|
+
voyager -m tests.demo --server
|
|
115
|
+
|
|
116
|
+
voyager -m tests.demo --server --port=8002
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### generate the dot file
|
|
120
|
+
```bash
|
|
121
|
+
# generate .dot file
|
|
122
|
+
voyager -m tests.demo
|
|
123
|
+
|
|
124
|
+
voyager -m tests.demo --app my_app
|
|
125
|
+
|
|
126
|
+
voyager -m tests.demo --schema Task
|
|
127
|
+
|
|
128
|
+
voyager -m tests.demo --show_fields all
|
|
129
|
+
|
|
130
|
+
voyager -m tests.demo --module_color=tests.demo:red --module_color=tests.service:tomato
|
|
131
|
+
|
|
132
|
+
voyager -m tests.demo -o my_visualization.dot
|
|
133
|
+
|
|
134
|
+
voyager --version
|
|
135
|
+
|
|
136
|
+
voyager --help
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## About pydantic-resolve
|
|
140
|
+
|
|
141
|
+
pydantic-resolve's `@ensure_subset` decorator helps safely pick fields from the 'source class' while **indicating the reference** from the current class to the base class.
|
|
142
|
+
|
|
143
|
+
pydantic-resolve is a lightweight tool designed to build complex, nested data in a simple, declarative way. In version 2.0.0alpha, it will introduce an important feature: ER Diagram, and fastapi-voyager will support this feature, allowing for a clearer understanding of the business relationships between the data.
|
|
144
|
+
|
|
145
|
+
Developers can use fastapi-voyager without needing to know anything about pydantic-resolve, but I still highly recommend everyone to give it a try.
|
|
146
|
+
|
|
147
|
+
## Dependencies
|
|
148
|
+
|
|
149
|
+
- FastAPI
|
|
150
|
+
- [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
|
|
151
|
+
- Quasar
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## Credits
|
|
155
|
+
|
|
156
|
+
- https://apis.guru/graphql-voyager/, thanks for inspiration.
|
|
157
|
+
- https://github.com/tintinweb/vscode-interactive-graphviz, thanks for web visualization.
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## How to develop & contribute?
|
|
161
|
+
|
|
162
|
+
fork, clone.
|
|
163
|
+
|
|
164
|
+
install uv.
|
|
165
|
+
|
|
166
|
+
```shell
|
|
167
|
+
uv venv
|
|
168
|
+
source .venv/bin/activate
|
|
169
|
+
uv pip install ".[dev]"
|
|
170
|
+
uvicorn tests.programatic:app --reload
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
open `localhost:8000/voyager`
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
frontend:
|
|
177
|
+
- `src/web/vue-main.js`: main js
|
|
178
|
+
|
|
179
|
+
backend:
|
|
180
|
+
- `voyager.py`: main entry
|
|
181
|
+
- `render.py`: generate dot file
|
|
182
|
+
- `server.py`: serve mode
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
[](https://pypi.python.org/pypi/fastapi-voyager)
|
|
2
|
+

|
|
3
|
+
[](https://pepy.tech/projects/fastapi-voyager)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> This repo is still in early stage, it supports pydantic v2 only
|
|
7
|
+
|
|
8
|
+
Visualize your FastAPI endpoints, and explore them interactively.
|
|
9
|
+
|
|
10
|
+
[visit online demo](https://www.newsyeah.fun/voyager/) of project: [composition oriented development pattern](https://github.com/allmonday/composition-oriented-development-pattern)
|
|
11
|
+
|
|
12
|
+
<img width="1600" height="986" alt="image" src="https://github.com/user-attachments/assets/8829cda0-f42d-4c84-be2f-b019bb5fe7e1" />
|
|
13
|
+
|
|
14
|
+
## Plan & Raodmap
|
|
15
|
+
- [ideas](./docs/idea.md)
|
|
16
|
+
- [changelog & roadmap](./docs/changelog.md)
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install fastapi-voyager
|
|
22
|
+
# or
|
|
23
|
+
uv add fastapi-voyager
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
voyager -m path.to.your.app.module --server
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> [Sub-Application mounts](https://fastapi.tiangolo.com/advanced/sub-applications/) are not supported yet, but you can specify the name of the FastAPI application used with `--app`. Only a single application (default: 'app') can be selected, but in a scenario where `api` is attached through `app.mount("/api", api)`, you can select `api` like this:
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
voyager -m path.to.your.app.module --server --app api
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Mount into project
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from fastapi import FastAPI
|
|
40
|
+
from fastapi_voyager import create_voyager
|
|
41
|
+
from tests.demo import app
|
|
42
|
+
|
|
43
|
+
app.mount('/voyager', create_voyager(
|
|
44
|
+
app,
|
|
45
|
+
module_color={"tests.service": "red"},
|
|
46
|
+
module_prefix="tests.service"),
|
|
47
|
+
swagger_url="/docs")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
For scenarios of using FastAPI as internal API integration endpoints, `fastapi-voyager` helps to visualize the dependencies.
|
|
53
|
+
|
|
54
|
+
It is also an architecture inspection tool that can identify issues in data relationships during design phase before turly implemtatioin.
|
|
55
|
+
|
|
56
|
+
If the process of building the view model follows the ER model, the full potential of fastapi-voyager can be realized. It allows for quick identification of APIs that use entities, as well as which entities are used by a specific API
|
|
57
|
+
|
|
58
|
+
### highlight nodes and links
|
|
59
|
+
click a node to highlight it's upperstream and downstream nodes. figure out the related models of one page, or homw many pages are related with one model.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
<img width="1100" height="700" alt="image" src="https://github.com/user-attachments/assets/3e0369ea-5fa4-469a-82c1-ed57d407e53d" />
|
|
63
|
+
|
|
64
|
+
### focus on nodes
|
|
65
|
+
|
|
66
|
+
Double click a node, and then toggle focus to hide irrelevant nodes.
|
|
67
|
+
|
|
68
|
+
<img width="1061" height="937" alt="image" src="https://github.com/user-attachments/assets/79709b02-7571-43fc-abc9-17a287a97515" />
|
|
69
|
+
|
|
70
|
+
### view source code
|
|
71
|
+
|
|
72
|
+
double click a node or route to show source code or open file in vscode.
|
|
73
|
+
|
|
74
|
+
<img width="1297" height="940" alt="image" src="https://github.com/user-attachments/assets/c8bb2e7d-b727-42a6-8c9e-64dce297d2d8" />
|
|
75
|
+
|
|
76
|
+
<img width="1132" height="824" alt="image" src="https://github.com/user-attachments/assets/b706e879-e4fc-48dd-ace1-99bf97e3ed6a" />
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
## Command Line Usage
|
|
80
|
+
|
|
81
|
+
### open in browser
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# open in browser
|
|
85
|
+
voyager -m tests.demo --server
|
|
86
|
+
|
|
87
|
+
voyager -m tests.demo --server --port=8002
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### generate the dot file
|
|
91
|
+
```bash
|
|
92
|
+
# generate .dot file
|
|
93
|
+
voyager -m tests.demo
|
|
94
|
+
|
|
95
|
+
voyager -m tests.demo --app my_app
|
|
96
|
+
|
|
97
|
+
voyager -m tests.demo --schema Task
|
|
98
|
+
|
|
99
|
+
voyager -m tests.demo --show_fields all
|
|
100
|
+
|
|
101
|
+
voyager -m tests.demo --module_color=tests.demo:red --module_color=tests.service:tomato
|
|
102
|
+
|
|
103
|
+
voyager -m tests.demo -o my_visualization.dot
|
|
104
|
+
|
|
105
|
+
voyager --version
|
|
106
|
+
|
|
107
|
+
voyager --help
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## About pydantic-resolve
|
|
111
|
+
|
|
112
|
+
pydantic-resolve's `@ensure_subset` decorator helps safely pick fields from the 'source class' while **indicating the reference** from the current class to the base class.
|
|
113
|
+
|
|
114
|
+
pydantic-resolve is a lightweight tool designed to build complex, nested data in a simple, declarative way. In version 2.0.0alpha, it will introduce an important feature: ER Diagram, and fastapi-voyager will support this feature, allowing for a clearer understanding of the business relationships between the data.
|
|
115
|
+
|
|
116
|
+
Developers can use fastapi-voyager without needing to know anything about pydantic-resolve, but I still highly recommend everyone to give it a try.
|
|
117
|
+
|
|
118
|
+
## Dependencies
|
|
119
|
+
|
|
120
|
+
- FastAPI
|
|
121
|
+
- [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
|
|
122
|
+
- Quasar
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
## Credits
|
|
126
|
+
|
|
127
|
+
- https://apis.guru/graphql-voyager/, thanks for inspiration.
|
|
128
|
+
- https://github.com/tintinweb/vscode-interactive-graphviz, thanks for web visualization.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## How to develop & contribute?
|
|
132
|
+
|
|
133
|
+
fork, clone.
|
|
134
|
+
|
|
135
|
+
install uv.
|
|
136
|
+
|
|
137
|
+
```shell
|
|
138
|
+
uv venv
|
|
139
|
+
source .venv/bin/activate
|
|
140
|
+
uv pip install ".[dev]"
|
|
141
|
+
uvicorn tests.programatic:app --reload
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
open `localhost:8000/voyager`
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
frontend:
|
|
148
|
+
- `src/web/vue-main.js`: main js
|
|
149
|
+
|
|
150
|
+
backend:
|
|
151
|
+
- `voyager.py`: main entry
|
|
152
|
+
- `render.py`: generate dot file
|
|
153
|
+
- `server.py`: serve mode
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Changelog & roadmap
|
|
2
|
+
|
|
3
|
+
## <0.9:
|
|
4
|
+
- [x] group schemas by module hierarchy
|
|
5
|
+
- [x] module-based coloring via Analytics(module_color={...})
|
|
6
|
+
- [x] view in web browser
|
|
7
|
+
- [x] config params
|
|
8
|
+
- [x] make a explorer dashboard, provide list of routes, schemas, to make it easy to switch and search
|
|
9
|
+
- [x] support programmatic usage
|
|
10
|
+
- [x] better schema /router node appearance
|
|
11
|
+
- [x] hide fields duplicated with parent's (show `parent fields` instead)
|
|
12
|
+
- [x] refactor the frontend to vue, and tweak the build process
|
|
13
|
+
- [x] find dependency based on picked schema and it's field.
|
|
14
|
+
- [x] optimize static resource (cdn -> local)
|
|
15
|
+
- [x] add configuration for highlight (optional)
|
|
16
|
+
- [x] alt+click to show field details
|
|
17
|
+
- [x] display source code of routes (including response_model)
|
|
18
|
+
- [x] handle excluded field
|
|
19
|
+
- [x] add tooltips
|
|
20
|
+
- [x] route
|
|
21
|
+
- [x] group routes by module hierarchy
|
|
22
|
+
- [x] add response_model in route
|
|
23
|
+
- [x] fixed left bar show tag/ route
|
|
24
|
+
- [x] export voyager core data into json (for better debugging)
|
|
25
|
+
- [x] add api to rebuild core data from json, and render it
|
|
26
|
+
- [x] fix Generic case `test_generic.py`
|
|
27
|
+
- [x] show tips for routes not return pydantic type.
|
|
28
|
+
- [x] fix duplicated link from class and parent class, it also break clicking highlight
|
|
29
|
+
- [x] refactor: abstract render module
|
|
30
|
+
|
|
31
|
+
## 0.9
|
|
32
|
+
- [x] refactor: server.py
|
|
33
|
+
- [x] rename create_app_with_fastapi -> create_voyager
|
|
34
|
+
- [x] add doc for parameters
|
|
35
|
+
- [x] improve initialization time cost
|
|
36
|
+
- [x] query route / schema info through realtime api
|
|
37
|
+
- [x] adjust fe
|
|
38
|
+
- 0.9.3
|
|
39
|
+
- [x] adjust layout
|
|
40
|
+
- [x] show field detail in right panel
|
|
41
|
+
- [x] show route info in bottom
|
|
42
|
+
- 0.9.4
|
|
43
|
+
- [x] close schema sidebar when switch tag/route
|
|
44
|
+
- [x] schema detail panel show fields by default
|
|
45
|
+
- [x] adjust schema panel's height
|
|
46
|
+
- [x] show from base information in subset case
|
|
47
|
+
- 0.9.5
|
|
48
|
+
- [x] route list should have a max height
|
|
49
|
+
|
|
50
|
+
## 0.10
|
|
51
|
+
- 0.10.1
|
|
52
|
+
- [x] refactor voyager.py tag -> route structure
|
|
53
|
+
- [x] fix missing route (tag has only one route which return primitive value)
|
|
54
|
+
- [x] make right panel resizable by dragging
|
|
55
|
+
- [x] allow closing tag expansion item
|
|
56
|
+
- [x] hide brief mode if not configured
|
|
57
|
+
- [x] add focus button to only show related nodes under current route/tag graph in dialog
|
|
58
|
+
- 0.10.2
|
|
59
|
+
- [x] fix graph height
|
|
60
|
+
- [x] show version in title
|
|
61
|
+
- 0.10.3
|
|
62
|
+
- [x] fix focus in brief-mode
|
|
63
|
+
- [x] ui: adjust focus position
|
|
64
|
+
- [x] refactor naming
|
|
65
|
+
- [x] fix layout issue when rendering huge graph
|
|
66
|
+
- 0.10.4
|
|
67
|
+
- [x] fix: when focus is on, should ensure changes from other params not broken.
|
|
68
|
+
- 0.10.5
|
|
69
|
+
- [x] double click to show details, and highlight as tomato
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## 0.11
|
|
73
|
+
- 0.11.1
|
|
74
|
+
- [x] support opening route in swagger
|
|
75
|
+
- [x] config docs path
|
|
76
|
+
- [x] provide option to hide routes in brief mode (auto hide in full graph mode)
|
|
77
|
+
- 0.11.2
|
|
78
|
+
- [x] enable/disable module cluster (to save space)
|
|
79
|
+
- 0.11.3
|
|
80
|
+
- [x] support online repo url
|
|
81
|
+
- 0.11.4
|
|
82
|
+
- [x] add loading for field detail panel
|
|
83
|
+
- 0.11.5
|
|
84
|
+
- [x] optimize open in swagger link
|
|
85
|
+
- [x] change jquery cdn
|
|
86
|
+
- 0.11.6
|
|
87
|
+
- [x] flag of loading full graph in first render or not
|
|
88
|
+
- [x] optimize loading static resource
|
|
89
|
+
- 0.11.7
|
|
90
|
+
- [x] fix swagger link
|
|
91
|
+
- 0.11.8
|
|
92
|
+
- [x] fix swagger link in another way
|
|
93
|
+
- 0.11.9
|
|
94
|
+
- [x] replace issubclass with safe_issubclass to prevent exception.
|
|
95
|
+
- 0.11.10
|
|
96
|
+
- [x] fix bug during updating forward refs
|
|
97
|
+
- 0.11.11
|
|
98
|
+
- [x] replace print with logging and add `--log-level` in cli, by default info
|
|
99
|
+
- [x] fill node title color with module color
|
|
100
|
+
- [x] optimize cluster render logic
|
|
101
|
+
|
|
102
|
+
## 0.12
|
|
103
|
+
- 0.12.1
|
|
104
|
+
- [x] sort tag / route names in left panel
|
|
105
|
+
- [x] display schema name on top of detail panel
|
|
106
|
+
- [x] optimize dbclick style
|
|
107
|
+
- [x] persist the tag/ route in url
|
|
108
|
+
- 0.12.2
|
|
109
|
+
- [x] add google analytics
|
|
110
|
+
- 0.12.3
|
|
111
|
+
- [ ] search tag/ route
|
|
112
|
+
- [ ] refactor render.py
|
|
113
|
+
- [ ] reorg: move variable into reactive in vue-main.js
|
|
114
|
+
|
|
115
|
+
## 0.13
|
|
116
|
+
- 0.12.0
|
|
117
|
+
- [ ] integration with pydantic-resolve
|
|
118
|
+
- [ ] show hint for resolve, post fields
|
|
119
|
+
- [ ] display loader as edges
|
|
120
|
+
- [ ] add tests
|
|
121
|
+
|
|
122
|
+
## 0.13
|
|
123
|
+
todo
|
|
124
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Idea
|
|
2
|
+
|
|
3
|
+
## backlog
|
|
4
|
+
- [ ] user can generate nodes/edges manually and connect to generated ones
|
|
5
|
+
- [ ] eg: add owner
|
|
6
|
+
- [ ] add extra info for schema
|
|
7
|
+
- [ ] optimize static resource (allow manually config url)
|
|
8
|
+
- [ ] improve search dialog
|
|
9
|
+
- [ ] add route/tag list
|
|
10
|
+
- [ ] type alias should not be kept as node instead of compiling to original type
|
|
11
|
+
- [ ] how to correctly handle the generic type ?
|
|
12
|
+
- [ ] support Google analysis config
|
|
13
|
+
- [ ] sort field name in nodes (only table inside right panel), pending
|
|
14
|
+
- [ ] set max limit for fields in nodes
|
|
15
|
+
|
|
16
|
+
## in analysis
|
|
17
|
+
- [ ] upgrade network algorithm (optional)
|
|
18
|
+
- [ ] click field to highlight links
|
|
19
|
+
- [ ] animation effect for edges
|
|
20
|
+
- [ ] display standard ER diagram spec. `hard but important`
|
|
21
|
+
- [ ] display potential invalid links
|
|
22
|
+
- [ ] highlight relationship belongs to ER diagram
|
|
@@ -6,7 +6,7 @@ from pydantic import BaseModel
|
|
|
6
6
|
from fastapi.responses import HTMLResponse, PlainTextResponse, JSONResponse
|
|
7
7
|
from fastapi.staticfiles import StaticFiles
|
|
8
8
|
from fastapi_voyager.voyager import Voyager
|
|
9
|
-
from fastapi_voyager.type import Tag,
|
|
9
|
+
from fastapi_voyager.type import Tag, CoreData, SchemaNode
|
|
10
10
|
from fastapi_voyager.render import Renderer
|
|
11
11
|
from fastapi_voyager.type_helper import get_source, get_vscode_link
|
|
12
12
|
from fastapi_voyager.version import __version__
|
|
@@ -15,6 +15,22 @@ from fastapi_voyager.version import __version__
|
|
|
15
15
|
WEB_DIR = Path(__file__).parent / "web"
|
|
16
16
|
WEB_DIR.mkdir(exist_ok=True)
|
|
17
17
|
|
|
18
|
+
GA_PLACEHOLDER = "<!-- GA_SNIPPET -->"
|
|
19
|
+
|
|
20
|
+
def _build_ga_snippet(ga_id: Optional[str]) -> str:
|
|
21
|
+
if not ga_id:
|
|
22
|
+
return ""
|
|
23
|
+
|
|
24
|
+
return f""" <script async src="https://www.googletagmanager.com/gtag/js?id={ga_id}"></script>
|
|
25
|
+
<script>
|
|
26
|
+
window.dataLayer = window.dataLayer || [];
|
|
27
|
+
function gtag(){{dataLayer.push(arguments);}}
|
|
28
|
+
gtag('js', new Date());
|
|
29
|
+
|
|
30
|
+
gtag('config', '{ga_id}');
|
|
31
|
+
</script>
|
|
32
|
+
"""
|
|
33
|
+
|
|
18
34
|
INITIAL_PAGE_POLICY = Literal['first', 'full', 'empty']
|
|
19
35
|
|
|
20
36
|
class OptionParam(BaseModel):
|
|
@@ -46,6 +62,7 @@ def create_voyager(
|
|
|
46
62
|
swagger_url: Optional[str] = None,
|
|
47
63
|
online_repo_url: Optional[str] = None,
|
|
48
64
|
initial_page_policy: INITIAL_PAGE_POLICY = 'first',
|
|
65
|
+
ga_id: Optional[str] = None,
|
|
49
66
|
) -> FastAPI:
|
|
50
67
|
router = APIRouter(tags=['fastapi-voyager'])
|
|
51
68
|
|
|
@@ -57,6 +74,9 @@ def create_voyager(
|
|
|
57
74
|
|
|
58
75
|
# include tags and their routes
|
|
59
76
|
tags = voyager.tags
|
|
77
|
+
for t in tags:
|
|
78
|
+
t.routes.sort(key=lambda r: r.name)
|
|
79
|
+
tags.sort(key=lambda t: t.name)
|
|
60
80
|
|
|
61
81
|
schemas = voyager.nodes[:]
|
|
62
82
|
schemas.sort(key=lambda s: s.name)
|
|
@@ -113,7 +133,8 @@ def create_voyager(
|
|
|
113
133
|
def index():
|
|
114
134
|
index_file = WEB_DIR / "index.html"
|
|
115
135
|
if index_file.exists():
|
|
116
|
-
|
|
136
|
+
content = index_file.read_text(encoding="utf-8")
|
|
137
|
+
return content.replace(GA_PLACEHOLDER, _build_ga_snippet(ga_id))
|
|
117
138
|
# fallback simple page if index.html missing
|
|
118
139
|
return """
|
|
119
140
|
<!doctype html>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__all__ = ["__version__"]
|
|
2
|
-
__version__ = "0.
|
|
2
|
+
__version__ = "0.12.2"
|
|
@@ -157,6 +157,7 @@ export default defineComponent({
|
|
|
157
157
|
<q-linear-progress indeterminate color="primary" size="2px"/>
|
|
158
158
|
</div>
|
|
159
159
|
<div class="q-ml-lg q-mt-md">
|
|
160
|
+
<p style="font-size: 16px;"> {{ schemaName }} </p>
|
|
160
161
|
<a :href="link" target="_blank" rel="noopener" style="font-size:12px; color:#3b82f6;">
|
|
161
162
|
Open in VSCode
|
|
162
163
|
</a>
|
|
@@ -58,9 +58,10 @@ export class GraphUI {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
highlightSchemaBanner(node) {
|
|
61
|
-
const
|
|
61
|
+
const polygons = node.querySelectorAll("polygon");
|
|
62
|
+
const ele = polygons[2]; // select the second polygon
|
|
62
63
|
if (ele) {
|
|
63
|
-
ele.setAttribute('
|
|
64
|
+
ele.setAttribute('stroke-width', '3.5');
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -160,12 +161,6 @@ export class GraphUI {
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
});
|
|
163
|
-
|
|
164
|
-
$(document).on("keydown.graphui", function (evt) {
|
|
165
|
-
if (evt.keyCode === 27 && self.gv) {
|
|
166
|
-
self.gv.highlight();
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
164
|
},
|
|
170
165
|
});
|
|
171
166
|
}
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
.adjust-fit {
|
|
60
60
|
height: calc(100vh - 54px);
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
|
|
64
|
+
|
|
62
65
|
/* App boot loading overlay & gating */
|
|
63
66
|
#app-loading-overlay {
|
|
64
67
|
position: fixed;
|
|
@@ -167,9 +170,8 @@
|
|
|
167
170
|
</div>
|
|
168
171
|
</q-tooltip>
|
|
169
172
|
</q-btn>
|
|
170
|
-
<a href="https://github.com/allmonday/fastapi-voyager" target="_blank" class="github-corner" aria-label="View source on GitHub"><svg width="52" height="52" viewBox="0 0 250 250" style="fill:#009485; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a
|
|
171
|
-
|
|
172
|
-
</q-toolbar-title> -->
|
|
173
|
+
<a href="https://github.com/allmonday/fastapi-voyager" target="_blank" class="github-corner" aria-label="View source on GitHub"><svg width="52" height="52" viewBox="0 0 250 250" style="fill:#009485; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a>
|
|
174
|
+
</div>
|
|
173
175
|
</q-toolbar>
|
|
174
176
|
</q-header>
|
|
175
177
|
|
|
@@ -475,5 +477,7 @@
|
|
|
475
477
|
});
|
|
476
478
|
</script>
|
|
477
479
|
<script type="module" src="fastapi-voyager-static/vue-main.js"></script>
|
|
480
|
+
|
|
481
|
+
<!-- GA_SNIPPET -->
|
|
478
482
|
</body>
|
|
479
483
|
</html>
|