Skip to content

Commit

Permalink
Change target type to Document
Browse files Browse the repository at this point in the history
  • Loading branch information
dhpiggott committed Feb 20, 2024
1 parent cd7e6d5 commit 706e862
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace alloy

/// Retain unknown fields of a containing structure in a map.
@trait(
selector: "structure > member :test(> map :test(> member > document))"
selector: "structure > member :test(> document)"
)
structure unknownFieldRetention {}
7 changes: 1 addition & 6 deletions modules/core/test/resources/META-INF/smithy/traits.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,5 @@ structure TestUnknownFieldRetention {
foo: String
bar: String
@unknownFieldRetention
bazes: RetainedUnknownFields
}

map RetainedUnknownFields {
key: String
value: Document
bazes: Document
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

package alloy

import software.amazon.smithy.model.shapes.ListShape
import software.amazon.smithy.model.shapes.MemberShape
import software.amazon.smithy.model.shapes.ShapeId
import software.amazon.smithy.model.shapes.DocumentShape
Expand All @@ -30,11 +29,6 @@ final class UnknownFieldRetentionTraitProviderSpec extends munit.FunSuite {
.builder()
.id(ShapeId.fromParts("test", "MyDocument"))
.build()
val mapShape = ListShape
.builder()
.id(ShapeId.fromParts("test", "MyMap"))
.member(documentShape.getId)
.build()
val structId = ShapeId.fromParts("test", "MyStruct")
val targetId = structId.withMember("myMap")
val structShape = StructureShape
Expand All @@ -44,15 +38,15 @@ final class UnknownFieldRetentionTraitProviderSpec extends munit.FunSuite {
MemberShape
.builder()
.id(targetId)
.target(mapShape.getId)
.target(documentShape.getId)
.addTrait(new UnknownFieldRetentionTrait)
.build()
)
.build()

val model =
Model.assembler.disableValidation
.addShapes(structShape, mapShape, documentShape)
.addShapes(structShape, documentShape)
.assemble()
.unwrap()

Expand Down

0 comments on commit 706e862

Please sign in to comment.