Unverified Commit c35c9fad authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

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
parent 8251264a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -123,15 +123,15 @@ data class RuntimeType(val name: String?, val dependency: RustDependency?, val n
        fun Base64Encode(runtimeConfig: RuntimeConfig): RuntimeType =
            RuntimeType(
                "encode",
                CargoDependency.SmithyHttp(runtimeConfig),
                "${runtimeConfig.cratePrefix}_http::base64"
                CargoDependency.SmithyTypes(runtimeConfig),
                "${runtimeConfig.cratePrefix}_types::base64"
            )

        fun Base64Decode(runtimeConfig: RuntimeConfig): RuntimeType =
            RuntimeType(
                "decode",
                CargoDependency.SmithyHttp(runtimeConfig),
                "${runtimeConfig.cratePrefix}_http::base64"
                CargoDependency.SmithyTypes(runtimeConfig),
                "${runtimeConfig.cratePrefix}_types::base64"
            )

        fun TimestampFormat(runtimeConfig: RuntimeConfig, format: TimestampFormatTrait.Format): RuntimeType {
+1 −2
Original line number Diff line number Diff line
@@ -5,8 +5,7 @@

use serde::de::{Error, Unexpected};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use smithy_http::base64;
use smithy_types::Blob;
use smithy_types::{base64, Blob};

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

+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ tokio-util = { version = "0.6", optional = true}

[dev-dependencies]
proptest = "1"
base64 = "0.13.0"
tokio = {version = "1.6", features = ["macros", "rt", "fs", "io-util"]}
tokio-stream = "0.1.5"
tempfile = "3.2.0"
+0 −1
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@

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

pub mod base64;
pub mod body;
pub mod byte_stream;
pub mod endpoint;
+177 −260

File changed.

Preview size limit exceeded, changes collapsed.

Loading