fastapi-voyager 0.4.1__py3-none-any.whl → 0.4.2__py3-none-any.whl
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/graph.py +3 -1
- fastapi_voyager/type_helper.py +24 -2
- fastapi_voyager/version.py +1 -1
- fastapi_voyager/web/icon/android-chrome-192x192.png +0 -0
- fastapi_voyager/web/icon/android-chrome-512x512.png +0 -0
- fastapi_voyager/web/icon/apple-touch-icon.png +0 -0
- fastapi_voyager/web/icon/favicon-16x16.png +0 -0
- fastapi_voyager/web/icon/favicon-32x32.png +0 -0
- fastapi_voyager/web/icon/favicon.ico +0 -0
- fastapi_voyager/web/icon/site.webmanifest +1 -0
- fastapi_voyager/web/index.html +8 -1
- {fastapi_voyager-0.4.1.dist-info → fastapi_voyager-0.4.2.dist-info}/METADATA +16 -10
- {fastapi_voyager-0.4.1.dist-info → fastapi_voyager-0.4.2.dist-info}/RECORD +16 -9
- {fastapi_voyager-0.4.1.dist-info → fastapi_voyager-0.4.2.dist-info}/WHEEL +0 -0
- {fastapi_voyager-0.4.1.dist-info → fastapi_voyager-0.4.2.dist-info}/entry_points.txt +0 -0
- {fastapi_voyager-0.4.1.dist-info → fastapi_voyager-0.4.2.dist-info}/licenses/LICENSE +0 -0
fastapi_voyager/graph.py
CHANGED
|
@@ -8,7 +8,8 @@ from fastapi_voyager.type_helper import (
|
|
|
8
8
|
is_inheritance_of_pydantic_base,
|
|
9
9
|
get_pydantic_fields,
|
|
10
10
|
get_vscode_link,
|
|
11
|
-
get_source
|
|
11
|
+
get_source,
|
|
12
|
+
update_forward_refs
|
|
12
13
|
)
|
|
13
14
|
from pydantic import BaseModel
|
|
14
15
|
from fastapi_voyager.type import Route, SchemaNode, Link, Tag, ModuleNode
|
|
@@ -111,6 +112,7 @@ class Analytics:
|
|
|
111
112
|
# add response_models and create links from route -> response_model
|
|
112
113
|
for schema in get_core_types(route.response_model):
|
|
113
114
|
if schema and issubclass(schema, BaseModel):
|
|
115
|
+
update_forward_refs(schema)
|
|
114
116
|
target_name = full_class_name(schema)
|
|
115
117
|
self.links.append(Link(
|
|
116
118
|
source=route_id,
|
fastapi_voyager/type_helper.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import inspect
|
|
2
2
|
import os
|
|
3
3
|
from pydantic import BaseModel
|
|
4
|
-
from typing import get_origin, get_args, Union, Annotated, Any
|
|
4
|
+
from typing import get_origin, get_args, Union, Annotated, Any, Type
|
|
5
5
|
from fastapi_voyager.type import FieldInfo
|
|
6
6
|
from types import UnionType
|
|
7
7
|
|
|
@@ -229,4 +229,26 @@ def get_source(kls):
|
|
|
229
229
|
source = inspect.getsource(kls)
|
|
230
230
|
return source
|
|
231
231
|
except Exception:
|
|
232
|
-
return "failed to get source"
|
|
232
|
+
return "failed to get source"
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def safe_issubclass(kls, classinfo):
|
|
236
|
+
try:
|
|
237
|
+
return issubclass(kls, classinfo)
|
|
238
|
+
except TypeError:
|
|
239
|
+
return False
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def update_forward_refs(kls):
|
|
243
|
+
def update_pydantic_forward_refs(kls: Type[BaseModel]):
|
|
244
|
+
"""
|
|
245
|
+
recursively update refs.
|
|
246
|
+
"""
|
|
247
|
+
kls.model_rebuild()
|
|
248
|
+
values = kls.model_fields.values()
|
|
249
|
+
for field in values:
|
|
250
|
+
update_forward_refs(field.annotation)
|
|
251
|
+
|
|
252
|
+
for shelled_types in get_core_types(kls):
|
|
253
|
+
if safe_issubclass(shelled_types, BaseModel):
|
|
254
|
+
update_pydantic_forward_refs(shelled_types)
|
fastapi_voyager/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__all__ = ["__version__"]
|
|
2
|
-
__version__ = "0.4.
|
|
2
|
+
__version__ = "0.4.2"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
fastapi_voyager/web/index.html
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
<html>
|
|
2
2
|
<head>
|
|
3
|
-
<title>FastAPI
|
|
3
|
+
<title>FastAPI Voyager</title>
|
|
4
|
+
<meta name="theme-color" content="#ffffff" />
|
|
4
5
|
<link rel="stylesheet" href="/static/graphviz.svg.css" />
|
|
5
6
|
<link rel="stylesheet" href="/static/quasar.min.css" />
|
|
7
|
+
<!-- App Icons / Favicons -->
|
|
8
|
+
<link rel="apple-touch-icon" sizes="180x180" href="/static/icon/apple-touch-icon.png" />
|
|
9
|
+
<link rel="icon" type="image/png" sizes="32x32" href="/static/icon/favicon-32x32.png" />
|
|
10
|
+
<link rel="icon" type="image/png" sizes="16x16" href="/static/icon/favicon-16x16.png" />
|
|
11
|
+
<link rel="icon" href="/static/icon/favicon.ico" sizes="any" />
|
|
12
|
+
<link rel="manifest" href="/static/icon/site.webmanifest" />
|
|
6
13
|
<link
|
|
7
14
|
href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons"
|
|
8
15
|
rel="stylesheet"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-voyager
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Visualize FastAPI application's routing tree and dependencies
|
|
5
5
|
Project-URL: Homepage, https://github.com/allmonday/fastapi-voyager
|
|
6
6
|
Project-URL: Source, https://github.com/allmonday/fastapi-voyager
|
|
@@ -28,7 +28,9 @@ Description-Content-Type: text/markdown
|
|
|
28
28
|
[](https://pypi.python.org/pypi/fastapi-voyager)
|
|
29
29
|

|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
<p align="center"><img src="./voyager.jpg" alt="" /></p>
|
|
32
|
+
|
|
33
|
+
> This repo is still in early stage, currently it supports pydantic v2 only, previous name: fastapi-router-viz
|
|
32
34
|
|
|
33
35
|
Inspect your API interactively
|
|
34
36
|
|
|
@@ -69,28 +71,32 @@ voyager -m tests.demo
|
|
|
69
71
|
--module_color=tests.demo:tomato
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
### generate the graph
|
|
75
|
+
after initialization, pick tag, rotue (optional) and click `generate`.
|
|
73
76
|
|
|
74
77
|
<img width="1919" height="898" alt="image" style="border: 1px solid #aaa" src="https://github.com/user-attachments/assets/05e321d0-49f3-4af6-a7c7-f4c9c6b1dbfd" />
|
|
75
78
|
|
|
79
|
+
### highlight
|
|
76
80
|
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.
|
|
77
81
|
|
|
78
82
|
<img width="1485" height="616" alt="image" style="border: 1px solid #aaa" src="https://github.com/user-attachments/assets/70c4095f-86c7-45da-a6f0-fd41ac645813" />
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
`shift` click a node to check related
|
|
82
|
-
|
|
83
|
-
pick a field to narrow the result.
|
|
84
|
+
### filter related nodes
|
|
85
|
+
`shift` click a node to check related node, pick a field to narrow the result.
|
|
84
86
|
|
|
85
87
|
<img width="1917" height="800" alt="image" style="border: 1px solid #aaa" src="https://github.com/user-attachments/assets/e770dc70-f293-49e1-bcd7-d8dffa15d9ea" />
|
|
86
88
|
|
|
89
|
+
### view source code
|
|
87
90
|
`alt` click a node to show source code or open file in vscode.
|
|
88
91
|
|
|
89
|
-
<img width="
|
|
92
|
+
<img width="1049" height="694" alt="image" src="https://github.com/user-attachments/assets/7839ac83-8d60-44ad-b1c9-9652a76339b1" />
|
|
93
|
+
|
|
94
|
+
<img width="1042" height="675" alt="image" src="https://github.com/user-attachments/assets/38ae705f-5982-4a02-9c3f-038b1d00bcf6" />
|
|
95
|
+
|
|
96
|
+
`alt` click a route to show source code or open file in vscode
|
|
90
97
|
|
|
91
|
-
|
|
98
|
+
<img width="882" height="445" alt="image" src="https://github.com/user-attachments/assets/158560ef-63ca-4991-9b7d-587be4fa04e4" />
|
|
92
99
|
|
|
93
|
-
[](https://www.youtube.com/watch?v=msYsB9Cc3CA "Unity Snake Game")
|
|
94
100
|
|
|
95
101
|
|
|
96
102
|
## Command Line Usage
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
fastapi_voyager/__init__.py,sha256=E5WTV_sYs2LK8I6jzA7AuvFU5a8_vjnDseC3DMha0iQ,149
|
|
2
2
|
fastapi_voyager/cli.py,sha256=FuXllJtlsm33FX6VmDdAFWzzQ5TIraUizBDgvBj3vmY,10489
|
|
3
3
|
fastapi_voyager/filter.py,sha256=uZrVVMhHG5E7j1wdsiB02RAyoDdF1q8A4J04oCboYAU,4644
|
|
4
|
-
fastapi_voyager/graph.py,sha256=
|
|
4
|
+
fastapi_voyager/graph.py,sha256=8QMQivzhqqm8f53P0w_MTat8k2bONS2rLj2cMFtAq8E,14562
|
|
5
5
|
fastapi_voyager/module.py,sha256=ppiJ46rdyA4yQnQA5IQqsMOHGgWdz5orJ0bEQydHsEk,1885
|
|
6
6
|
fastapi_voyager/server.py,sha256=UFj6c0Yx4Rmy56eFXv65n1VdmJeiBX43KsDm6D65U28,2943
|
|
7
7
|
fastapi_voyager/type.py,sha256=k8V45obOzS6HQD8RqaBh4xKBQRUsV-mA_UdMZu51KR0,1005
|
|
8
|
-
fastapi_voyager/type_helper.py,sha256=
|
|
9
|
-
fastapi_voyager/version.py,sha256=
|
|
8
|
+
fastapi_voyager/type_helper.py,sha256=nLSVOk_ha61kgDwubeh1HdUB5OQPYVtnYlxI0JQcRlk,8046
|
|
9
|
+
fastapi_voyager/version.py,sha256=7BqnQCB6S1vDbsVe2UW0GvMOqKdYZaGtTRPk02yALhA,48
|
|
10
10
|
fastapi_voyager/web/graph-ui.js,sha256=eEjDnJVMvk35LdRoxcqX_fZxLFS9_bUrGAZL6K2O5C0,4176
|
|
11
11
|
fastapi_voyager/web/graphviz.svg.css,sha256=zDCjjpT0Idufu5YOiZI76PL70-avP3vTyzGPh9M85Do,1563
|
|
12
12
|
fastapi_voyager/web/graphviz.svg.js,sha256=lvAdbjHc-lMSk4GQp-iqYA2PCFX4RKnW7dFaoe0LUHs,16005
|
|
13
|
-
fastapi_voyager/web/index.html,sha256
|
|
13
|
+
fastapi_voyager/web/index.html,sha256=kBa0BOfU-Bt5JabSWm-TAgcMB9gUYl843fxDcoNbHFE,8357
|
|
14
14
|
fastapi_voyager/web/quasar.min.css,sha256=F5jQe7X2XT54VlvAaa2V3GsBFdVD-vxDZeaPLf6U9CU,203145
|
|
15
15
|
fastapi_voyager/web/quasar.min.js,sha256=h0ftyPMW_CRiyzeVfQqiup0vrVt4_QWojpqmpnpn07E,502974
|
|
16
16
|
fastapi_voyager/web/vue-main.js,sha256=PpvaoDquNgOAsqWgIO75bWRcEVl_vuos_vM1Qo5jlww,6406
|
|
17
17
|
fastapi_voyager/web/component/route-code-display.js,sha256=NECC1OGcPCdDfbghtRJEnmFM6HmH5J3win2ibapWPeA,2649
|
|
18
18
|
fastapi_voyager/web/component/schema-code-display.js,sha256=oOusgTvCaWGnoKb-NBwu0SXqJJf2PTUtp3lUczokTBM,5515
|
|
19
19
|
fastapi_voyager/web/component/schema-field-filter.js,sha256=9WBjO6JJl2yf6OiiXoddMgvL32qTDu0PM-RxkkJ7t5M,6267
|
|
20
|
-
fastapi_voyager-
|
|
21
|
-
fastapi_voyager-
|
|
22
|
-
fastapi_voyager-
|
|
23
|
-
fastapi_voyager-
|
|
24
|
-
fastapi_voyager-
|
|
20
|
+
fastapi_voyager/web/icon/android-chrome-192x192.png,sha256=35sBy6jmUFJCcquStaafHH1qClZIbd-X3PIKSeLkrNo,37285
|
|
21
|
+
fastapi_voyager/web/icon/android-chrome-512x512.png,sha256=eb2eDjCwIruc05029_0L9hcrkVkv8KceLn1DJMYU0zY,210789
|
|
22
|
+
fastapi_voyager/web/icon/apple-touch-icon.png,sha256=gnWK46tPnvSw1-oYZjgI02wpoO4OrIzsVzGHC5oKWO0,33187
|
|
23
|
+
fastapi_voyager/web/icon/favicon-16x16.png,sha256=JC07jEzfIYxBIoQn_FHXvyHuxESdhWNKLtjWURfTSFQ,686
|
|
24
|
+
fastapi_voyager/web/icon/favicon-32x32.png,sha256=C7v1h58cfWOsiLp9yOIZtlx-dLasBcq3NqpHVGRmpt4,1859
|
|
25
|
+
fastapi_voyager/web/icon/favicon.ico,sha256=tZolYIXkkBcFiYl1A8ksaXN2VjGamzcSdes838dLvNc,15406
|
|
26
|
+
fastapi_voyager/web/icon/site.webmanifest,sha256=ep4Hzh9zhmiZF2At3Fp1dQrYQuYF_3ZPZxc1KcGBvwQ,263
|
|
27
|
+
fastapi_voyager-0.4.2.dist-info/METADATA,sha256=vnvoDjdwkReKZLo9ZtKUO05cObl3HySa6R_GuWxe7PY,6154
|
|
28
|
+
fastapi_voyager-0.4.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
+
fastapi_voyager-0.4.2.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
|
|
30
|
+
fastapi_voyager-0.4.2.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
|
|
31
|
+
fastapi_voyager-0.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|