-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathmain.smithy
More file actions
250 lines (201 loc) · 5.15 KB
/
Copy pathmain.smithy
File metadata and controls
250 lines (201 loc) · 5.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
$version: "2"
namespace smithy.java.mcp.test
use smithy.mcp#oneOf
service TestService {
operations: [
McpEcho,
CalculateArea
]
}
operation McpEcho {
input := {
echo: Echo
}
output:= {
echo: Echo
}
}
operation CalculateArea {
input : CalculateAreaInput
output := {
@required
area: Double
@required
originalShape: Shape
}
}
structure CalculateAreaInput {
oneOfInput : Shape
}
/// Union without @oneOf trait - uses wrapper format natively
union Shape {
circle : Circle
square: Square
rectangle: Rectangle
}
/// Document with @oneOf trait - for testing Document-based polymorphic types
/// Used when services need discriminator-based polymorphism
@oneOf(discriminator: "__type", members: [
{name: "circle", target: Circle},
{name: "square", target: Square},
{name: "rectangle", target: Rectangle}
])
document ShapeWithOneOf
/// Circle structure with optional nested shapes for testing recursive @oneOf adaptation
structure CircleWithNested {
@required
radius : Integer
/// List of nested shapes (for testing recursive @oneOf document adaptation)
nestedShapes: ShapeWithOneOfList
}
/// @oneOf document with nested list of @oneOf documents
@oneOf(discriminator: "__type", members: [
{name: "circleWithNested", target: CircleWithNested},
{name: "square", target: Square},
{name: "rectangle", target: Rectangle}
])
document NestedShapeWithOneOf
/// List of nested @oneOf documents
list NestedShapeWithOneOfList {
member: NestedShapeWithOneOf
}
structure Circle {
@required
radius : Integer
}
structure Square {
@required
side: Integer
}
structure Rectangle {
@required
length: Integer
@required
breadth: Integer
}
/// A comprehensive structure containing all supported Smithy types for testing MCP serde
structure Echo {
// Primitives
stringValue: String
booleanValue: Boolean
byteValue: Byte
shortValue: Short
integerValue: Integer
longValue: Long
floatValue: Float
doubleValue: Double
// Big numbers (serialized as strings in JSON)
bigDecimalValue: BigDecimal
bigIntegerValue: BigInteger
// Binary (serialized as base64 string)
blobValue: Blob
// Timestamps with different formats
@timestampFormat("epoch-seconds")
epochSecondsTimestamp: Timestamp
@timestampFormat("date-time")
dateTimeTimestamp: Timestamp
@timestampFormat("http-date")
httpDateTimestamp: Timestamp
// Default timestamp (no format trait - defaults to date-time)
defaultTimestamp: Timestamp
// Collections
stringList: StringList
integerList: IntegerList
nestedList: NestedEchoList
// Maps
stringMap: StringMap
nestedMap: NestedEchoMap
// Nested structure
nested: NestedEcho
// Document type (arbitrary JSON)
documentValue: Document
// Enum
enumValue: TestEnum
// String with enum trait (constrained string values)
stringEnumValue: StringWithEnumTrait
// IntEnum (integer enumeration)
intEnumValue: TestIntEnum
// Union type
unionValue: TestUnion
// Union in collections (for testing nested union adaptation)
unionList: UnionList
unionMap: UnionMap
// @oneOf document in collections (for testing Document-based polymorphic types)
shapeWithOneOfList: ShapeWithOneOfList
shapeWithOneOfMap: ShapeWithOneOfMap
// Nested @oneOf documents (for testing recursive adaptation)
nestedShapeWithOneOf: NestedShapeWithOneOf
nestedShapeWithOneOfList: NestedShapeWithOneOfList
// Helper to make CircleWithNested reachable for schema generation
circleWithNested: CircleWithNested
// Required field to test required validation
@required
requiredField: String
}
/// A nested structure for testing recursive types
structure NestedEcho {
innerString: String
innerNumber: Integer
recursive: NestedEcho
}
@sparse
list StringList {
member: String
}
@sparse
list IntegerList {
member: Integer
}
@sparse
list NestedEchoList {
member: NestedEcho
}
@sparse
map StringMap {
key: String
value: String
}
@sparse
map NestedEchoMap {
key: String
value: NestedEcho
}
enum TestEnum {
VALUE_ONE = "VALUE_ONE"
VALUE_TWO = "VALUE_TWO"
}
/// A string with enum trait for testing enum values on string shapes
@enum([
{ value: "OPTION_A", name: "OPTION_A" },
{ value: "OPTION_B", name: "OPTION_B" },
{ value: "OPTION_C", name: "OPTION_C" }
])
string StringWithEnumTrait
intEnum TestIntEnum {
ONE = 1
TWO = 2
THREE = 3
}
union TestUnion {
stringOption: String
integerOption: Integer
nestedOption: NestedEcho
}
/// List of unions for testing nested union adaptation
list UnionList {
member: TestUnion
}
/// Map of unions for testing nested union adaptation
map UnionMap {
key: String
value: TestUnion
}
/// List of @oneOf documents for testing Document-based polymorphic types in collections
list ShapeWithOneOfList {
member: ShapeWithOneOf
}
/// Map of @oneOf documents for testing Document-based polymorphic types in collections
map ShapeWithOneOfMap {
key: String
value: ShapeWithOneOf
}