diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/shapes/SmithyIdlModelSerializer.java b/smithy-model/src/main/java/software/amazon/smithy/model/shapes/SmithyIdlModelSerializer.java index 08ae9d87fe9..ec628339089 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/shapes/SmithyIdlModelSerializer.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/shapes/SmithyIdlModelSerializer.java @@ -647,7 +647,11 @@ public Void resourceShape(ResourceShape shape) { codeWriter.writeOptionalIdList("operations", shape.getIntroducedOperations()); codeWriter.writeOptionalIdList("collectionOperations", shape.getCollectionOperations()); codeWriter.writeOptionalIdList("resources", shape.getIntroducedResources()); - + if (shape.hasProperties()) { + codeWriter.openBlock("properties: {"); + shape.getProperties().forEach((name, shapeId) -> codeWriter.write("$L: $I", name, shapeId)); + codeWriter.closeBlock("}"); + } codeWriter.closeBlock("}"); codeWriter.write(""); return null; diff --git a/smithy-model/src/test/resources/software/amazon/smithy/model/shapes/idl-serialization/cases/service-shapes.smithy b/smithy-model/src/test/resources/software/amazon/smithy/model/shapes/idl-serialization/cases/service-shapes.smithy index 226d8677832..6dcf0e75a38 100644 --- a/smithy-model/src/test/resources/software/amazon/smithy/model/shapes/idl-serialization/cases/service-shapes.smithy +++ b/smithy-model/src/test/resources/software/amazon/smithy/model/shapes/idl-serialization/cases/service-shapes.smithy @@ -24,20 +24,24 @@ resource MyResource { id: String } put: ResourceOperation - create: ResourceOperation + create: EmptyOperation read: ReadonlyResourceOperation update: ResourceOperation delete: ResourceOperation - list: ReadonlyResourceOperation + list: CollectionResourceOperation operations: [ - ResourceOperation + CollectionResourceOperation ] collectionOperations: [ - ResourceOperation + CollectionResourceOperation ] resources: [ SubResource ] + properties: { + value: String + other: String + } } resource SubResource { @@ -46,6 +50,15 @@ resource SubResource { } } +@readonly +operation CollectionResourceOperation { + input := {} + output := {} + errors: [ + Error + ] +} + operation EmptyOperation { input: Unit output: Unit @@ -62,6 +75,7 @@ operation MyOperation { @readonly operation ReadonlyResourceOperation { input := { + @required id: String } output: Unit @@ -70,9 +84,13 @@ operation ReadonlyResourceOperation { @idempotent operation ResourceOperation { input := { + @required id: String } - output: Unit + output := { + value: String + other: String + } } @error("client")