Skip to content

Commit

Permalink
Fix resource properties IDL serializing order
Browse files Browse the repository at this point in the history
  • Loading branch information
kstich committed Feb 7, 2025
1 parent 996fd94 commit afecd8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,11 @@ public Void resourceShape(ResourceShape shape) {
entry.getValue()));
codeWriter.closeBlock("}");
}
if (shape.hasProperties()) {
codeWriter.openBlock("properties: {");
shape.getProperties().forEach((name, shapeId) -> codeWriter.write("$L: $I", name, shapeId));
codeWriter.closeBlock("}");
}

shape.getPut().ifPresent(shapeId -> codeWriter.write("put: $I", shapeId));
shape.getCreate().ifPresent(shapeId -> codeWriter.write("create: $I", shapeId));
Expand All @@ -847,11 +852,6 @@ 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 @@ -23,6 +23,10 @@ resource MyResource {
identifiers: {
id: String
}
properties: {
value: String
other: String
}
put: ResourceOperation
create: EmptyOperation
read: ReadonlyResourceOperation
Expand All @@ -38,10 +42,6 @@ resource MyResource {
resources: [
SubResource
]
properties: {
value: String
other: String
}
}

resource SubResource {
Expand Down

0 comments on commit afecd8a

Please sign in to comment.