Skip to content

Commit e0e5d47

Browse files
Add large http example operation
1 parent 5b4708f commit e0e5d47

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

smithy-docgen-test/model/main.smithy

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
$version: "2.0"
22

3+
metadata suppressions = [
4+
{id: "UnstableTrait", namespace: "com.example", reason: "These are used for examples."}
5+
{id: "DeprecatedTrait", namespace: "com.example", reason: "These are used for examples."}
6+
]
7+
38
namespace com.example
49

510
use aws.protocols#awsJson1_0
@@ -27,6 +32,7 @@ service DocumentedService {
2732
OptionalAuthOperation
2833
LimitedAuthOperation
2934
LimitedOptionalAuthOperation
35+
HttpTraits
3036
]
3137
resources: [
3238
DocumentationResource
@@ -37,6 +43,59 @@ service DocumentedService {
3743
]
3844
}
3945

46+
/// This operation showcases most of the various HTTP traits.
47+
@http(method: "POST", uri: "/HttpTraits/{label}/{greedyLabel+}?static", code: 200)
48+
@httpChecksumRequired
49+
operation HttpTraits {
50+
input := {
51+
/// This is a label member that's bound to a normal label.
52+
@httpLabel
53+
@required
54+
label: String
55+
56+
/// This is a label member that's bound to a greedy label.
57+
@httpLabel
58+
@required
59+
greedyLabel: String
60+
61+
/// This is a header member bound to a single static header.
62+
@httpHeader("x-custom-header")
63+
singletonHeader: String
64+
65+
/// This is a header member that's bound to a list.
66+
@httpHeader("x-list-header")
67+
listHeader: StringList
68+
69+
/// This is a header member that's bound to a map with a prefix.
70+
@httpPrefixHeaders("prefix-")
71+
prefixHeaders: DenseStringMap
72+
73+
/// This is a query param that's bound to a single param.
74+
@httpQuery("singelton")
75+
singletonQuery: String
76+
77+
/// This is a query param that's bound to a list.
78+
@httpQuery("list")
79+
listQuery: StringList
80+
81+
/// This is an open listing of all query params.
82+
@httpQueryParams
83+
mapQuery: StringMap
84+
85+
/// This is the operation's payload, only useable since everything
86+
/// else is bound to some other part of the HTTP request.
87+
@httpPayload
88+
payload: Blob
89+
}
90+
91+
output := {
92+
/// This allows people to more easily interact with the http response
93+
/// without having to leak the response object.
94+
@httpResponseCode
95+
responseCode: Integer
96+
}
97+
}
98+
4099
/// This operation does not support any of the service's auth types.
41100
@auth([])
42101
@http(method: "POST", uri: "/UnauthenticatedOperation")
@@ -239,6 +298,12 @@ map StringMap {
239298
value: String
240299
}
241300

301+
/// A map that disallows null values.
302+
map DenseStringMap {
303+
key: String
304+
value: String
305+
}
306+
242307
/// This shows how the range trait is applied to various types.
243308
structure RangeTraitExamples {
244309
@range(min: 0)
@@ -280,6 +345,7 @@ blob SensitiveBlob
280345

281346
@mixin
282347
@error("client")
348+
@httpError(400)
283349
structure ErrorMixin {
284350
/// The wire-level error identifier.
285351
code: String
@@ -293,6 +359,7 @@ structure ClientError with [ErrorMixin] {}
293359

294360
/// This is an error that is the fault of the service.
295361
@error("server")
362+
@httpError(500)
296363
structure ServiceError with [ErrorMixin] {}
297364

298365
/// This error is only returned by DocumentedOperation

0 commit comments

Comments
 (0)