Loading codegen/src/aws_conv.rs +22 −1 Original line number Diff line number Diff line Loading @@ -75,12 +75,27 @@ pub fn codegen(ops: &Operations, rust_types: &RustTypes) { continue; } let field_ty = &rust_types[field.type_.as_str()]; let needs_unwrap = 'unwrap: { if field.type_ == "OptionalObjectAttributesList" { break 'unwrap true; } if is_op_input(&ty.name, ops) && field.option_type.not() && field.is_required { break 'unwrap true; } let is_special_type = matches!( field_ty, rust::Type::StrEnum(_) | rust::Type::Alias(_) | rust::Type::List(_) | rust::Type::Timestamp(_) ); if is_special_type { break 'unwrap false; } field.option_type.not() && field.default_value.is_none() }; // if needs_unwrap { // println!("{:?} {:?}\n", ty.name, field); // } if needs_unwrap { g!("{s3s_field_name}: unwrap_from_aws(x.{aws_field_name}, \"{s3s_field_name}\")?,"); Loading Loading @@ -153,7 +168,9 @@ pub fn codegen(ops: &Operations, rust_types: &RustTypes) { } } if is_op_input(&ty.name, ops) { if has_unconditional_builder(&ty.name) { g!("Ok(y.build())"); } else if is_op_input(&ty.name, ops) || ty.fields.iter().any(|field| field.is_required) { g!("y.build().map_err(S3Error::internal_error)"); } else { g!("Ok(y.build())"); Loading Loading @@ -222,3 +239,7 @@ fn aws_ty_path(name: &str, ops: &Operations, rust_types: &RustTypes) -> String { fn contains_deprecated_field(name: &str) -> bool { matches!(name, "LifecycleRule" | "ReplicationRule") } fn has_unconditional_builder(name: &str) -> bool { matches!(name, "AnalyticsExportDestination" | "InventoryDestination" | "RoutingRule") } codegen/src/dto.rs +6 −1 Original line number Diff line number Diff line use crate::o; use crate::ops::{is_op_input, Operations}; use crate::ops::{is_op_input, Operations, SKIPPED_OPS}; use crate::rust::codegen_doc; use crate::{rust, smithy}; Loading Loading @@ -287,6 +287,11 @@ fn patch_types(space: &mut RustTypes) { } fn unify_operation_types(ops: &Operations, space: &mut RustTypes) { for op in SKIPPED_OPS { space.remove(&format!("{op}Request")); space.remove(&format!("{op}Output")); } // unify operation input type for op in ops.values() { if op.name == "SelectObjectContent" { Loading codegen/src/ops.rs +3 −6 Original line number Diff line number Diff line Loading @@ -35,11 +35,8 @@ pub struct Operation { pub type Operations = BTreeMap<String, Operation>; fn is_skipped_operation(op_name: &str) -> bool { // TODO: handle these operations let skipped = ["CreateSession", "ListDirectoryBuckets"]; skipped.contains(&op_name) } pub const SKIPPED_OPS: &[&str] = &["CreateSession", "ListDirectoryBuckets"]; pub fn collect_operations(model: &smithy::Model) -> Operations { let mut operations: Operations = default(); Loading @@ -50,7 +47,7 @@ pub fn collect_operations(model: &smithy::Model) -> Operations { let op_name = dto::to_type_name(shape_name).to_owned(); if is_skipped_operation(&op_name) { if SKIPPED_OPS.contains(&op_name.as_str()) { continue; } Loading crates/s3s-aws/src/conv/generated.rs +115 −189 File changed.Preview size limit exceeded, changes collapsed. Show changes crates/s3s-aws/src/event_stream.rs +1 −1 Original line number Diff line number Diff line use sync_wrapper::{SyncFuture, SyncWrapper}; use transform_stream::AsyncStream; type AwsSelectObjectContentEventStream = aws_smithy_http::event_stream::Receiver< type AwsSelectObjectContentEventStream = aws_sdk_s3::primitives::event_stream::EventReceiver< aws_sdk_s3::types::SelectObjectContentEventStream, aws_sdk_s3::types::error::SelectObjectContentEventStreamError, >; Loading Loading
codegen/src/aws_conv.rs +22 −1 Original line number Diff line number Diff line Loading @@ -75,12 +75,27 @@ pub fn codegen(ops: &Operations, rust_types: &RustTypes) { continue; } let field_ty = &rust_types[field.type_.as_str()]; let needs_unwrap = 'unwrap: { if field.type_ == "OptionalObjectAttributesList" { break 'unwrap true; } if is_op_input(&ty.name, ops) && field.option_type.not() && field.is_required { break 'unwrap true; } let is_special_type = matches!( field_ty, rust::Type::StrEnum(_) | rust::Type::Alias(_) | rust::Type::List(_) | rust::Type::Timestamp(_) ); if is_special_type { break 'unwrap false; } field.option_type.not() && field.default_value.is_none() }; // if needs_unwrap { // println!("{:?} {:?}\n", ty.name, field); // } if needs_unwrap { g!("{s3s_field_name}: unwrap_from_aws(x.{aws_field_name}, \"{s3s_field_name}\")?,"); Loading Loading @@ -153,7 +168,9 @@ pub fn codegen(ops: &Operations, rust_types: &RustTypes) { } } if is_op_input(&ty.name, ops) { if has_unconditional_builder(&ty.name) { g!("Ok(y.build())"); } else if is_op_input(&ty.name, ops) || ty.fields.iter().any(|field| field.is_required) { g!("y.build().map_err(S3Error::internal_error)"); } else { g!("Ok(y.build())"); Loading Loading @@ -222,3 +239,7 @@ fn aws_ty_path(name: &str, ops: &Operations, rust_types: &RustTypes) -> String { fn contains_deprecated_field(name: &str) -> bool { matches!(name, "LifecycleRule" | "ReplicationRule") } fn has_unconditional_builder(name: &str) -> bool { matches!(name, "AnalyticsExportDestination" | "InventoryDestination" | "RoutingRule") }
codegen/src/dto.rs +6 −1 Original line number Diff line number Diff line use crate::o; use crate::ops::{is_op_input, Operations}; use crate::ops::{is_op_input, Operations, SKIPPED_OPS}; use crate::rust::codegen_doc; use crate::{rust, smithy}; Loading Loading @@ -287,6 +287,11 @@ fn patch_types(space: &mut RustTypes) { } fn unify_operation_types(ops: &Operations, space: &mut RustTypes) { for op in SKIPPED_OPS { space.remove(&format!("{op}Request")); space.remove(&format!("{op}Output")); } // unify operation input type for op in ops.values() { if op.name == "SelectObjectContent" { Loading
codegen/src/ops.rs +3 −6 Original line number Diff line number Diff line Loading @@ -35,11 +35,8 @@ pub struct Operation { pub type Operations = BTreeMap<String, Operation>; fn is_skipped_operation(op_name: &str) -> bool { // TODO: handle these operations let skipped = ["CreateSession", "ListDirectoryBuckets"]; skipped.contains(&op_name) } pub const SKIPPED_OPS: &[&str] = &["CreateSession", "ListDirectoryBuckets"]; pub fn collect_operations(model: &smithy::Model) -> Operations { let mut operations: Operations = default(); Loading @@ -50,7 +47,7 @@ pub fn collect_operations(model: &smithy::Model) -> Operations { let op_name = dto::to_type_name(shape_name).to_owned(); if is_skipped_operation(&op_name) { if SKIPPED_OPS.contains(&op_name.as_str()) { continue; } Loading
crates/s3s-aws/src/conv/generated.rs +115 −189 File changed.Preview size limit exceeded, changes collapsed. Show changes
crates/s3s-aws/src/event_stream.rs +1 −1 Original line number Diff line number Diff line use sync_wrapper::{SyncFuture, SyncWrapper}; use transform_stream::AsyncStream; type AwsSelectObjectContentEventStream = aws_smithy_http::event_stream::Receiver< type AwsSelectObjectContentEventStream = aws_sdk_s3::primitives::event_stream::EventReceiver< aws_sdk_s3::types::SelectObjectContentEventStream, aws_sdk_s3::types::error::SelectObjectContentEventStreamError, >; Loading