@travetto/web 8.0.0-alpha.7 → 8.0.0-alpha.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/web",
3
- "version": "8.0.0-alpha.7",
3
+ "version": "8.0.0-alpha.9",
4
4
  "type": "module",
5
5
  "description": "Declarative support for creating Web Applications",
6
6
  "keywords": [
@@ -26,17 +26,17 @@
26
26
  "directory": "module/web"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^8.0.0-alpha.7",
30
- "@travetto/context": "^8.0.0-alpha.7",
31
- "@travetto/di": "^8.0.0-alpha.7",
32
- "@travetto/registry": "^8.0.0-alpha.7",
33
- "@travetto/runtime": "^8.0.0-alpha.7",
34
- "@travetto/schema": "^8.0.0-alpha.7",
29
+ "@travetto/config": "^8.0.0-alpha.8",
30
+ "@travetto/context": "^8.0.0-alpha.8",
31
+ "@travetto/di": "^8.0.0-alpha.8",
32
+ "@travetto/registry": "^8.0.0-alpha.8",
33
+ "@travetto/runtime": "^8.0.0-alpha.8",
34
+ "@travetto/schema": "^8.0.0-alpha.8",
35
35
  "find-my-way": "^9.5.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@travetto/cli": "^8.0.0-alpha.12",
39
- "@travetto/test": "^8.0.0-alpha.7",
38
+ "@travetto/cli": "^8.0.0-alpha.13",
39
+ "@travetto/test": "^8.0.0-alpha.8",
40
40
  "@travetto/transformer": "^8.0.0-alpha.4"
41
41
  },
42
42
  "peerDependenciesMeta": {
@@ -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';
@@ -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
  }