Skip to content

Commit 7d85188

Browse files
committed
Fix codegen-serde test issues
- Fix service name from ConstraintService to ConstraintsService in SerdeProtocolTestTest - Fix needless lifetime warnings by using '_ instead of explicit lifetimes - Load constraints.smithy model explicitly in testRestJson Remaining issues: - Feature test expects serde feature not to be added when trait not used - Serialization test has float/double value differences
1 parent 7648d48 commit 7d85188

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

codegen-serde/src/main/kotlin/software/amazon/smithy/rust/codegen/serde/SerializeImplGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class SerializeImplGenerator(private val codegenContext: CodegenContext) {
544544
) {
545545
rustTemplate(
546546
"""
547-
impl<'a> #{serde}::Serialize for #{ConfigurableSerdeRef}<'a, #{Shape}> {
547+
impl #{serde}::Serialize for #{ConfigurableSerdeRef}<'_, #{Shape}> {
548548
fn serialize<S>(&self, serializer: S) -> #{Result}<S::Ok, S::Error>
549549
where
550550
S: #{serde}::Serializer,
@@ -567,7 +567,7 @@ class SerializeImplGenerator(private val codegenContext: CodegenContext) {
567567
return writable {
568568
rustTemplate(
569569
"""
570-
impl<'a, 'b> #{serde}::Serialize for #{ConfigurableSerdeRef}<'a, #{Shape}<'b>> {
570+
impl #{serde}::Serialize for #{ConfigurableSerdeRef}<'_, #{Shape}<'_>> {
571571
fn serialize<S>(&self, serializer: S) -> #{Result}<S::Ok, S::Error>
572572
where
573573
S: #{serde}::Serializer,

codegen-serde/src/main/kotlin/software/amazon/smithy/rust/codegen/serde/SupportStructures.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ object SupportStructures {
133133
"""
134134
pub(crate) struct Sensitive<T>(pub(crate) T);
135135
136-
impl<'a, T> #{serde}::Serialize for ConfigurableSerdeRef<'a, Sensitive<T>>
136+
impl<T> #{serde}::Serialize for ConfigurableSerdeRef<'_, Sensitive<T>>
137137
where
138138
T: #{serde}::Serialize,
139139
{
@@ -175,7 +175,7 @@ object SupportStructures {
175175
.serialize(serializer)
176176
}
177177
}
178-
impl<'a, T> #{serde}::Serialize for #{ConfigurableSerdeRef}<'a, Option<T>>
178+
impl<T> #{serde}::Serialize for #{ConfigurableSerdeRef}<'_, Option<T>>
179179
where
180180
T: #{SerializeConfigured},
181181
{

codegen-serde/src/test/kotlin/software/amazon/smithy/rust/codegen/serde/SerdeProtocolTestTest.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ class SerdeProtocolTestTest {
3030
fun testedModels(): Stream<Arguments> =
3131
Stream.of(
3232
Arguments.of(ShapeId.from(ServiceShapeId.REST_JSON)),
33-
Arguments.of(ShapeId.from("com.amazonaws.constraints#ConstraintService")),
33+
Arguments.of(ShapeId.from("com.amazonaws.constraints#ConstraintsService")),
3434
)
3535
}
3636

3737
@Test
3838
fun testRestJson() {
39-
val serviceShapeId = ShapeId.from("com.amazonaws.constraints#ConstraintService")
40-
val model = Model.assembler().discoverModels().assemble().result.get().attachSerdeToService(serviceShapeId)
39+
val serviceShapeId = ShapeId.from("com.amazonaws.constraints#ConstraintsService")
40+
val filePath = "../codegen-core/common-test-models/constraints.smithy"
41+
val model = File(filePath).readText().asSmithyModel().attachSerdeToService(serviceShapeId)
4142
clientIntegrationTest(
4243
model,
4344
IntegrationTestParams(service = serviceShapeId.toString(), cargoCommand = "cargo test --all-features"),

0 commit comments

Comments
 (0)