Skip to content

Commit c35c9fa

Browse files
authored
Refactor JSON deserialization to assist code generation (#474)
* Add type cast functions to Number * Add custom errors and token convenience functions to JSON deserialization * CR feedback * Move `base64` from smithy-http into smithy-types * Add more expect functions to the JSON deserializer
1 parent 8251264 commit c35c9fa

File tree

11 files changed

+808
-272
lines changed

11 files changed

+808
-272
lines changed

codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/RuntimeTypes.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ data class RuntimeType(val name: String?, val dependency: RustDependency?, val n
123123
fun Base64Encode(runtimeConfig: RuntimeConfig): RuntimeType =
124124
RuntimeType(
125125
"encode",
126-
CargoDependency.SmithyHttp(runtimeConfig),
127-
"${runtimeConfig.cratePrefix}_http::base64"
126+
CargoDependency.SmithyTypes(runtimeConfig),
127+
"${runtimeConfig.cratePrefix}_types::base64"
128128
)
129129

130130
fun Base64Decode(runtimeConfig: RuntimeConfig): RuntimeType =
131131
RuntimeType(
132132
"decode",
133-
CargoDependency.SmithyHttp(runtimeConfig),
134-
"${runtimeConfig.cratePrefix}_http::base64"
133+
CargoDependency.SmithyTypes(runtimeConfig),
134+
"${runtimeConfig.cratePrefix}_types::base64"
135135
)
136136

137137
fun TimestampFormat(runtimeConfig: RuntimeConfig, format: TimestampFormatTrait.Format): RuntimeType {

rust-runtime/inlineable/src/blob_serde.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
use serde::de::{Error, Unexpected};
77
use serde::{Deserialize, Deserializer, Serialize, Serializer};
8-
use smithy_http::base64;
9-
use smithy_types::Blob;
8+
use smithy_types::{base64, Blob};
109

1110
pub struct BlobSer<'a>(pub &'a Blob);
1211

rust-runtime/smithy-http/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ tokio-util = { version = "0.6", optional = true}
3030

3131
[dev-dependencies]
3232
proptest = "1"
33-
base64 = "0.13.0"
3433
tokio = {version = "1.6", features = ["macros", "rt", "fs", "io-util"]}
3534
tokio-stream = "0.1.5"
3635
tempfile = "3.2.0"

rust-runtime/smithy-http/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#![cfg_attr(docsrs, feature(doc_cfg))]
77

8-
pub mod base64;
98
pub mod body;
109
pub mod byte_stream;
1110
pub mod endpoint;

0 commit comments

Comments
 (0)