Skip to content

Commit 33500e6

Browse files
♻️ Rename endpoint to path operation (#56)
1 parent 0d320ad commit 33500e6

14 files changed

Lines changed: 155 additions & 136 deletions

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ A Visual Studio Code extension for FastAPI application development. Available on
66

77
This extension enhances the FastAPI development experience in Visual Studio Code by providing:
88

9-
### Endpoint Explorer
9+
### Path Operation Explorer
1010

11-
The Endpoint Explorer provides a hierarchical tree view of all FastAPI routes in your application. You can expand routers to see their associated endpoints, and click on any route to jump directly to its definition in the code. You can also jump to router definitions by right-clicking on a router node.
11+
The Path Operation Explorer provides a hierarchical tree view of all FastAPI routes in your application. You can expand routers to see their associated path operations, and click on any route to jump directly to its definition in the code. You can also jump to router definitions by right-clicking on a router node.
1212

13-
![Endpoint Explorer GIF](media/walkthrough/endpoints.gif)
13+
![Path Operation Explorer GIF](media/walkthrough/path-operations.gif)
1414

1515
### Search for routes
1616

TELEMETRY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This disables only the FastAPI extension's telemetry while leaving other telemet
2828

2929
We collect anonymous usage metrics to improve the extension. We do **not** collect:
3030
- File paths or file contents
31-
- Route paths or endpoint names
31+
- Route paths or path operation names
3232
- Any code from your project
3333
- IP addresses (geo-IP is disabled)
3434

@@ -42,7 +42,7 @@ We collect anonymous usage metrics to improve the extension. We do **not** colle
4242
| Extension deactivated | Session duration (time from activation to deactivation) | Helps us understand how long users keep VS Code open with the extension active |
4343
| Activation failed | Error category (e.g., "parse_error", "wasm_load_error"), failure stage | Helps us debug issues users encounter |
4444
| Entrypoint detected | Detection duration, method used (config/pyproject/heuristic), success/failure, routes and routers count | Helps us understand which detection methods work best |
45-
| Tree view visible | _(none)_ | Know if users see the endpoint explorer |
45+
| Tree view visible | _(none)_ | Know if users see the path operation explorer |
4646
| Search executed | Number of results, whether user selected a result | Helps us understand search usage |
4747
| CodeLens provided | Number of test calls found, number matched to routes | Helps us understand CodeLens effectiveness |
4848
| Routes navigated | Count of navigations (cumulative) | Helps us understand feature usage depth |

package.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
],
4141
"commands": [
4242
{
43-
"command": "fastapi-vscode.refreshEndpoints",
44-
"title": "Refresh Endpoints",
43+
"command": "fastapi-vscode.refreshPathOperations",
44+
"title": "Refresh Path Operations",
4545
"category": "FastAPI",
4646
"icon": "$(refresh)"
4747
},
@@ -52,8 +52,8 @@
5252
"icon": "$(fold)"
5353
},
5454
{
55-
"command": "fastapi-vscode.copyEndpointPath",
56-
"title": "Copy Endpoint Path",
55+
"command": "fastapi-vscode.copyPathOperationPath",
56+
"title": "Copy Path to Path Operation",
5757
"category": "FastAPI"
5858
},
5959
{
@@ -67,8 +67,8 @@
6767
"category": "FastAPI"
6868
},
6969
{
70-
"command": "fastapi-vscode.searchEndpoints",
71-
"title": "Search Endpoints...",
70+
"command": "fastapi-vscode.searchPathOperations",
71+
"title": "Search Path Operations...",
7272
"category": "FastAPI",
7373
"icon": "$(search)"
7474
},
@@ -105,15 +105,15 @@
105105
],
106106
"keybindings": [
107107
{
108-
"command": "fastapi-vscode.searchEndpoints",
108+
"command": "fastapi-vscode.searchPathOperations",
109109
"key": "ctrl+shift+e",
110110
"mac": "cmd+shift+e"
111111
}
112112
],
113113
"menus": {
114114
"commandPalette": [
115115
{
116-
"command": "fastapi-vscode.copyEndpointPath",
116+
"command": "fastapi-vscode.copyPathOperationPath",
117117
"when": "false"
118118
},
119119
{
@@ -147,25 +147,25 @@
147147
],
148148
"view/title": [
149149
{
150-
"command": "fastapi-vscode.refreshEndpoints",
151-
"when": "view == endpoint-explorer",
150+
"command": "fastapi-vscode.refreshPathOperations",
151+
"when": "view == path-operation-explorer",
152152
"group": "navigation@1"
153153
},
154154
{
155155
"command": "fastapi-vscode.toggleRouters",
156-
"when": "view == endpoint-explorer",
156+
"when": "view == path-operation-explorer",
157157
"group": "navigation@2"
158158
}
159159
],
160160
"view/item/context": [
161161
{
162-
"command": "fastapi-vscode.copyEndpointPath",
163-
"when": "view == endpoint-explorer && viewItem == route",
162+
"command": "fastapi-vscode.copyPathOperationPath",
163+
"when": "view == path-operation-explorer && viewItem == route",
164164
"group": "navigation"
165165
},
166166
{
167167
"command": "fastapi-vscode.goToRouter",
168-
"when": "view == endpoint-explorer && viewItem == router",
168+
"when": "view == path-operation-explorer && viewItem == router",
169169
"group": "navigation"
170170
}
171171
]
@@ -189,8 +189,8 @@
189189
"views": {
190190
"fastapi": [
191191
{
192-
"id": "endpoint-explorer",
193-
"name": "Endpoint Explorer",
192+
"id": "path-operation-explorer",
193+
"name": "Path Operation Explorer",
194194
"icon": "media/icons/logo-outline.svg"
195195
}
196196
],
@@ -205,7 +205,7 @@
205205
},
206206
"viewsWelcome": [
207207
{
208-
"view": "endpoint-explorer",
208+
"view": "path-operation-explorer",
209209
"contents": "No FastAPI apps found in this workspace.\n\n[Configure Entry Point](command:workbench.action.openSettings?[\"fastapi.entryPoint\"])\n\n[Open Getting Started](command:workbench.action.openWalkthrough?{\"category\":\"FastAPILabs.fastapi-vscode#fastapi-getting-started\"})"
210210
}
211211
],
@@ -217,27 +217,27 @@
217217
"icon": "media/icons/logo-teal.svg",
218218
"steps": [
219219
{
220-
"id": "view-endpoints",
221-
"title": "View Your API Endpoints",
222-
"description": "Open the Endpoint Explorer in the Activity Bar (⚡) to see all routes in your FastAPI application.\n[Open Endpoint Explorer](command:endpoint-explorer.focus)",
220+
"id": "view-path-operations",
221+
"title": "View Your Path Operations",
222+
"description": "Open the Path Operation Explorer in the Activity Bar (⚡) to see all routes in your FastAPI application.\n[Open Path Operation Explorer](command:path-operation-explorer.focus)",
223223
"media": {
224-
"image": "media/walkthrough/endpoints.gif",
225-
"altText": "Endpoint Explorer showing FastAPI routes organized by router"
224+
"image": "media/walkthrough/path-operations.gif",
225+
"altText": "Path Operation Explorer showing FastAPI routes organized by router"
226226
},
227227
"completionEvents": [
228-
"onView:endpoint-explorer"
228+
"onView:path-operation-explorer"
229229
]
230230
},
231231
{
232-
"id": "search-endpoints",
233-
"title": "Quickly Find Endpoints",
234-
"description": "Instantly filter and navigate to any endpoint in your application.\n[Search Endpoints](command:fastapi-vscode.searchEndpoints)",
232+
"id": "search-path-operations",
233+
"title": "Quickly Find Path Operations",
234+
"description": "Instantly filter and navigate to any path operation in your application.\n[Search Path Operations](command:fastapi-vscode.searchPathOperations)",
235235
"media": {
236236
"image": "media/walkthrough/search.gif",
237-
"altText": "Search endpoints quick pick showing filtered results"
237+
"altText": "Search path operations quick pick showing filtered results"
238238
},
239239
"completionEvents": [
240-
"onCommand:fastapi-vscode.searchEndpoints"
240+
"onCommand:fastapi-vscode.searchPathOperations"
241241
]
242242
},
243243
{

src/core/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Public API for FastAPI endpoint discovery.
2+
* Public API for FastAPI path operation discovery.
33
* This module can be used independently of VSCode.
44
*/
55

src/core/pathUtils.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,25 @@ export function countSegments(path: string): number {
8989
}
9090

9191
/**
92-
* Checks if a test path matches an endpoint path pattern.
92+
* Checks if a test path matches a path operation path pattern.
9393
* Both paths may contain dynamic segments like {item_id} or {settings.API_V1_STR}
9494
* which match any segment.
9595
*
9696
* Leading dynamic prefixes (like {settings.API_V1_STR}) and query strings are stripped
9797
* before comparison.
9898
*
9999
* Examples:
100-
* pathMatchesEndpoint("/items/123", "/items/{item_id}") -> true
101-
* pathMatchesEndpoint("/items/123/details", "/items/{item_id}") -> false
102-
* pathMatchesEndpoint("/users/abc/posts/456", "/users/{user_id}/posts/{post_id}") -> true
103-
* pathMatchesEndpoint("/items/", "/items/{item_id}") -> false
104-
* pathMatchesEndpoint("{settings.API}/apps/{id}", "/apps/{app_id}") -> true
105-
* pathMatchesEndpoint("{BASE}/users/{id}", "/users/{user_id}") -> true
106-
* pathMatchesEndpoint("/teams/?owner=true", "/teams") -> true (query string stripped)
100+
* pathMatchesPathOperation("/items/123", "/items/{item_id}") -> true
101+
* pathMatchesPathOperation("/items/123/details", "/items/{item_id}") -> false
102+
* pathMatchesPathOperation("/users/abc/posts/456", "/users/{user_id}/posts/{post_id}") -> true
103+
* pathMatchesPathOperation("/items/", "/items/{item_id}") -> false
104+
* pathMatchesPathOperation("{settings.API}/apps/{id}", "/apps/{app_id}") -> true
105+
* pathMatchesPathOperation("{BASE}/users/{id}", "/users/{user_id}") -> true
106+
* pathMatchesPathOperation("/teams/?owner=true", "/teams") -> true (query string stripped)
107107
*/
108-
export function pathMatchesEndpoint(
108+
export function pathMatchesPathOperation(
109109
testPath: string,
110-
endpointPath: string,
110+
pathOperationPath: string,
111111
): boolean {
112112
// Strip query string from test path (e.g., "/teams/?owner=true" -> "/teams/")
113113
const testPathWithoutQuery = testPath.split("?")[0]
@@ -116,26 +116,26 @@ export function pathMatchesEndpoint(
116116
const testSegments = stripLeadingDynamicSegments(testPathWithoutQuery)
117117
.split("/")
118118
.filter(Boolean)
119-
const endpointSegments = stripLeadingDynamicSegments(endpointPath)
119+
const pathOperationSegments = stripLeadingDynamicSegments(pathOperationPath)
120120
.split("/")
121121
.filter(Boolean)
122122

123123
// Segment counts must match
124-
if (testSegments.length !== endpointSegments.length) {
124+
if (testSegments.length !== pathOperationSegments.length) {
125125
return false
126126
}
127127

128128
// Compare each segment positionally
129129
return testSegments.every((testSeg, i) => {
130-
const endpointSeg = endpointSegments[i]
130+
const pathOperationSeg = pathOperationSegments[i]
131131
// Dynamic segments (e.g., {id}, {app.id}) match any value
132132
const testIsDynamic = testSeg.startsWith("{") && testSeg.endsWith("}")
133-
const endpointIsDynamic =
134-
endpointSeg.startsWith("{") && endpointSeg.endsWith("}")
135-
if (testIsDynamic || endpointIsDynamic) {
133+
const pathOperationIsDynamic =
134+
pathOperationSeg.startsWith("{") && pathOperationSeg.endsWith("}")
135+
if (testIsDynamic || pathOperationIsDynamic) {
136136
return true
137137
}
138-
return testSeg === endpointSeg
138+
return testSeg === pathOperationSeg
139139
})
140140
}
141141

src/core/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Public API types for FastAPI endpoint discovery.
2+
* Public API types for FastAPI path operation discovery.
33
*/
44

55
export type HTTPMethod =

0 commit comments

Comments
 (0)