Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate resource shape 'properties' with Smithy IDL serialization #1996

Merged
merged 4 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,29 @@ service MyService {
]
}

resource EmptyResource {
zourzouvillys marked this conversation as resolved.
Show resolved Hide resolved
}

resource MyResource {
identifiers: {
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 {
Expand All @@ -46,6 +47,15 @@ resource SubResource {
}
}

@readonly
operation CollectionResourceOperation {
input := {}
output := {}
errors: [
Error
]
}

operation EmptyOperation {
input: Unit
output: Unit
Expand All @@ -62,6 +72,7 @@ operation MyOperation {
@readonly
operation ReadonlyResourceOperation {
input := {
@required
id: String
}
output: Unit
Expand All @@ -70,9 +81,13 @@ operation ReadonlyResourceOperation {
@idempotent
operation ResourceOperation {
input := {
@required
id: String
}
output: Unit
output := {
value: String
other: String
}
}

@error("client")
Expand Down