|
| 1 | +$version: "2.0" |
| 2 | + |
| 3 | +namespace smithy.protocoltests.rpcv2Json |
| 4 | + |
| 5 | +use smithy.protocols#rpcv2Json |
| 6 | +use smithy.test#httpRequestTests |
| 7 | +use smithy.test#httpResponseTests |
| 8 | + |
| 9 | +@httpRequestTests([ |
| 10 | + { |
| 11 | + id: "RpcV2JsonRequestBigDecimalSimpleValue" |
| 12 | + protocol: rpcv2Json |
| 13 | + documentation: "Serializes a simple big decimal value as a JSON string to preserve precision." |
| 14 | + tags: ["arbitrary-precision"] |
| 15 | + headers: { |
| 16 | + "smithy-protocol": "rpc-v2-json" |
| 17 | + "Content-Type": "application/json" |
| 18 | + "Accept": "application/json" |
| 19 | + } |
| 20 | + requireHeaders: [ |
| 21 | + "Content-Length" |
| 22 | + ] |
| 23 | + method: "POST" |
| 24 | + bodyMediaType: "application/json" |
| 25 | + uri: "/service/RpcV2JsonProtocol/operation/BigDecimalOperation" |
| 26 | + body: """ |
| 27 | + { |
| 28 | + "value": "1.5" |
| 29 | + }""" |
| 30 | + params: { |
| 31 | + value: 1.5 |
| 32 | + } |
| 33 | + } |
| 34 | + { |
| 35 | + id: "RpcV2JsonRequestBigDecimalHighPrecision" |
| 36 | + protocol: rpcv2Json |
| 37 | + documentation: """ |
| 38 | + Serializes a big decimal value that exceeds double precision in the decimal |
| 39 | + portion. Implementations use JSON strings to preserve this precision.""" |
| 40 | + tags: ["arbitrary-precision"] |
| 41 | + headers: { |
| 42 | + "smithy-protocol": "rpc-v2-json" |
| 43 | + "Content-Type": "application/json" |
| 44 | + "Accept": "application/json" |
| 45 | + } |
| 46 | + requireHeaders: [ |
| 47 | + "Content-Length" |
| 48 | + ] |
| 49 | + method: "POST" |
| 50 | + bodyMediaType: "application/json" |
| 51 | + uri: "/service/RpcV2JsonProtocol/operation/BigDecimalOperation" |
| 52 | + body: """ |
| 53 | + { |
| 54 | + "value": "0.100000000000000000000001" |
| 55 | + }""" |
| 56 | + params: { |
| 57 | + value: 0.100000000000000000000001 |
| 58 | + } |
| 59 | + } |
| 60 | + { |
| 61 | + id: "RpcV2JsonRequestBigDecimalNegativeHighPrecision" |
| 62 | + protocol: rpcv2Json |
| 63 | + documentation: """ |
| 64 | + Serializes a negative big decimal value that exceeds double precision in |
| 65 | + the decimal portion. Implementations use JSON strings to preserve this |
| 66 | + precision.""" |
| 67 | + tags: ["arbitrary-precision"] |
| 68 | + headers: { |
| 69 | + "smithy-protocol": "rpc-v2-json" |
| 70 | + "Content-Type": "application/json" |
| 71 | + "Accept": "application/json" |
| 72 | + } |
| 73 | + requireHeaders: [ |
| 74 | + "Content-Length" |
| 75 | + ] |
| 76 | + method: "POST" |
| 77 | + bodyMediaType: "application/json" |
| 78 | + uri: "/service/RpcV2JsonProtocol/operation/BigDecimalOperation" |
| 79 | + body: """ |
| 80 | + { |
| 81 | + "value": "-0.100000000000000000000001" |
| 82 | + }""" |
| 83 | + params: { |
| 84 | + value: -0.100000000000000000000001 |
| 85 | + } |
| 86 | + } |
| 87 | + { |
| 88 | + id: "RpcV2JsonRequestBigDecimalLargeWithFraction" |
| 89 | + protocol: rpcv2Json |
| 90 | + documentation: """ |
| 91 | + Serializes a big decimal value that exceeds double precision in the integer |
| 92 | + portion. Implementations use JSON strings to preserve this precision.""" |
| 93 | + tags: ["arbitrary-precision"] |
| 94 | + headers: { |
| 95 | + "smithy-protocol": "rpc-v2-json" |
| 96 | + "Content-Type": "application/json" |
| 97 | + "Accept": "application/json" |
| 98 | + } |
| 99 | + requireHeaders: [ |
| 100 | + "Content-Length" |
| 101 | + ] |
| 102 | + method: "POST" |
| 103 | + bodyMediaType: "application/json" |
| 104 | + uri: "/service/RpcV2JsonProtocol/operation/BigDecimalOperation" |
| 105 | + body: """ |
| 106 | + { |
| 107 | + "value": "100000000000000000000001.0" |
| 108 | + }""" |
| 109 | + params: { |
| 110 | + value: 100000000000000000000001.0 |
| 111 | + } |
| 112 | + } |
| 113 | +]) |
| 114 | +@httpResponseTests([ |
| 115 | + { |
| 116 | + id: "RpcV2JsonResponseBigDecimalSimpleValue" |
| 117 | + protocol: rpcv2Json |
| 118 | + documentation: "Serializes a simple big decimal value as a JSON string to preserve precision." |
| 119 | + tags: ["arbitrary-precision"] |
| 120 | + headers: { |
| 121 | + "smithy-protocol": "rpc-v2-json" |
| 122 | + "Content-Type": "application/json" |
| 123 | + } |
| 124 | + bodyMediaType: "application/json" |
| 125 | + body: """ |
| 126 | + { |
| 127 | + "value": "1.5" |
| 128 | + }""" |
| 129 | + code: 200 |
| 130 | + params: { |
| 131 | + value: 1.5 |
| 132 | + } |
| 133 | + } |
| 134 | + { |
| 135 | + id: "RpcV2JsonResponseBigDecimalHighPrecision" |
| 136 | + protocol: rpcv2Json |
| 137 | + documentation: """ |
| 138 | + Serializes a big decimal value that exceeds double precision in the decimal |
| 139 | + portion. Implementations use JSON strings to preserve this precision.""" |
| 140 | + tags: ["arbitrary-precision"] |
| 141 | + headers: { |
| 142 | + "smithy-protocol": "rpc-v2-json" |
| 143 | + "Content-Type": "application/json" |
| 144 | + } |
| 145 | + bodyMediaType: "application/json" |
| 146 | + body: """ |
| 147 | + { |
| 148 | + "value": "0.100000000000000000000001" |
| 149 | + }""" |
| 150 | + code: 200 |
| 151 | + params: { |
| 152 | + value: 0.100000000000000000000001 |
| 153 | + } |
| 154 | + } |
| 155 | + { |
| 156 | + id: "RpcV2JsonResponseBigDecimalNegativeHighPrecision" |
| 157 | + protocol: rpcv2Json |
| 158 | + documentation: """ |
| 159 | + Serializes a negative big decimal value that exceeds double precision in |
| 160 | + the decimal portion. Implementations use JSON strings to preserve this |
| 161 | + precision.""" |
| 162 | + tags: ["arbitrary-precision"] |
| 163 | + headers: { |
| 164 | + "smithy-protocol": "rpc-v2-json" |
| 165 | + "Content-Type": "application/json" |
| 166 | + } |
| 167 | + bodyMediaType: "application/json" |
| 168 | + body: """ |
| 169 | + { |
| 170 | + "value": "-0.100000000000000000000001" |
| 171 | + }""" |
| 172 | + code: 200 |
| 173 | + params: { |
| 174 | + value: -0.100000000000000000000001 |
| 175 | + } |
| 176 | + } |
| 177 | + { |
| 178 | + id: "RpcV2JsonResponseBigDecimalLargeWithFraction" |
| 179 | + protocol: rpcv2Json |
| 180 | + documentation: """ |
| 181 | + Serializes a big decimal value that exceeds double precision in the integer |
| 182 | + portion. Implementations use JSON strings to preserve this precision.""" |
| 183 | + tags: ["arbitrary-precision"] |
| 184 | + headers: { |
| 185 | + "smithy-protocol": "rpc-v2-json" |
| 186 | + "Content-Type": "application/json" |
| 187 | + } |
| 188 | + bodyMediaType: "application/json" |
| 189 | + body: """ |
| 190 | + { |
| 191 | + "value": "100000000000000000000001.0" |
| 192 | + }""" |
| 193 | + code: 200 |
| 194 | + params: { |
| 195 | + value: 100000000000000000000001.0 |
| 196 | + } |
| 197 | + } |
| 198 | +]) |
| 199 | +operation BigDecimalOperation { |
| 200 | + input: BigDecimalStructure |
| 201 | + output: BigDecimalStructure |
| 202 | +} |
| 203 | + |
| 204 | +structure BigDecimalStructure { |
| 205 | + value: BigDecimal |
| 206 | +} |
| 207 | + |
| 208 | +@httpRequestTests([ |
| 209 | + { |
| 210 | + id: "RpcV2JsonRequestBigIntegerSimpleValue" |
| 211 | + protocol: rpcv2Json |
| 212 | + documentation: "Serializes a simple big integer value as a JSON string to preserve precision." |
| 213 | + tags: ["arbitrary-precision"] |
| 214 | + headers: { |
| 215 | + "smithy-protocol": "rpc-v2-json" |
| 216 | + "Content-Type": "application/json" |
| 217 | + "Accept": "application/json" |
| 218 | + } |
| 219 | + requireHeaders: [ |
| 220 | + "Content-Length" |
| 221 | + ] |
| 222 | + method: "POST" |
| 223 | + bodyMediaType: "application/json" |
| 224 | + uri: "/service/RpcV2JsonProtocol/operation/BigIntegerOperation" |
| 225 | + body: """ |
| 226 | + { |
| 227 | + "value": "42" |
| 228 | + }""" |
| 229 | + params: { |
| 230 | + value: 42 |
| 231 | + } |
| 232 | + } |
| 233 | + { |
| 234 | + id: "RpcV2JsonRequestBigIntegerExceedingLongRange" |
| 235 | + protocol: rpcv2Json |
| 236 | + documentation: """ |
| 237 | + Serializes a big integer value that exceeds the precision of a long. |
| 238 | + Implementations use JSON strings to preserve this precision.""" |
| 239 | + tags: ["arbitrary-precision"] |
| 240 | + headers: { |
| 241 | + "smithy-protocol": "rpc-v2-json" |
| 242 | + "Content-Type": "application/json" |
| 243 | + "Accept": "application/json" |
| 244 | + } |
| 245 | + requireHeaders: [ |
| 246 | + "Content-Length" |
| 247 | + ] |
| 248 | + method: "POST" |
| 249 | + bodyMediaType: "application/json" |
| 250 | + uri: "/service/RpcV2JsonProtocol/operation/BigIntegerOperation" |
| 251 | + body: """ |
| 252 | + { |
| 253 | + "value": "9223372036854775808" |
| 254 | + }""" |
| 255 | + params: { |
| 256 | + value: 9223372036854775808 |
| 257 | + } |
| 258 | + } |
| 259 | + { |
| 260 | + id: "RpcV2JsonRequestBigIntegerNegativeLargeValue" |
| 261 | + protocol: rpcv2Json |
| 262 | + documentation: """ |
| 263 | + Serializes a negative big integer value that exceeds the precision of a long. |
| 264 | + Implementations use JSON strings to preserve this precision.""" |
| 265 | + tags: ["arbitrary-precision"] |
| 266 | + headers: { |
| 267 | + "smithy-protocol": "rpc-v2-json" |
| 268 | + "Content-Type": "application/json" |
| 269 | + "Accept": "application/json" |
| 270 | + } |
| 271 | + requireHeaders: [ |
| 272 | + "Content-Length" |
| 273 | + ] |
| 274 | + method: "POST" |
| 275 | + bodyMediaType: "application/json" |
| 276 | + uri: "/service/RpcV2JsonProtocol/operation/BigIntegerOperation" |
| 277 | + body: """ |
| 278 | + { |
| 279 | + "value": "-9223372036854775809" |
| 280 | + }""" |
| 281 | + params: { |
| 282 | + value: -9223372036854775809 |
| 283 | + } |
| 284 | + } |
| 285 | +]) |
| 286 | +@httpResponseTests([ |
| 287 | + { |
| 288 | + id: "RpcV2JsonResponseBigIntegerSimpleValue" |
| 289 | + protocol: rpcv2Json |
| 290 | + documentation: "Serializes a simple big integer value as a JSON string to preserve precision." |
| 291 | + tags: ["arbitrary-precision"] |
| 292 | + headers: { |
| 293 | + "smithy-protocol": "rpc-v2-json" |
| 294 | + "Content-Type": "application/json" |
| 295 | + } |
| 296 | + bodyMediaType: "application/json" |
| 297 | + body: """ |
| 298 | + { |
| 299 | + "value": "42" |
| 300 | + }""" |
| 301 | + code: 200 |
| 302 | + params: { |
| 303 | + value: 42 |
| 304 | + } |
| 305 | + } |
| 306 | + { |
| 307 | + id: "RpcV2JsonResponseBigIntegerExceedingLongRange" |
| 308 | + protocol: rpcv2Json |
| 309 | + documentation: """ |
| 310 | + Serializes a big integer value that exceeds the precision of a long. |
| 311 | + Implementations use JSON strings to preserve this precision.""" |
| 312 | + tags: ["arbitrary-precision"] |
| 313 | + headers: { |
| 314 | + "smithy-protocol": "rpc-v2-json" |
| 315 | + "Content-Type": "application/json" |
| 316 | + } |
| 317 | + bodyMediaType: "application/json" |
| 318 | + body: """ |
| 319 | + { |
| 320 | + "value": "9223372036854775808" |
| 321 | + }""" |
| 322 | + code: 200 |
| 323 | + params: { |
| 324 | + value: 9223372036854775808 |
| 325 | + } |
| 326 | + } |
| 327 | + { |
| 328 | + id: "RpcV2JsonResponseBigIntegerNegativeLargeValue" |
| 329 | + protocol: rpcv2Json |
| 330 | + documentation: """ |
| 331 | + Serializes a negative big integer value that exceeds the precision of a long. |
| 332 | + Implementations use JSON strings to preserve this precision.""" |
| 333 | + tags: ["arbitrary-precision"] |
| 334 | + headers: { |
| 335 | + "smithy-protocol": "rpc-v2-json" |
| 336 | + "Content-Type": "application/json" |
| 337 | + } |
| 338 | + bodyMediaType: "application/json" |
| 339 | + body: """ |
| 340 | + { |
| 341 | + "value": "-9223372036854775809" |
| 342 | + }""" |
| 343 | + code: 200 |
| 344 | + params: { |
| 345 | + value: -9223372036854775809 |
| 346 | + } |
| 347 | + } |
| 348 | +]) |
| 349 | +operation BigIntegerOperation { |
| 350 | + input: BigIntegerStructure |
| 351 | + output: BigIntegerStructure |
| 352 | +} |
| 353 | + |
| 354 | +structure BigIntegerStructure { |
| 355 | + value: BigInteger |
| 356 | +} |
0 commit comments