fastapi-voyager 0.9.3__tar.gz → 0.9.4__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.
Files changed (48) hide show
  1. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/PKG-INFO +10 -38
  2. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/README.md +9 -37
  3. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/version.py +1 -1
  4. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/voyager.py +5 -0
  5. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/component/schema-code-display.js +7 -7
  6. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/graph-ui.js +25 -0
  7. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/index.html +3 -4
  8. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/vue-main.js +12 -5
  9. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/.gitignore +0 -0
  10. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/.python-version +0 -0
  11. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/LICENSE +0 -0
  12. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/pyproject.toml +0 -0
  13. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/__init__.py +0 -0
  14. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/cli.py +0 -0
  15. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/filter.py +0 -0
  16. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/module.py +0 -0
  17. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/render.py +0 -0
  18. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/server.py +0 -0
  19. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/type.py +0 -0
  20. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/type_helper.py +0 -0
  21. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/component/render-graph.js +0 -0
  22. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/component/route-code-display.js +0 -0
  23. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/component/schema-field-filter.js +0 -0
  24. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/graphviz.svg.css +0 -0
  25. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/graphviz.svg.js +0 -0
  26. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/icon/android-chrome-192x192.png +0 -0
  27. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/icon/android-chrome-512x512.png +0 -0
  28. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/icon/apple-touch-icon.png +0 -0
  29. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/icon/favicon-16x16.png +0 -0
  30. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/icon/favicon-32x32.png +0 -0
  31. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/icon/favicon.ico +0 -0
  32. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/icon/site.webmanifest +0 -0
  33. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/quasar.min.css +0 -0
  34. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/src/fastapi_voyager/web/quasar.min.js +0 -0
  35. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/__init__.py +0 -0
  36. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/demo.py +0 -0
  37. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/demo_anno.py +0 -0
  38. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/programatic.py +0 -0
  39. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/service/__init__.py +0 -0
  40. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/service/schema.py +0 -0
  41. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/test_analysis.py +0 -0
  42. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/test_filter.py +0 -0
  43. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/test_generic.py +0 -0
  44. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/test_import.py +0 -0
  45. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/test_module.py +0 -0
  46. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/tests/test_type_helper.py +0 -0
  47. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/uv.lock +0 -0
  48. {fastapi_voyager-0.9.3 → fastapi_voyager-0.9.4}/voyager.jpg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-voyager
3
- Version: 0.9.3
3
+ Version: 0.9.4
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
@@ -212,9 +212,15 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
212
212
  - [x] improve initialization time cost
213
213
  - [x] query route / schema info through realtime api
214
214
  - [x] adjust fe
215
- - [x] adjust layout (0.9.3)
216
- - [x] show field detail in right panel
217
- - [x] show route info in bottom
215
+ - 0.9.3
216
+ - [x] adjust layout
217
+ - [x] show field detail in right panel
218
+ - [x] show route info in bottom
219
+ - 0.9.4
220
+ - [x] close schema sidebar when switch tag/route
221
+ - [x] schema detail panel show fields by default
222
+ - [x] adjust schema panel's height
223
+ - [x] show from base information in subset case
218
224
 
219
225
  #### 0.10
220
226
  - [ ] support opening route in swagger
@@ -263,37 +269,3 @@ pydantic-resolve's @ensure_subset decorator is helpful to pick fields from `sour
263
269
  - [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
264
270
  - Quasar
265
271
 
266
-
267
- ## Changelog
268
-
269
- - 0.9:
270
- - 0.9.3:
271
- - enhancement: better UI
272
- - 0.9.2:
273
- - fix: missing fields in schema detail panel
274
- - optimization: clean up fe codes.
275
- - 0.9.1:
276
- - api change: from `create_app_with_fastapi` to `create_voyager`, and expose as `from fastapi_voyager import create_voyager`
277
- - optimization: lazy load vscode link and source code, speed up the initialization.
278
- - 0.8:
279
- - 0.8.3
280
- - upgrade theme
281
- - 0.8.2
282
- - fix silly typo.
283
- - 0.8.1
284
- - add feature: hide primitive routes
285
- - 0.7:
286
- - 0.7.5
287
- - fix show all display issue
288
- - 0.7.4
289
- - optimize tag/route, move to left.
290
- - fresh on change, no need to click generate any more.
291
- - 0.7.3
292
- - fix `module_color` failure
293
- - 0.7.2
294
- - keep links inside filtered nodes.
295
- - 0.7.1
296
- - support brief mode, you can use `--module_prefix tests.service` to show links between routes and filtered schemas, to make the graph less complicated.
297
- - 0.6:
298
- - 0.6.2:
299
- - fix generic related issue
@@ -185,9 +185,15 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
185
185
  - [x] improve initialization time cost
186
186
  - [x] query route / schema info through realtime api
187
187
  - [x] adjust fe
188
- - [x] adjust layout (0.9.3)
189
- - [x] show field detail in right panel
190
- - [x] show route info in bottom
188
+ - 0.9.3
189
+ - [x] adjust layout
190
+ - [x] show field detail in right panel
191
+ - [x] show route info in bottom
192
+ - 0.9.4
193
+ - [x] close schema sidebar when switch tag/route
194
+ - [x] schema detail panel show fields by default
195
+ - [x] adjust schema panel's height
196
+ - [x] show from base information in subset case
191
197
 
192
198
  #### 0.10
193
199
  - [ ] support opening route in swagger
@@ -236,37 +242,3 @@ pydantic-resolve's @ensure_subset decorator is helpful to pick fields from `sour
236
242
  - [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
237
243
  - Quasar
238
244
 
239
-
240
- ## Changelog
241
-
242
- - 0.9:
243
- - 0.9.3:
244
- - enhancement: better UI
245
- - 0.9.2:
246
- - fix: missing fields in schema detail panel
247
- - optimization: clean up fe codes.
248
- - 0.9.1:
249
- - api change: from `create_app_with_fastapi` to `create_voyager`, and expose as `from fastapi_voyager import create_voyager`
250
- - optimization: lazy load vscode link and source code, speed up the initialization.
251
- - 0.8:
252
- - 0.8.3
253
- - upgrade theme
254
- - 0.8.2
255
- - fix silly typo.
256
- - 0.8.1
257
- - add feature: hide primitive routes
258
- - 0.7:
259
- - 0.7.5
260
- - fix show all display issue
261
- - 0.7.4
262
- - optimize tag/route, move to left.
263
- - fresh on change, no need to click generate any more.
264
- - 0.7.3
265
- - fix `module_color` failure
266
- - 0.7.2
267
- - keep links inside filtered nodes.
268
- - 0.7.1
269
- - support brief mode, you can use `--module_prefix tests.service` to show links between routes and filtered schemas, to make the graph less complicated.
270
- - 0.6:
271
- - 0.6.2:
272
- - fix generic related issue
@@ -1,2 +1,2 @@
1
1
  __all__ = ["__version__"]
2
- __version__ = "0.9.3"
2
+ __version__ = "0.9.4"
@@ -144,6 +144,11 @@ class Voyager:
144
144
  """
145
145
  full_name = full_class_name(schema)
146
146
  bases_fields = get_bases_fields([s for s in schema.__bases__ if is_inheritance_of_pydantic_base(s)])
147
+
148
+ subset_reference = getattr(schema, const.ENSURE_SUBSET_REFERENCE, None)
149
+ if subset_reference and is_inheritance_of_pydantic_base(subset_reference):
150
+ bases_fields.update(get_bases_fields([subset_reference]))
151
+
147
152
  if full_name not in self.node_set:
148
153
  # skip meta info for normal queries
149
154
  self.node_set[full_name] = SchemaNode(
@@ -20,7 +20,7 @@ export default defineComponent({
20
20
  const link = ref("");
21
21
  const error = ref("");
22
22
  const fields = ref([]); // schema fields list
23
- const tab = ref("source");
23
+ const tab = ref("fields");
24
24
 
25
25
 
26
26
  async function highlightLater() {
@@ -138,24 +138,21 @@ export default defineComponent({
138
138
 
139
139
  <div style="padding:8px 12px 0 12px; box-sizing:border-box;">
140
140
  <q-tabs v-model="tab" align="left" dense active-color="primary" indicator-color="primary" class="text-grey-8">
141
- <q-tab name="source" label="Source Code" />
142
141
  <q-tab name="fields" label="Fields" />
142
+ <q-tab name="source" label="Source Code" />
143
143
  </q-tabs>
144
144
  </div>
145
145
  <q-separator />
146
- <div style="padding:8px 16px 16px 16px; height:75%; box-sizing:border-box; overflow:auto;">
146
+ <div style="padding:8px 16px 16px 16px; box-sizing:border-box; overflow:auto;">
147
147
  <div v-if="error" style="color:#c10015; font-family:Menlo, monospace; font-size:12px;">{{ error }}</div>
148
148
  <template v-else>
149
- <div v-show="tab === 'source'">
150
- <pre style="margin:0;"><code class="language-python">{{ code }}</code></pre>
151
- </div>
152
149
  <div v-show="tab === 'fields'">
153
150
  <table style="border-collapse:collapse; width:100%; font-size:12px; font-family:Menlo, monospace;">
154
151
  <thead>
155
152
  <tr>
156
153
  <th style="text-align:left; border-bottom:1px solid #ddd; padding:4px 6px;">Field</th>
157
154
  <th style="text-align:left; border-bottom:1px solid #ddd; padding:4px 6px;">Type</th>
158
- <th style="text-align:left; border-bottom:1px solid #ddd; padding:4px 6px;">From Base</th>
155
+ <th style="text-align:left; border-bottom:1px solid #ddd; padding:4px 6px;">Inherited</th>
159
156
  </tr>
160
157
  </thead>
161
158
  <tbody>
@@ -170,6 +167,9 @@ export default defineComponent({
170
167
  </tbody>
171
168
  </table>
172
169
  </div>
170
+ <div v-show="tab === 'source'">
171
+ <pre style="margin:0;"><code class="language-python">{{ code }}</code></pre>
172
+ </div>
173
173
  </template>
174
174
  </div>
175
175
  </div>
@@ -105,6 +105,31 @@ export class GraphUI {
105
105
  self._highlight();
106
106
  });
107
107
 
108
+ // svg 背景点击高亮清空
109
+
110
+ $(document).off('click.graphui').on('click.graphui', function (evt) {
111
+ // 如果点击目标不在 graph 容器内,直接退出
112
+ const graphContainer = $(self.selector)[0];
113
+ if (!graphContainer || !evt.target || !graphContainer.contains(evt.target)) {
114
+ return;
115
+ }
116
+
117
+ let isNode = false;
118
+ const $nodes = self.gv.nodes();
119
+ const node = evt.target.parentNode;
120
+ $nodes.each(function () {
121
+ if (this === node) {
122
+ isNode = true;
123
+ }
124
+ });
125
+ if (!isNode && self.gv) {
126
+ self.gv.highlight();
127
+ if (self.options.resetCb) {
128
+ self.options.resetCb();
129
+ }
130
+ }
131
+ });
132
+
108
133
  $(document).on("keydown.graphui", function (evt) {
109
134
  if (evt.keyCode === 27 && self.gv) {
110
135
  self.gv.highlight();
@@ -163,7 +163,7 @@
163
163
 
164
164
  <q-drawer
165
165
  v-model="state.detailDrawer"
166
- width="400"
166
+ width="500"
167
167
  side="right"
168
168
  overlay
169
169
  bordered
@@ -178,7 +178,6 @@
178
178
  icon="chevron_right"
179
179
  />
180
180
  </div>
181
- <!-- move to bottom -->
182
181
  <schema-code-display
183
182
  :schema-name="schemaCodeName"
184
183
  :schemas="state.rawSchemasFull"
@@ -290,8 +289,8 @@
290
289
  />
291
290
  </q-dialog>
292
291
 
293
- <q-dialog v-model="showRouteDetail" position="bottom">
294
- <q-card style="width: 1100px; max-width: 1100px">
292
+ <q-dialog v-model="showRouteDetail" seamless position="bottom">
293
+ <q-card style="width: 1100px; max-width: 1100px; max-height: 40vh">
295
294
  <route-code-display :route-id="routeCodeId" @close="showRouteDetail=false" />
296
295
  </q-card>
297
296
  </q-dialog>
@@ -27,7 +27,7 @@ const app = createApp({
27
27
  initializing: true,
28
28
  // Splitter size (left panel width in px)
29
29
  splitter: 300,
30
- detailDrawer: false
30
+ detailDrawer: false,
31
31
  });
32
32
 
33
33
  const showDetail = ref(false);
@@ -42,7 +42,7 @@ const app = createApp({
42
42
  const schemaFieldFilterSchema = ref(null); // external schemaName for schema-field-filter
43
43
  const schemaCodeName = ref("");
44
44
  const routeCodeId = ref("");
45
- const showRouteDetail = ref(false)
45
+ const showRouteDetail = ref(false);
46
46
 
47
47
  function openDetail() {
48
48
  showDetail.value = true;
@@ -109,13 +109,17 @@ const app = createApp({
109
109
  onSchemaClick: (id) => {
110
110
  if (state.rawSchemas.has(id)) {
111
111
  schemaCodeName.value = id;
112
- state.detailDrawer = true
112
+ state.detailDrawer = true;
113
113
  }
114
114
  if (id in state.routeItems) {
115
115
  routeCodeId.value = id;
116
- showRouteDetail.value = true
116
+ showRouteDetail.value = true;
117
117
  }
118
118
  },
119
+ resetCb: () => {
120
+ state.detailDrawer = false;
121
+ showRouteDetail.value = false;
122
+ }
119
123
  });
120
124
 
121
125
  await graphUI.render(dotText, resetZoom);
@@ -202,8 +206,9 @@ const app = createApp({
202
206
  state.tag = tagName;
203
207
  state.routeId = "";
204
208
  onGenerate();
205
- return;
206
209
  }
210
+ state.detailDrawer = false;
211
+ showRouteDetail.value = false;
207
212
  }
208
213
 
209
214
  function selectRoute(routeId) {
@@ -212,6 +217,8 @@ const app = createApp({
212
217
  } else {
213
218
  state.routeId = routeId;
214
219
  }
220
+ state.detailDrawer = false;
221
+ showRouteDetail.value = false;
215
222
  onGenerate();
216
223
  }
217
224
 
File without changes
File without changes