Skip to content

Commit 60af9c0

Browse files
Rename object to owner
1 parent 3827e3f commit 60af9c0

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

src/core/extractors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export function decoratorExtractor(node: Node): RouteInfo | null {
159159
const functionName = functionNameDefNode ? functionNameDefNode.text : ""
160160

161161
return {
162-
object: objectNode.text,
162+
owner: objectNode.text,
163163
method: resolvedMethod,
164164
path,
165165
function: functionName,
@@ -360,7 +360,7 @@ export function includeRouterExtractor(node: Node): IncludeRouterInfo | null {
360360
}
361361

362362
return {
363-
object: call.object,
363+
owner: call.object,
364364
router: call.args[0]?.text ?? "",
365365
prefix,
366366
tags,
@@ -375,7 +375,7 @@ export function mountExtractor(node: Node): MountInfo | null {
375375
}
376376

377377
return {
378-
object: call.object,
378+
owner: call.object,
379379
path: extractPathFromNode(call.args[0]),
380380
app: call.args[1].text,
381381
}

src/core/internal.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export function normalizeMethod(method: string): RouteMethod {
2828
}
2929

3030
export interface RouteInfo {
31-
object: string
31+
// The router or app that owns this route
32+
owner: string
3233
method: string
3334
path: string
3435
function: string
@@ -61,14 +62,16 @@ export interface ImportInfo {
6162
}
6263

6364
export interface IncludeRouterInfo {
64-
object: string
65+
// The app or router with the include_router call
66+
owner: string
6567
router: string
6668
prefix: string
6769
tags: string[]
6870
}
6971

7072
export interface MountInfo {
71-
object: string
73+
// The app that owns this sub application mount
74+
owner: string
7275
path: string
7376
app: string
7477
}

src/test/core/extractors.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def list_users():
4545

4646
const result = decoratorExtractor(decoratedDefs[0])
4747
assert.ok(result)
48-
assert.strictEqual(result.object, "router")
48+
assert.strictEqual(result.owner, "router")
4949
assert.strictEqual(result.method, "get")
5050
assert.strictEqual(result.path, "/users")
5151
assert.strictEqual(result.function, "list_users")
@@ -82,7 +82,7 @@ def create_item():
8282
const result = decoratorExtractor(decoratedDefs[0])
8383

8484
assert.ok(result)
85-
assert.strictEqual(result.object, "app")
85+
assert.strictEqual(result.owner, "app")
8686
assert.strictEqual(result.method, "post")
8787
assert.strictEqual(result.path, "/items")
8888
})
@@ -385,7 +385,7 @@ def handler():
385385
const result = includeRouterExtractor(calls[0])
386386

387387
assert.ok(result)
388-
assert.strictEqual(result.object, "app")
388+
assert.strictEqual(result.owner, "app")
389389
assert.strictEqual(result.router, "users.router")
390390
assert.strictEqual(result.prefix, "")
391391
})
@@ -447,7 +447,7 @@ def handler():
447447
const result = mountExtractor(calls[0])
448448

449449
assert.ok(result)
450-
assert.strictEqual(result.object, "app")
450+
assert.strictEqual(result.owner, "app")
451451
assert.strictEqual(result.path, "/static")
452452
assert.strictEqual(result.app, "static_app")
453453
})

0 commit comments

Comments
 (0)