@typespec/http-specs 0.1.0-alpha.15-dev.2 → 0.1.0-alpha.15
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/CHANGELOG.md +7 -0
- package/README.md +3 -3
- package/dist/specs/encode/bytes/mockapi.js +6 -6
- package/dist/specs/encode/bytes/mockapi.js.map +1 -1
- package/dist/specs/payload/multipart/mockapi.js +1 -1
- package/dist/specs/payload/multipart/mockapi.js.map +1 -1
- package/package.json +11 -11
- package/spec-summary.md +23 -25
- package/specs/encode/bytes/main.tsp +26 -13
- package/specs/encode/bytes/mockapi.ts +8 -6
- package/specs/payload/multipart/main.tsp +13 -13
- package/specs/payload/multipart/mockapi.ts +1 -1
- package/specs/response/status-code-range/main.tsp +2 -2
- package/specs/type/enum/extensible/main.tsp +18 -2
- package/specs/type/enum/fixed/main.tsp +15 -3
- package/specs/type/scalar/main.tsp +58 -9
- package/specs/versioning/removed/main.tsp +2 -2
- package/specs/versioning/returnTypeChangedFrom/main.tsp +17 -2
- package/temp/.tsbuildinfo +1 -1
|
@@ -40,7 +40,13 @@ interface String {
|
|
|
40
40
|
@get
|
|
41
41
|
@route("/known-value")
|
|
42
42
|
@doc("getKnownValue")
|
|
43
|
-
getKnownValue():
|
|
43
|
+
getKnownValue(): {
|
|
44
|
+
@header
|
|
45
|
+
contentType: "application/json";
|
|
46
|
+
|
|
47
|
+
@body
|
|
48
|
+
body: DaysOfWeekEnum;
|
|
49
|
+
};
|
|
44
50
|
|
|
45
51
|
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing"
|
|
46
52
|
@scenario
|
|
@@ -48,7 +54,10 @@ interface String {
|
|
|
48
54
|
@put
|
|
49
55
|
@route("/known-value")
|
|
50
56
|
@doc("putKnownValue")
|
|
51
|
-
putKnownValue(
|
|
57
|
+
putKnownValue(
|
|
58
|
+
@header contentType: "application/json",
|
|
59
|
+
@body @doc("_") body: DaysOfWeekEnum,
|
|
60
|
+
): void;
|
|
52
61
|
|
|
53
62
|
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing"
|
|
54
63
|
@scenario
|
|
@@ -56,5 +65,8 @@ interface String {
|
|
|
56
65
|
@put
|
|
57
66
|
@route("/unknown-value")
|
|
58
67
|
@doc("putUnknownValue")
|
|
59
|
-
putUnknownValue(
|
|
68
|
+
putUnknownValue(
|
|
69
|
+
@header contentType: "application/json",
|
|
70
|
+
@body @doc("_") body: DaysOfWeekEnum,
|
|
71
|
+
): void;
|
|
60
72
|
}
|
|
@@ -14,14 +14,25 @@ interface String {
|
|
|
14
14
|
@scenarioDoc("Expect to handle a string value. Mock api will return 'test'")
|
|
15
15
|
@get
|
|
16
16
|
@doc("get string value")
|
|
17
|
-
get():
|
|
17
|
+
get(): {
|
|
18
|
+
@header
|
|
19
|
+
contentType: "application/json";
|
|
20
|
+
|
|
21
|
+
@body
|
|
22
|
+
body: string;
|
|
23
|
+
};
|
|
18
24
|
|
|
19
25
|
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing"
|
|
20
26
|
@scenario
|
|
21
27
|
@scenarioDoc("Expect to send a string value. Mock api expect to receive 'test'")
|
|
22
28
|
@put
|
|
23
29
|
@doc("put string value")
|
|
24
|
-
put(
|
|
30
|
+
put(
|
|
31
|
+
@header
|
|
32
|
+
contentType: "application/json",
|
|
33
|
+
|
|
34
|
+
@body @doc("_") body: string,
|
|
35
|
+
): void;
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
@route("/boolean")
|
|
@@ -31,14 +42,25 @@ interface Boolean {
|
|
|
31
42
|
@scenarioDoc("Expect to handle a boolean value. Mock api will return true ")
|
|
32
43
|
@get
|
|
33
44
|
@doc("get boolean value")
|
|
34
|
-
get():
|
|
45
|
+
get(): {
|
|
46
|
+
@header
|
|
47
|
+
contentType: "application/json";
|
|
48
|
+
|
|
49
|
+
@body
|
|
50
|
+
body: boolean;
|
|
51
|
+
};
|
|
35
52
|
|
|
36
53
|
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing"
|
|
37
54
|
@scenario
|
|
38
55
|
@scenarioDoc("Expect to send a boolean value. Mock api expect to receive 'true'")
|
|
39
56
|
@put
|
|
40
57
|
@doc("put boolean value")
|
|
41
|
-
put(
|
|
58
|
+
put(
|
|
59
|
+
@header
|
|
60
|
+
contentType: "application/json",
|
|
61
|
+
|
|
62
|
+
@body @doc("_") body: boolean,
|
|
63
|
+
): void;
|
|
42
64
|
}
|
|
43
65
|
|
|
44
66
|
@route("/unknown")
|
|
@@ -48,14 +70,25 @@ interface Unknown {
|
|
|
48
70
|
@scenarioDoc("Expect to handle a unknown type value. Mock api will return 'test'")
|
|
49
71
|
@get
|
|
50
72
|
@doc("get unknown value")
|
|
51
|
-
get():
|
|
73
|
+
get(): {
|
|
74
|
+
@header
|
|
75
|
+
contentType: "application/json";
|
|
76
|
+
|
|
77
|
+
@body
|
|
78
|
+
body: unknown;
|
|
79
|
+
};
|
|
52
80
|
|
|
53
81
|
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing"
|
|
54
82
|
@scenario
|
|
55
83
|
@scenarioDoc("Expect to send a string value. Mock api expect to receive 'test'")
|
|
56
84
|
@put
|
|
57
85
|
@doc("put unknown value")
|
|
58
|
-
put(
|
|
86
|
+
put(
|
|
87
|
+
@header
|
|
88
|
+
contentType: "application/json",
|
|
89
|
+
|
|
90
|
+
@body @doc("_") body: unknown,
|
|
91
|
+
): void;
|
|
59
92
|
}
|
|
60
93
|
|
|
61
94
|
@doc("Template to have scalar types operations")
|
|
@@ -69,7 +102,13 @@ interface ScalarTypesOperations<T, TDoc extends valueof string> {
|
|
|
69
102
|
""")
|
|
70
103
|
@get
|
|
71
104
|
@route("/response_body")
|
|
72
|
-
responseBody():
|
|
105
|
+
responseBody(): {
|
|
106
|
+
@header
|
|
107
|
+
contentType: "application/json";
|
|
108
|
+
|
|
109
|
+
@body
|
|
110
|
+
body: T;
|
|
111
|
+
};
|
|
73
112
|
|
|
74
113
|
@scenario
|
|
75
114
|
@scenarioDoc("""
|
|
@@ -80,7 +119,12 @@ interface ScalarTypesOperations<T, TDoc extends valueof string> {
|
|
|
80
119
|
""")
|
|
81
120
|
@put
|
|
82
121
|
@route("/resquest_body")
|
|
83
|
-
requestBody(
|
|
122
|
+
requestBody(
|
|
123
|
+
@header
|
|
124
|
+
contentType: "application/json",
|
|
125
|
+
|
|
126
|
+
@body body: T,
|
|
127
|
+
): void;
|
|
84
128
|
|
|
85
129
|
@scenario
|
|
86
130
|
@scenarioDoc("""
|
|
@@ -124,7 +168,12 @@ interface NumberTypesVerifyOperations<
|
|
|
124
168
|
""")
|
|
125
169
|
@post
|
|
126
170
|
@route("/verify")
|
|
127
|
-
verify(
|
|
171
|
+
verify(
|
|
172
|
+
@header
|
|
173
|
+
contentType: "application/json",
|
|
174
|
+
|
|
175
|
+
@body body: T,
|
|
176
|
+
): void;
|
|
128
177
|
}
|
|
129
178
|
|
|
130
179
|
@doc("Decimal type verification")
|
|
@@ -115,7 +115,7 @@ scalar V1Scalar extends int32;
|
|
|
115
115
|
/**
|
|
116
116
|
* This operation should not be generated with latest version's signature.
|
|
117
117
|
*/
|
|
118
|
-
#suppress "@
|
|
118
|
+
#suppress "@typespec/spector/missing-scenario" "by design"
|
|
119
119
|
@route("/v1")
|
|
120
120
|
@post
|
|
121
121
|
@removed(Versions.v2)
|
|
@@ -140,7 +140,7 @@ op v2(@body body: ModelV2, @removed(Versions.v2) @query param: string): ModelV2;
|
|
|
140
140
|
@route("/interface-v1")
|
|
141
141
|
@removed(Versions.v2)
|
|
142
142
|
interface InterfaceV1 {
|
|
143
|
-
#suppress "@
|
|
143
|
+
#suppress "@typespec/spector/missing-scenario" "by design"
|
|
144
144
|
@post
|
|
145
145
|
@route("/v1")
|
|
146
146
|
v1InInterface(@body body: ModelV1): ModelV1;
|
|
@@ -53,5 +53,20 @@ enum Versions {
|
|
|
53
53
|
""")
|
|
54
54
|
@route("/test")
|
|
55
55
|
@post
|
|
56
|
-
@returnTypeChangedFrom(
|
|
57
|
-
|
|
56
|
+
@returnTypeChangedFrom(
|
|
57
|
+
Versions.v2,
|
|
58
|
+
{
|
|
59
|
+
@header
|
|
60
|
+
contentType: "application/json",
|
|
61
|
+
|
|
62
|
+
@body
|
|
63
|
+
body: int32,
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
op test(@header contentType: "application/json", @body body: string): {
|
|
67
|
+
@header
|
|
68
|
+
contentType: "application/json";
|
|
69
|
+
|
|
70
|
+
@body
|
|
71
|
+
body: string;
|
|
72
|
+
};
|