@typespec/http 1.8.0-dev.0 → 1.8.0-dev.1
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/dist/generated-defs/TypeSpec.Http.Private.d.ts +8 -8
- package/dist/generated-defs/TypeSpec.Http.Private.d.ts.map +1 -1
- package/dist/generated-defs/TypeSpec.Http.d.ts +20 -20
- package/dist/generated-defs/TypeSpec.Http.d.ts.map +1 -1
- package/dist/src/private.decorators.d.ts.map +1 -1
- package/dist/src/private.decorators.js +59 -0
- package/dist/src/private.decorators.js.map +1 -1
- package/dist/src/validate.d.ts.map +1 -1
- package/dist/src/validate.js +1 -63
- package/dist/src/validate.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import type { DecoratorContext, Model, ModelProperty, Type } from "@typespec/compiler";
|
|
1
|
+
import type { DecoratorContext, DecoratorValidatorCallbacks, Model, ModelProperty, Type } from "@typespec/compiler";
|
|
2
2
|
export interface HttpPartOptions {
|
|
3
3
|
readonly name?: string;
|
|
4
4
|
}
|
|
5
5
|
export interface ApplyMergePatchOptions {
|
|
6
6
|
readonly visibilityMode: unknown;
|
|
7
7
|
}
|
|
8
|
-
export type PlainDataDecorator = (context: DecoratorContext, target: Model) => void;
|
|
9
|
-
export type HttpFileDecorator = (context: DecoratorContext, target: Model) => void;
|
|
10
|
-
export type HttpPartDecorator = (context: DecoratorContext, target: Model, type: Type, options: HttpPartOptions) => void;
|
|
8
|
+
export type PlainDataDecorator = (context: DecoratorContext, target: Model) => DecoratorValidatorCallbacks | void;
|
|
9
|
+
export type HttpFileDecorator = (context: DecoratorContext, target: Model) => DecoratorValidatorCallbacks | void;
|
|
10
|
+
export type HttpPartDecorator = (context: DecoratorContext, target: Model, type: Type, options: HttpPartOptions) => DecoratorValidatorCallbacks | void;
|
|
11
11
|
/**
|
|
12
12
|
* Performs the canonical merge-patch transformation on the given model and injects its
|
|
13
13
|
* transformed properties into the target.
|
|
14
14
|
*/
|
|
15
|
-
export type ApplyMergePatchDecorator = (context: DecoratorContext, target: Model, source: Model, nameTemplate: string, options: ApplyMergePatchOptions) => void;
|
|
15
|
+
export type ApplyMergePatchDecorator = (context: DecoratorContext, target: Model, source: Model, nameTemplate: string, options: ApplyMergePatchOptions) => DecoratorValidatorCallbacks | void;
|
|
16
16
|
/**
|
|
17
17
|
* Specify if inapplicable metadata should be included in the payload for the given entity.
|
|
18
18
|
*
|
|
19
19
|
* @param value If true, inapplicable metadata will be included in the payload.
|
|
20
20
|
*/
|
|
21
|
-
export type IncludeInapplicableMetadataInPayloadDecorator = (context: DecoratorContext, target: Type, value: boolean) => void;
|
|
21
|
+
export type IncludeInapplicableMetadataInPayloadDecorator = (context: DecoratorContext, target: Type, value: boolean) => DecoratorValidatorCallbacks | void;
|
|
22
22
|
/**
|
|
23
23
|
* Marks a model that was generated by applying the MergePatch
|
|
24
24
|
* transform and links to its source model
|
|
25
25
|
*/
|
|
26
|
-
export type MergePatchModelDecorator = (context: DecoratorContext, target: Model, source: Model) => void;
|
|
26
|
+
export type MergePatchModelDecorator = (context: DecoratorContext, target: Model, source: Model) => DecoratorValidatorCallbacks | void;
|
|
27
27
|
/**
|
|
28
28
|
* Links a modelProperty mutated as part of a mergePatch transform to
|
|
29
29
|
* its source property;
|
|
30
30
|
*/
|
|
31
|
-
export type MergePatchPropertyDecorator = (context: DecoratorContext, target: ModelProperty, source: ModelProperty) => void;
|
|
31
|
+
export type MergePatchPropertyDecorator = (context: DecoratorContext, target: ModelProperty, source: ModelProperty) => DecoratorValidatorCallbacks | void;
|
|
32
32
|
export type TypeSpecHttpPrivateDecorators = {
|
|
33
33
|
plainData: PlainDataDecorator;
|
|
34
34
|
httpFile: HttpFileDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSpec.Http.Private.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Http.Private.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"TypeSpec.Http.Private.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Http.Private.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC3B,KAAK,EACL,aAAa,EACb,IAAI,EACL,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,KACV,2BAA2B,GAAG,IAAI,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,KACV,2BAA2B,GAAG,IAAI,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,eAAe,KACrB,2BAA2B,GAAG,IAAI,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACrC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,KAAK,EACb,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,sBAAsB,KAC5B,2BAA2B,GAAG,IAAI,CAAC;AAExC;;;;GAIG;AACH,MAAM,MAAM,6CAA6C,GAAG,CAC1D,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,OAAO,KACX,2BAA2B,GAAG,IAAI,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACrC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,KAAK,KACV,2BAA2B,GAAG,IAAI,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG,CACxC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,KAClB,2BAA2B,GAAG,IAAI,CAAC;AAExC,MAAM,MAAM,6BAA6B,GAAG;IAC1C,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,eAAe,EAAE,wBAAwB,CAAC;IAC1C,oCAAoC,EAAE,6CAA6C,CAAC;IACpF,eAAe,EAAE,wBAAwB,CAAC;IAC1C,kBAAkB,EAAE,2BAA2B,CAAC;CACjD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DecoratorContext, Interface, ModelProperty, Namespace, Operation, Type } from "@typespec/compiler";
|
|
1
|
+
import type { DecoratorContext, DecoratorValidatorCallbacks, Interface, ModelProperty, Namespace, Operation, Type } from "@typespec/compiler";
|
|
2
2
|
export interface HeaderOptions {
|
|
3
3
|
readonly name?: string;
|
|
4
4
|
readonly explode?: boolean;
|
|
@@ -33,7 +33,7 @@ export interface PatchOptions {
|
|
|
33
33
|
* };
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
export type StatusCodeDecorator = (context: DecoratorContext, target: ModelProperty) => void;
|
|
36
|
+
export type StatusCodeDecorator = (context: DecoratorContext, target: ModelProperty) => DecoratorValidatorCallbacks | void;
|
|
37
37
|
/**
|
|
38
38
|
* Explicitly specify that this property type will be exactly the HTTP body.
|
|
39
39
|
*
|
|
@@ -46,7 +46,7 @@ export type StatusCodeDecorator = (context: DecoratorContext, target: ModelPrope
|
|
|
46
46
|
* op download(): {@body image: bytes};
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
export type BodyDecorator = (context: DecoratorContext, target: ModelProperty) => void;
|
|
49
|
+
export type BodyDecorator = (context: DecoratorContext, target: ModelProperty) => DecoratorValidatorCallbacks | void;
|
|
50
50
|
/**
|
|
51
51
|
* Specify this property is to be sent or received as an HTTP header.
|
|
52
52
|
*
|
|
@@ -64,7 +64,7 @@ export type BodyDecorator = (context: DecoratorContext, target: ModelProperty) =
|
|
|
64
64
|
* op update(@header ifMatch: string): void; // headerName: if-match
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
|
-
export type HeaderDecorator = (context: DecoratorContext, target: ModelProperty, headerNameOrOptions?: string | HeaderOptions) => void;
|
|
67
|
+
export type HeaderDecorator = (context: DecoratorContext, target: ModelProperty, headerNameOrOptions?: string | HeaderOptions) => DecoratorValidatorCallbacks | void;
|
|
68
68
|
/**
|
|
69
69
|
* Specify this property is to be sent or received in the cookie.
|
|
70
70
|
*
|
|
@@ -82,7 +82,7 @@ export type HeaderDecorator = (context: DecoratorContext, target: ModelProperty,
|
|
|
82
82
|
* op update(@cookie AuthToken: string): void; // headerName: auth_token
|
|
83
83
|
* ```
|
|
84
84
|
*/
|
|
85
|
-
export type CookieDecorator = (context: DecoratorContext, target: ModelProperty, cookieNameOrOptions?: string | CookieOptions) => void;
|
|
85
|
+
export type CookieDecorator = (context: DecoratorContext, target: ModelProperty, cookieNameOrOptions?: string | CookieOptions) => DecoratorValidatorCallbacks | void;
|
|
86
86
|
/**
|
|
87
87
|
* Specify this property is to be sent as a query parameter.
|
|
88
88
|
*
|
|
@@ -93,7 +93,7 @@ export type CookieDecorator = (context: DecoratorContext, target: ModelProperty,
|
|
|
93
93
|
* op list(@query(#{name: "id", explode: true}) ids: string[]): void;
|
|
94
94
|
* ```
|
|
95
95
|
*/
|
|
96
|
-
export type QueryDecorator = (context: DecoratorContext, target: ModelProperty, queryNameOrOptions?: string | QueryOptions) => void;
|
|
96
|
+
export type QueryDecorator = (context: DecoratorContext, target: ModelProperty, queryNameOrOptions?: string | QueryOptions) => DecoratorValidatorCallbacks | void;
|
|
97
97
|
/**
|
|
98
98
|
* Explicitly specify that this property is to be interpolated as a path parameter.
|
|
99
99
|
*
|
|
@@ -104,7 +104,7 @@ export type QueryDecorator = (context: DecoratorContext, target: ModelProperty,
|
|
|
104
104
|
* op read(@path explicit: string, implicit: string): void;
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
107
|
-
export type PathDecorator = (context: DecoratorContext, target: ModelProperty, paramNameOrOptions?: string | PathOptions) => void;
|
|
107
|
+
export type PathDecorator = (context: DecoratorContext, target: ModelProperty, paramNameOrOptions?: string | PathOptions) => DecoratorValidatorCallbacks | void;
|
|
108
108
|
/**
|
|
109
109
|
* Specify that the body resolution should be resolved from that property.
|
|
110
110
|
* By default the body is resolved by including all properties in the operation request/response that are not metadata.
|
|
@@ -116,7 +116,7 @@ export type PathDecorator = (context: DecoratorContext, target: ModelProperty, p
|
|
|
116
116
|
* op download(): {@bodyRoot user: {name: string, @header id: string}};
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
|
-
export type BodyRootDecorator = (context: DecoratorContext, target: ModelProperty) => void;
|
|
119
|
+
export type BodyRootDecorator = (context: DecoratorContext, target: ModelProperty) => DecoratorValidatorCallbacks | void;
|
|
120
120
|
/**
|
|
121
121
|
* Specify that this property shouldn't be included in the HTTP body.
|
|
122
122
|
* This can be useful when bundling metadata together that would result in an empty property to be included in the body.
|
|
@@ -126,7 +126,7 @@ export type BodyRootDecorator = (context: DecoratorContext, target: ModelPropert
|
|
|
126
126
|
* op upload(name: string, @bodyIgnore headers: {@header id: string}): void;
|
|
127
127
|
* ```
|
|
128
128
|
*/
|
|
129
|
-
export type BodyIgnoreDecorator = (context: DecoratorContext, target: ModelProperty) => void;
|
|
129
|
+
export type BodyIgnoreDecorator = (context: DecoratorContext, target: ModelProperty) => DecoratorValidatorCallbacks | void;
|
|
130
130
|
/**
|
|
131
131
|
*
|
|
132
132
|
*
|
|
@@ -142,7 +142,7 @@ export type BodyIgnoreDecorator = (context: DecoratorContext, target: ModelPrope
|
|
|
142
142
|
* ): void;
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
|
-
export type MultipartBodyDecorator = (context: DecoratorContext, target: ModelProperty) => void;
|
|
145
|
+
export type MultipartBodyDecorator = (context: DecoratorContext, target: ModelProperty) => DecoratorValidatorCallbacks | void;
|
|
146
146
|
/**
|
|
147
147
|
* Specify the HTTP verb for the target operation to be `GET`.
|
|
148
148
|
*
|
|
@@ -151,7 +151,7 @@ export type MultipartBodyDecorator = (context: DecoratorContext, target: ModelPr
|
|
|
151
151
|
* @get op read(): string
|
|
152
152
|
* ```
|
|
153
153
|
*/
|
|
154
|
-
export type GetDecorator = (context: DecoratorContext, target: Operation) => void;
|
|
154
|
+
export type GetDecorator = (context: DecoratorContext, target: Operation) => DecoratorValidatorCallbacks | void;
|
|
155
155
|
/**
|
|
156
156
|
* Specify the HTTP verb for the target operation to be `PUT`.
|
|
157
157
|
*
|
|
@@ -160,7 +160,7 @@ export type GetDecorator = (context: DecoratorContext, target: Operation) => voi
|
|
|
160
160
|
* @put op set(pet: Pet): void
|
|
161
161
|
* ```
|
|
162
162
|
*/
|
|
163
|
-
export type PutDecorator = (context: DecoratorContext, target: Operation) => void;
|
|
163
|
+
export type PutDecorator = (context: DecoratorContext, target: Operation) => DecoratorValidatorCallbacks | void;
|
|
164
164
|
/**
|
|
165
165
|
* Specify the HTTP verb for the target operation to be `POST`.
|
|
166
166
|
*
|
|
@@ -169,7 +169,7 @@ export type PutDecorator = (context: DecoratorContext, target: Operation) => voi
|
|
|
169
169
|
* @post op create(pet: Pet): void
|
|
170
170
|
* ```
|
|
171
171
|
*/
|
|
172
|
-
export type PostDecorator = (context: DecoratorContext, target: Operation) => void;
|
|
172
|
+
export type PostDecorator = (context: DecoratorContext, target: Operation) => DecoratorValidatorCallbacks | void;
|
|
173
173
|
/**
|
|
174
174
|
* Specify the HTTP verb for the target operation to be `PATCH`.
|
|
175
175
|
*
|
|
@@ -186,7 +186,7 @@ export type PostDecorator = (context: DecoratorContext, target: Operation) => vo
|
|
|
186
186
|
* op update(pet: Pet): void;
|
|
187
187
|
* ```
|
|
188
188
|
*/
|
|
189
|
-
export type PatchDecorator = (context: DecoratorContext, target: Operation, options?: PatchOptions) => void;
|
|
189
|
+
export type PatchDecorator = (context: DecoratorContext, target: Operation, options?: PatchOptions) => DecoratorValidatorCallbacks | void;
|
|
190
190
|
/**
|
|
191
191
|
* Specify the HTTP verb for the target operation to be `DELETE`.
|
|
192
192
|
*
|
|
@@ -195,7 +195,7 @@ export type PatchDecorator = (context: DecoratorContext, target: Operation, opti
|
|
|
195
195
|
* @delete op set(petId: string): void
|
|
196
196
|
* ```
|
|
197
197
|
*/
|
|
198
|
-
export type DeleteDecorator = (context: DecoratorContext, target: Operation) => void;
|
|
198
|
+
export type DeleteDecorator = (context: DecoratorContext, target: Operation) => DecoratorValidatorCallbacks | void;
|
|
199
199
|
/**
|
|
200
200
|
* Specify the HTTP verb for the target operation to be `HEAD`.
|
|
201
201
|
*
|
|
@@ -204,7 +204,7 @@ export type DeleteDecorator = (context: DecoratorContext, target: Operation) =>
|
|
|
204
204
|
* @head op ping(petId: string): void
|
|
205
205
|
* ```
|
|
206
206
|
*/
|
|
207
|
-
export type HeadDecorator = (context: DecoratorContext, target: Operation) => void;
|
|
207
|
+
export type HeadDecorator = (context: DecoratorContext, target: Operation) => DecoratorValidatorCallbacks | void;
|
|
208
208
|
/**
|
|
209
209
|
* Specify an endpoint for this service. Multiple `@server` decorators can be used to specify multiple endpoints.
|
|
210
210
|
*
|
|
@@ -242,7 +242,7 @@ export type HeadDecorator = (context: DecoratorContext, target: Operation) => vo
|
|
|
242
242
|
* namespace PetStore;
|
|
243
243
|
* ```
|
|
244
244
|
*/
|
|
245
|
-
export type ServerDecorator = (context: DecoratorContext, target: Namespace, url: string, description?: string, parameters?: Type) => void;
|
|
245
|
+
export type ServerDecorator = (context: DecoratorContext, target: Namespace, url: string, description?: string, parameters?: Type) => DecoratorValidatorCallbacks | void;
|
|
246
246
|
/**
|
|
247
247
|
* Specify authentication for a whole service or specific methods. See the [documentation in the Http library](https://typespec.io/docs/libraries/http/authentication) for full details.
|
|
248
248
|
*
|
|
@@ -254,7 +254,7 @@ export type ServerDecorator = (context: DecoratorContext, target: Namespace, url
|
|
|
254
254
|
* namespace PetStore;
|
|
255
255
|
* ```
|
|
256
256
|
*/
|
|
257
|
-
export type UseAuthDecorator = (context: DecoratorContext, target: Namespace | Interface | Operation, auth: Type) => void;
|
|
257
|
+
export type UseAuthDecorator = (context: DecoratorContext, target: Namespace | Interface | Operation, auth: Type) => DecoratorValidatorCallbacks | void;
|
|
258
258
|
/**
|
|
259
259
|
* Defines the relative route URI template for the target operation as defined by [RFC 6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3)
|
|
260
260
|
*
|
|
@@ -276,7 +276,7 @@ export type UseAuthDecorator = (context: DecoratorContext, target: Namespace | I
|
|
|
276
276
|
* @route("/files{?select,filter}") op listFullUriTemplate(select?: string, filter?: string): Files[];
|
|
277
277
|
* ```
|
|
278
278
|
*/
|
|
279
|
-
export type RouteDecorator = (context: DecoratorContext, target: Namespace | Interface | Operation, path: string) => void;
|
|
279
|
+
export type RouteDecorator = (context: DecoratorContext, target: Namespace | Interface | Operation, path: string) => DecoratorValidatorCallbacks | void;
|
|
280
280
|
/**
|
|
281
281
|
* `@sharedRoute` marks the operation as sharing a route path with other operations.
|
|
282
282
|
*
|
|
@@ -291,7 +291,7 @@ export type RouteDecorator = (context: DecoratorContext, target: Namespace | Int
|
|
|
291
291
|
* op getWidget(@path id: string): Widget;
|
|
292
292
|
* ```
|
|
293
293
|
*/
|
|
294
|
-
export type SharedRouteDecorator = (context: DecoratorContext, target: Operation) => void;
|
|
294
|
+
export type SharedRouteDecorator = (context: DecoratorContext, target: Operation) => DecoratorValidatorCallbacks | void;
|
|
295
295
|
export type TypeSpecHttpDecorators = {
|
|
296
296
|
statusCode: StatusCodeDecorator;
|
|
297
297
|
body: BodyDecorator;
|
|
@@ -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,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IACrE,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACxC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"TypeSpec.Http.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC3B,SAAS,EACT,aAAa,EACb,SAAS,EACT,SAAS,EACT,IAAI,EACL,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,CA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,GAAG;IACnC,UAAU,EAAE,mBAAmB,CAAC;IAChC,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,UAAU,EAAE,mBAAmB,CAAC;IAChC,aAAa,EAAE,sBAAsB,CAAC;IACtC,GAAG,EAAE,YAAY,CAAC;IAClB,GAAG,EAAE,YAAY,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,KAAK,EAAE,cAAc,CAAC;IACtB,WAAW,EAAE,oBAAoB,CAAC;CACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private.decorators.d.ts","sourceRoot":"","sources":["../../src/private.decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,KAAK,EACL,aAAa,EAGb,OAAO,EACP,IAAI,EAKL,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EACnB,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"private.decorators.d.ts","sourceRoot":"","sources":["../../src/private.decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,KAAK,EACL,aAAa,EAGb,OAAO,EACP,IAAI,EAKL,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EACnB,MAAM,4CAA4C,CAAC;AAYpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAA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walkPropertiesInherited, } from "@typespec/compiler";
|
|
2
2
|
import { SyntaxKind } from "@typespec/compiler/ast";
|
|
3
|
+
import { getCookieParamOptions, getHeaderFieldOptions, getPathOptions, getQueryOptions, isBody, isBodyRoot, isMultipartBodyProperty, isStatusCode, } from "./decorators.js";
|
|
3
4
|
import { HttpStateKeys, reportDiagnostic } from "./lib.js";
|
|
4
5
|
export const $plainData = (context, entity) => {
|
|
5
6
|
const { program } = context;
|
|
@@ -93,7 +94,65 @@ export const $httpFile = (context, target) => {
|
|
|
93
94
|
}
|
|
94
95
|
return undefined;
|
|
95
96
|
}
|
|
97
|
+
return {
|
|
98
|
+
onGraphFinish: () => {
|
|
99
|
+
validateHttpFileModel(context.program, target);
|
|
100
|
+
return [];
|
|
101
|
+
},
|
|
102
|
+
};
|
|
96
103
|
};
|
|
104
|
+
function validateHttpFileModel(program, model) {
|
|
105
|
+
for (const prop of model.properties.values()) {
|
|
106
|
+
switch (prop.name) {
|
|
107
|
+
case "contentType":
|
|
108
|
+
case "contents": {
|
|
109
|
+
// Check if these properties have any HTTP metadata and if so, report an error
|
|
110
|
+
const annotations = {
|
|
111
|
+
header: getHeaderFieldOptions(program, prop),
|
|
112
|
+
cookie: getCookieParamOptions(program, prop),
|
|
113
|
+
query: getQueryOptions(program, prop),
|
|
114
|
+
path: getPathOptions(program, prop),
|
|
115
|
+
body: isBody(program, prop),
|
|
116
|
+
bodyRoot: isBodyRoot(program, prop),
|
|
117
|
+
multipartBody: isMultipartBodyProperty(program, prop),
|
|
118
|
+
statusCode: isStatusCode(program, prop),
|
|
119
|
+
};
|
|
120
|
+
reportDisallowed(prop, annotations);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
case "filename": {
|
|
124
|
+
const annotations = {
|
|
125
|
+
body: isBody(program, prop),
|
|
126
|
+
bodyRoot: isBodyRoot(program, prop),
|
|
127
|
+
multipartBody: isMultipartBodyProperty(program, prop),
|
|
128
|
+
statusCode: isStatusCode(program, prop),
|
|
129
|
+
cookie: getCookieParamOptions(program, prop),
|
|
130
|
+
};
|
|
131
|
+
reportDisallowed(prop, annotations);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
default:
|
|
135
|
+
reportDiagnostic(program, {
|
|
136
|
+
code: "http-file-extra-property",
|
|
137
|
+
format: { propName: prop.name },
|
|
138
|
+
target: prop,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
for (const child of model.derivedModels) {
|
|
143
|
+
validateHttpFileModel(program, child);
|
|
144
|
+
}
|
|
145
|
+
function reportDisallowed(target, annotations) {
|
|
146
|
+
const metadataEntries = Object.entries(annotations).filter((e) => !!e[1]);
|
|
147
|
+
for (const [metadataType] of metadataEntries) {
|
|
148
|
+
reportDiagnostic(program, {
|
|
149
|
+
code: "http-file-disallowed-metadata",
|
|
150
|
+
format: { propName: target.name, metadataType },
|
|
151
|
+
target: target,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
97
156
|
/**
|
|
98
157
|
* Check if the given type is an `HttpFile`
|
|
99
158
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private.decorators.js","sourceRoot":"","sources":["../../src/private.decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,QAAQ,EAIR,WAAW,EACX,WAAW,EACX,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAQ,UAAU,EAAoB,MAAM,wBAAwB,CAAC;AAO5E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,UAAU,GAAuB,CAAC,OAAyB,EAAE,MAAa,EAAE,EAAE;IACzF,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,MAAM,kBAAkB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAClF,MAAM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;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,qCAAqC,CACnD,OAAyB,EACzB,MAAY,EACZ,KAAc;IAEd,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IAC3F,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oCAAoC,CAClD,OAAgB,EAChB,QAAuB;IAEvB,IAAI,CAAgD,CAAC;IACrD,KAAK,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;QAC7E,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC1F,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAMlD,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAO3C"}
|
package/dist/src/validate.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { getCookieParamOptions, getHeaderFieldOptions, getPathOptions, getQueryOptions, isBody, isBodyRoot, isMultipartBodyProperty, isStatusCode, } from "./decorators.js";
|
|
2
1
|
import { isSharedRoute } from "./decorators/shared-route.js";
|
|
3
|
-
import {
|
|
2
|
+
import { reportDiagnostic } from "./lib.js";
|
|
4
3
|
import { getAllHttpServices } from "./operations.js";
|
|
5
4
|
export function $onValidate(program) {
|
|
6
5
|
// Pass along any diagnostics that might be returned from the HTTP library
|
|
@@ -9,67 +8,6 @@ export function $onValidate(program) {
|
|
|
9
8
|
program.reportDiagnostics(diagnostics);
|
|
10
9
|
}
|
|
11
10
|
validateSharedRouteConsistency(program, services);
|
|
12
|
-
validateHttpFiles(program);
|
|
13
|
-
}
|
|
14
|
-
function validateHttpFiles(program) {
|
|
15
|
-
const httpFiles = [...program.stateSet(HttpStateKeys.file)];
|
|
16
|
-
for (const model of httpFiles) {
|
|
17
|
-
if (model.kind === "Model") {
|
|
18
|
-
validateHttpFileModel(program, model);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function validateHttpFileModel(program, model) {
|
|
23
|
-
for (const prop of model.properties.values()) {
|
|
24
|
-
switch (prop.name) {
|
|
25
|
-
case "contentType":
|
|
26
|
-
case "contents": {
|
|
27
|
-
// Check if these properties have any HTTP metadata and if so, report an error
|
|
28
|
-
const annotations = {
|
|
29
|
-
header: getHeaderFieldOptions(program, prop),
|
|
30
|
-
cookie: getCookieParamOptions(program, prop),
|
|
31
|
-
query: getQueryOptions(program, prop),
|
|
32
|
-
path: getPathOptions(program, prop),
|
|
33
|
-
body: isBody(program, prop),
|
|
34
|
-
bodyRoot: isBodyRoot(program, prop),
|
|
35
|
-
multipartBody: isMultipartBodyProperty(program, prop),
|
|
36
|
-
statusCode: isStatusCode(program, prop),
|
|
37
|
-
};
|
|
38
|
-
reportDisallowed(prop, annotations);
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
case "filename": {
|
|
42
|
-
const annotations = {
|
|
43
|
-
body: isBody(program, prop),
|
|
44
|
-
bodyRoot: isBodyRoot(program, prop),
|
|
45
|
-
multipartBody: isMultipartBodyProperty(program, prop),
|
|
46
|
-
statusCode: isStatusCode(program, prop),
|
|
47
|
-
cookie: getCookieParamOptions(program, prop),
|
|
48
|
-
};
|
|
49
|
-
reportDisallowed(prop, annotations);
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
default:
|
|
53
|
-
reportDiagnostic(program, {
|
|
54
|
-
code: "http-file-extra-property",
|
|
55
|
-
format: { propName: prop.name },
|
|
56
|
-
target: prop,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
for (const child of model.derivedModels) {
|
|
61
|
-
validateHttpFileModel(program, child);
|
|
62
|
-
}
|
|
63
|
-
function reportDisallowed(target, annotations) {
|
|
64
|
-
const metadataEntries = Object.entries(annotations).filter((e) => !!e[1]);
|
|
65
|
-
for (const [metadataType] of metadataEntries) {
|
|
66
|
-
reportDiagnostic(program, {
|
|
67
|
-
code: "http-file-disallowed-metadata",
|
|
68
|
-
format: { propName: target.name, metadataType },
|
|
69
|
-
target: target,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
11
|
}
|
|
74
12
|
function groupHttpOperations(operations) {
|
|
75
13
|
const paths = new Map();
|
package/dist/src/validate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,0EAA0E;IAC1E,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC5D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AK,CAAC;gBACtB,IAAI,YAAY,GAAG,KAAK,CAAC;gBACzB,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;oBACrB,IAAI,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;wBACzC,SAAS,GAAG,IAAI,CAAC;oBACnB,CAAC;yBAAM,CAAC;wBACN,YAAY,GAAG,IAAI,CAAC;oBACtB,CAAC;gBACH,CAAC;gBACD,IAAI,SAAS,IAAI,YAAY,EAAE,CAAC;oBAC9B,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;wBACrB,gBAAgB,CAAC,OAAO,EAAE;4BACxB,IAAI,EAAE,sBAAsB;4BAC5B,MAAM,EAAE,EAAE,CAAC,SAAS;4BACpB,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;yBACzC,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/http",
|
|
3
|
-
"version": "1.8.0-dev.
|
|
3
|
+
"version": "1.8.0-dev.1",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec HTTP protocol binding",
|
|
6
6
|
"homepage": "https://github.com/microsoft/typespec",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"!dist/test/**"
|
|
60
60
|
],
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@typespec/compiler": "^1.7.
|
|
62
|
+
"@typespec/compiler": "^1.7.1",
|
|
63
63
|
"@typespec/streams": "^0.77.0 || >=0.78.0-dev <0.78.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependenciesMeta": {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/node": "~24.10.1",
|
|
72
|
-
"@typespec/compiler": "^1.7.
|
|
72
|
+
"@typespec/compiler": "^1.7.1",
|
|
73
73
|
"@typespec/library-linter": "^0.77.0 || >=0.78.0-dev <0.78.0",
|
|
74
74
|
"@typespec/streams": "^0.77.0 || >=0.78.0-dev <0.78.0",
|
|
75
75
|
"@typespec/tspd": "^0.73.2 || >=0.74.0-dev <0.74.0",
|