@typespec/http 0.59.0-dev.3 → 0.59.0-dev.4
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
|
@@ -455,7 +455,7 @@ op getWidget(@path id: string): Widget;
|
|
|
455
455
|
|
|
456
456
|
#### `@server`
|
|
457
457
|
|
|
458
|
-
Specify
|
|
458
|
+
Specify an endpoint for this service. Multiple `@server` decorators can be used to specify multiple endpoints.
|
|
459
459
|
|
|
460
460
|
```typespec
|
|
461
461
|
@TypeSpec.Http.server(url: valueof string, description: valueof string, parameters?: Record<unknown>)
|
|
@@ -481,7 +481,7 @@ Specify the endpoint for this service.
|
|
|
481
481
|
namespace PetStore;
|
|
482
482
|
```
|
|
483
483
|
|
|
484
|
-
######
|
|
484
|
+
###### Parameterized
|
|
485
485
|
|
|
486
486
|
```typespec
|
|
487
487
|
@server("https://{region}.foo.com", "Regional endpoint", {
|
|
@@ -490,6 +490,21 @@ namespace PetStore;
|
|
|
490
490
|
})
|
|
491
491
|
```
|
|
492
492
|
|
|
493
|
+
###### Multiple
|
|
494
|
+
|
|
495
|
+
```typespec
|
|
496
|
+
@service
|
|
497
|
+
@server("https://example.com", "Standard endpoint")
|
|
498
|
+
@server(
|
|
499
|
+
"https://{project}.private.example.com",
|
|
500
|
+
"Private project endpoint",
|
|
501
|
+
{
|
|
502
|
+
project: string,
|
|
503
|
+
}
|
|
504
|
+
)
|
|
505
|
+
namespace PetStore;
|
|
506
|
+
```
|
|
507
|
+
|
|
493
508
|
#### `@sharedRoute`
|
|
494
509
|
|
|
495
510
|
`@sharedRoute` marks the operation as sharing a route path with other operations.
|
|
@@ -160,7 +160,7 @@ export type DeleteDecorator = (context: DecoratorContext, target: Operation) =>
|
|
|
160
160
|
*/
|
|
161
161
|
export type HeadDecorator = (context: DecoratorContext, target: Operation) => void;
|
|
162
162
|
/**
|
|
163
|
-
* Specify
|
|
163
|
+
* Specify an endpoint for this service. Multiple `@server` decorators can be used to specify multiple endpoints.
|
|
164
164
|
*
|
|
165
165
|
* @param url Server endpoint
|
|
166
166
|
* @param description Description of the endpoint
|
|
@@ -171,7 +171,7 @@ export type HeadDecorator = (context: DecoratorContext, target: Operation) => vo
|
|
|
171
171
|
* @server("https://example.com", "Single server endpoint")
|
|
172
172
|
* namespace PetStore;
|
|
173
173
|
* ```
|
|
174
|
-
* @example
|
|
174
|
+
* @example Parameterized
|
|
175
175
|
*
|
|
176
176
|
* ```typespec
|
|
177
177
|
* @server("https://{region}.foo.com", "Regional endpoint", {
|
|
@@ -179,6 +179,15 @@ export type HeadDecorator = (context: DecoratorContext, target: Operation) => vo
|
|
|
179
179
|
* region?: string = "westus",
|
|
180
180
|
* })
|
|
181
181
|
* ```
|
|
182
|
+
* @example Multiple
|
|
183
|
+
* ```typespec
|
|
184
|
+
* @service
|
|
185
|
+
* @server("https://example.com", "Standard endpoint")
|
|
186
|
+
* @server("https://{project}.private.example.com", "Private project endpoint", {
|
|
187
|
+
* project: string;
|
|
188
|
+
* })
|
|
189
|
+
* namespace PetStore;
|
|
190
|
+
* ```
|
|
182
191
|
*/
|
|
183
192
|
export type ServerDecorator = (context: DecoratorContext, target: Namespace, url: string, description: string, parameters?: Type) => void;
|
|
184
193
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSpec.Http.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,SAAS,EACT,SAAS,EACT,IAAI,EACL,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;AAE7F;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,M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M,EAAE,SAAS,EACjB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,IAAI,KACd,IAAI,CAAC;AAEV;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,EACzC,IAAI,EAAE,IAAI,KACP,IAAI,CAAC;AAEV;;;;GAIG;AACH,MAAM,MAAM,6CAA6C,GAAG,CAC1D,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,OAAO,KACX,IAAI,CAAC;AAEV;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,EACzC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,IAAI,KACX,IAAI,CAAC;AAEV;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC"}
|
package/lib/decorators.tsp
CHANGED
|
@@ -220,19 +220,21 @@ extern dec delete(target: Operation);
|
|
|
220
220
|
extern dec head(target: Operation);
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
|
-
* Specify
|
|
223
|
+
* Specify an endpoint for this service. Multiple `@server` decorators can be used to specify multiple endpoints.
|
|
224
|
+
*
|
|
224
225
|
* @param url Server endpoint
|
|
225
226
|
* @param description Description of the endpoint
|
|
226
227
|
* @param parameters Optional set of parameters used to interpolate the url.
|
|
227
228
|
*
|
|
228
229
|
* @example
|
|
230
|
+
*
|
|
229
231
|
* ```typespec
|
|
230
232
|
* @service
|
|
231
233
|
* @server("https://example.com", "Single server endpoint")
|
|
232
234
|
* namespace PetStore;
|
|
233
235
|
* ```
|
|
234
236
|
*
|
|
235
|
-
* @example
|
|
237
|
+
* @example Parameterized
|
|
236
238
|
*
|
|
237
239
|
* ```typespec
|
|
238
240
|
* @server("https://{region}.foo.com", "Regional endpoint", {
|
|
@@ -241,6 +243,16 @@ extern dec head(target: Operation);
|
|
|
241
243
|
* })
|
|
242
244
|
* ```
|
|
243
245
|
*
|
|
246
|
+
* @example Multiple
|
|
247
|
+
* ```typespec
|
|
248
|
+
* @service
|
|
249
|
+
* @server("https://example.com", "Standard endpoint")
|
|
250
|
+
* @server("https://{project}.private.example.com", "Private project endpoint", {
|
|
251
|
+
* project: string;
|
|
252
|
+
* })
|
|
253
|
+
* namespace PetStore;
|
|
254
|
+
* ```
|
|
255
|
+
*
|
|
244
256
|
*/
|
|
245
257
|
extern dec server(
|
|
246
258
|
target: Namespace,
|