@travetto/web 8.0.0-alpha.2 → 8.0.0-alpha.20

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.
package/README.md CHANGED
@@ -74,6 +74,7 @@ export interface WebResponseContext {
74
74
 
75
75
  /**
76
76
  * Web Response as a simple object
77
+ * @see body Type of the response body #target
77
78
  */
78
79
  export class WebResponse<B = unknown> extends BaseWebMessage<B, WebResponseContext> {
79
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/web",
3
- "version": "8.0.0-alpha.2",
3
+ "version": "8.0.0-alpha.20",
4
4
  "type": "module",
5
5
  "description": "Declarative support for creating Web Applications",
6
6
  "keywords": [
@@ -26,18 +26,18 @@
26
26
  "directory": "module/web"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^8.0.0-alpha.2",
30
- "@travetto/context": "^8.0.0-alpha.2",
31
- "@travetto/di": "^8.0.0-alpha.2",
32
- "@travetto/registry": "^8.0.0-alpha.2",
33
- "@travetto/runtime": "^8.0.0-alpha.2",
34
- "@travetto/schema": "^8.0.0-alpha.2",
35
- "find-my-way": "^9.5.0"
29
+ "@travetto/config": "^8.0.0-alpha.19",
30
+ "@travetto/context": "^8.0.0-alpha.18",
31
+ "@travetto/di": "^8.0.0-alpha.18",
32
+ "@travetto/registry": "^8.0.0-alpha.18",
33
+ "@travetto/runtime": "^8.0.0-alpha.18",
34
+ "@travetto/schema": "^8.0.0-alpha.19",
35
+ "find-my-way": "^9.6.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@travetto/cli": "^8.0.0-alpha.3",
39
- "@travetto/test": "^8.0.0-alpha.2",
40
- "@travetto/transformer": "^8.0.0-alpha.2"
38
+ "@travetto/cli": "^8.0.0-alpha.25",
39
+ "@travetto/test": "^8.0.0-alpha.18",
40
+ "@travetto/transformer": "^8.0.0-alpha.12"
41
41
  },
42
42
  "peerDependenciesMeta": {
43
43
  "@travetto/transformer": {
@@ -58,7 +58,7 @@ function combineEndpointConfigs(controller: ControllerConfig, base: EndpointConf
58
58
  function computeParameterLocation(endpoint: EndpointConfig, param: SchemaParameterConfig): EndpointParamLocation {
59
59
  const name = param?.name;
60
60
  if (!SchemaRegistryIndex.has(param.type)) {
61
- if ((param.type === String || param.type === Number) && name && endpoint.path.includes(`:${name}`)) {
61
+ if ((param.type === String || param.type === Number) && name && endpoint.fullPath.includes(`:${name}`)) {
62
62
  return 'path';
63
63
  } else if (param.binary) {
64
64
  return 'body';
@@ -8,6 +8,7 @@ export interface WebResponseContext {
8
8
 
9
9
  /**
10
10
  * Web Response as a simple object
11
+ * @see body Type of the response body #target
11
12
  */
12
13
  export class WebResponse<B = unknown> extends BaseWebMessage<B, WebResponseContext> {
13
14
 
@@ -98,4 +98,12 @@ export class TestController {
98
98
  notFound() {
99
99
  throw new RuntimeError('Uh-oh', { category: 'general' });
100
100
  }
101
+ }
102
+
103
+ @Controller('/users/:userId')
104
+ class ParentParamController {
105
+ @Get('/')
106
+ async getUser(userId: string) {
107
+ return { userId };
108
+ }
101
109
  }
@@ -168,4 +168,10 @@ export abstract class StandardWebServerSuite extends BaseWebSuite {
168
168
  const response = await this.request<{ path: string }>({ context: { httpMethod: 'GET', path: '/test/fun/1/2/3/4' } });
169
169
  assert(response.body?.path === '1/2/3/4');
170
170
  }
171
+
172
+ @Test()
173
+ async testInheritedPathParam() {
174
+ const response = await this.request<{ userId: string }>({ context: { httpMethod: 'GET', path: '/users/1234' } });
175
+ assert(response.body?.userId === '1234');
176
+ }
171
177
  }