fastapi-voyager 0.9.3__py3-none-any.whl → 0.9.5__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.
@@ -1,2 +1,2 @@
1
1
  __all__ = ["__version__"]
2
- __version__ = "0.9.3"
2
+ __version__ = "0.9.5"
@@ -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"
@@ -221,43 +220,42 @@
221
220
  class="q-mr-sm"
222
221
  :name="state.tag == tag.name ? 'folder' : 'folder_open'"
223
222
  ></q-icon>
224
- <span>{{ tag.name }}</span>
223
+ <span>{{ tag.name }} <q-chip class="q-ml-sm" dense>{{ tag.routes.length }}</q-chip></span>
225
224
  </div>
226
225
  </div>
227
226
  </template>
228
-
229
- <q-list separator>
230
- <q-item
231
- v-for="route in (state.hidePrimitiveRoute ? tag.routes.filter(r => !r.is_primitive) :tag.routes || [])"
232
- :key="route.id"
233
- clickable
234
- v-ripple
235
- :active="state.routeId === route.id"
236
- active-class=""
237
- @click="selectRoute(route.id)"
238
- >
239
- <q-item-section>
240
- <span class="q-ml-lg" style="white-space: nowrap">
241
- <q-icon
242
- class="q-mr-sm"
243
- name="data_object"
244
- ></q-icon>
245
- {{ route.name }}
246
- </span>
247
- </q-item-section>
248
- </q-item>
249
- <q-item
250
- v-if="!tag.routes || tag.routes.length === 0"
251
- dense
252
- >
253
- <q-item-section class="text-grey-6"
254
- >No routes</q-item-section
227
+ <q-list separator style="overflow: auto; max-height: 60vh;">
228
+ <q-item
229
+ v-for="route in (state.hidePrimitiveRoute ? tag.routes.filter(r => !r.is_primitive) :tag.routes || [])"
230
+ :key="route.id"
231
+ clickable
232
+ v-ripple
233
+ :active="state.routeId === route.id"
234
+ active-class=""
235
+ @click="selectRoute(route.id)"
236
+ >
237
+ <q-item-section>
238
+ <span class="q-ml-lg" style="white-space: nowrap">
239
+ <q-icon
240
+ class="q-mr-sm"
241
+ name="data_object"
242
+ ></q-icon>
243
+ {{ route.name }}
244
+ </span>
245
+ </q-item-section>
246
+ </q-item>
247
+ <q-item
248
+ v-if="!tag.routes || tag.routes.length === 0"
249
+ dense
255
250
  >
256
- </q-item>
257
- </q-list>
251
+ <q-item-section class="text-grey-6"
252
+ >No routes</q-item-section
253
+ >
254
+ </q-item>
255
+ </q-list>
256
+ </q-scroll-area>
258
257
  </q-expansion-item>
259
258
  </q-list>
260
- </q-scroll-area>
261
259
  </div>
262
260
  </template>
263
261
 
@@ -290,9 +288,12 @@
290
288
  />
291
289
  </q-dialog>
292
290
 
293
- <q-dialog v-model="showRouteDetail" position="bottom">
294
- <q-card style="width: 1100px; max-width: 1100px">
295
- <route-code-display :route-id="routeCodeId" @close="showRouteDetail=false" />
291
+ <q-dialog v-model="showRouteDetail" seamless position="bottom">
292
+ <q-card style="width: 1100px; max-width: 1100px; max-height: 40vh">
293
+ <route-code-display
294
+ :route-id="routeCodeId"
295
+ @close="showRouteDetail=false"
296
+ />
296
297
  </q-card>
297
298
  </q-dialog>
298
299
 
@@ -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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-voyager
3
- Version: 0.9.3
3
+ Version: 0.9.5
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
@@ -163,7 +163,7 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
163
163
 
164
164
  ### backlog
165
165
  - [ ] user can generate nodes/edges manually and connect to generated ones
166
- - [ ] add owner
166
+ - [ ] eg: add owner
167
167
  - [ ] add extra info for schema
168
168
  - [ ] display standard ER diagram `hard`
169
169
  - [ ] display potential invalid links
@@ -212,11 +212,21 @@ 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
224
+ - 0.9.5
225
+ - [x] route list should have a max height
218
226
 
219
227
  #### 0.10
228
+ - [ ] perfomance: cache the origin data, refactor voyager.py
229
+ - [ ] better edge for brief mode
220
230
  - [ ] support opening route in swagger
221
231
  - config docs path
222
232
  - [ ] add http method for route
@@ -224,15 +234,14 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
224
234
  - [ ] logging information
225
235
  - [ ] add tests
226
236
  - [ ] hide brief mode if not configured
227
- - [ ] optimize static resource
237
+ - [ ] optimize static resource (allow manually config url)
228
238
  - [ ] show route count in tag expansion item
229
- - [ ] route list show have a max height to trigger scrollable
239
+ - [ ] route list should have a max height to trigger scrollable
230
240
  - [ ] fix layout issue when rendering huge graph
241
+ - [ ] fix missing route (tag has only one route which return primitive value)
231
242
 
232
243
  #### 0.11
233
- - [ ] improve user experience
234
- - double click to show detail
235
- - improve search dialog
244
+ - [ ] improve search dialog
236
245
 
237
246
  #### 0.12
238
247
  - [ ] integration with pydantic-resolve
@@ -241,7 +250,6 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
241
250
 
242
251
  #### 0.13
243
252
  - [ ] config release pipeline
244
- - [ ]
245
253
 
246
254
  ## Using with pydantic-resolve
247
255
 
@@ -263,37 +271,3 @@ pydantic-resolve's @ensure_subset decorator is helpful to pick fields from `sour
263
271
  - [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
264
272
  - Quasar
265
273
 
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
@@ -6,18 +6,18 @@ fastapi_voyager/render.py,sha256=qy3g1Rz1s8XkuR_6n1Q1YPwy_oMOjWjNswTHQjdz4N0,776
6
6
  fastapi_voyager/server.py,sha256=pg-LHDj4yU0usDA1b2X2Kt2_OCrexFA2G9ifGxb52Uc,6196
7
7
  fastapi_voyager/type.py,sha256=pWYKmgb9e0W_JeD7k54Mr2lxUZV_Ir9TNpewGRwHyHQ,1629
8
8
  fastapi_voyager/type_helper.py,sha256=hjBC4E0tgBpQDlYxGg74uK07SXjsrAgictEETJfIpYM,9231
9
- fastapi_voyager/version.py,sha256=Lt2a1ZjlXG3QcL31iJHgzvRFDSTSsCXmwjQNWNdNUMY,48
10
- fastapi_voyager/voyager.py,sha256=pXvA3ye5Jq6aJ6YrZFbTHjJ9MzdydqWllIgY8RFK_4A,10793
11
- fastapi_voyager/web/graph-ui.js,sha256=QYJXHOH4EWF2jbcX3usTKv4tNody0RjpnVz-eh0UKkU,4185
9
+ fastapi_voyager/version.py,sha256=edeIqVARN2rX8n02TnXhblafTm15NsTYlNCYyC9fXBo,48
10
+ fastapi_voyager/voyager.py,sha256=QKWletUwZeHm8e8ZRcGm6OuhAdiik3tT7sOU-QnEuGA,11036
11
+ fastapi_voyager/web/graph-ui.js,sha256=FmKA3eeHMEeUDNuay3f54_fv4eGHT7MT0TaGqXhyMWQ,4978
12
12
  fastapi_voyager/web/graphviz.svg.css,sha256=zDCjjpT0Idufu5YOiZI76PL70-avP3vTyzGPh9M85Do,1563
13
13
  fastapi_voyager/web/graphviz.svg.js,sha256=lvAdbjHc-lMSk4GQp-iqYA2PCFX4RKnW7dFaoe0LUHs,16005
14
- fastapi_voyager/web/index.html,sha256=YtVoDRrgz64E7IHpcPJBzUb1DI1H5P7a-3ziTx5BHYA,13735
14
+ fastapi_voyager/web/index.html,sha256=qH7vs_1SpFJWZlzMsPBuHToCysLpRsb4LC5vRBjWhZM,13930
15
15
  fastapi_voyager/web/quasar.min.css,sha256=F5jQe7X2XT54VlvAaa2V3GsBFdVD-vxDZeaPLf6U9CU,203145
16
16
  fastapi_voyager/web/quasar.min.js,sha256=h0ftyPMW_CRiyzeVfQqiup0vrVt4_QWojpqmpnpn07E,502974
17
- fastapi_voyager/web/vue-main.js,sha256=kQJpcQ2ENzA90v1XJ1P2bNGfeFC4drTGoG5dNhQKQqc,8105
17
+ fastapi_voyager/web/vue-main.js,sha256=bn4Q9FqX5RJVG9bA5xgUUt5TJf9CjiXcKtn_ikLsaKQ,8357
18
18
  fastapi_voyager/web/component/render-graph.js,sha256=e8Xgh2Kl-nYU0P1gstEmAepCgFnk2J6UdxW8TlMafGs,2322
19
19
  fastapi_voyager/web/component/route-code-display.js,sha256=8NJPPjNRUC21gjpY8XYEQs4RBbhX1pCiqEhJp39ku6k,3678
20
- fastapi_voyager/web/component/schema-code-display.js,sha256=B-NOAKQIDORvFlKrsWNFAMGweXYBXrpg6AjKt4TFQFI,6256
20
+ fastapi_voyager/web/component/schema-code-display.js,sha256=UgFotzvqSuhnPXNOr6w_r1fV2_savRiCdokEvferutE,6244
21
21
  fastapi_voyager/web/component/schema-field-filter.js,sha256=PR8d2_u1UiSLrS5zqAvY2UR8LbvjBqiUDt71tm1DJTs,6345
22
22
  fastapi_voyager/web/icon/android-chrome-192x192.png,sha256=35sBy6jmUFJCcquStaafHH1qClZIbd-X3PIKSeLkrNo,37285
23
23
  fastapi_voyager/web/icon/android-chrome-512x512.png,sha256=eb2eDjCwIruc05029_0L9hcrkVkv8KceLn1DJMYU0zY,210789
@@ -26,8 +26,8 @@ fastapi_voyager/web/icon/favicon-16x16.png,sha256=JC07jEzfIYxBIoQn_FHXvyHuxESdhW
26
26
  fastapi_voyager/web/icon/favicon-32x32.png,sha256=C7v1h58cfWOsiLp9yOIZtlx-dLasBcq3NqpHVGRmpt4,1859
27
27
  fastapi_voyager/web/icon/favicon.ico,sha256=tZolYIXkkBcFiYl1A8ksaXN2VjGamzcSdes838dLvNc,15406
28
28
  fastapi_voyager/web/icon/site.webmanifest,sha256=ep4Hzh9zhmiZF2At3Fp1dQrYQuYF_3ZPZxc1KcGBvwQ,263
29
- fastapi_voyager-0.9.3.dist-info/METADATA,sha256=m7vs-SegP6z60WrAwoMBV-fqyrUwlg08_EktecMzcSM,9490
30
- fastapi_voyager-0.9.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
- fastapi_voyager-0.9.3.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
32
- fastapi_voyager-0.9.3.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
33
- fastapi_voyager-0.9.3.dist-info/RECORD,,
29
+ fastapi_voyager-0.9.5.dist-info/METADATA,sha256=fnFPewv9pgh6hA4k1SXufzEmq7a-2vmMwAvCl49xdQk,8833
30
+ fastapi_voyager-0.9.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
+ fastapi_voyager-0.9.5.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
32
+ fastapi_voyager-0.9.5.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
33
+ fastapi_voyager-0.9.5.dist-info/RECORD,,