Created
December 15, 2022 01:25
-
-
Save kubukoz/2a6129c307d0a16866448b7b4cccccc4 to your computer and use it in GitHub Desktop.
Smithy's NeighborProvider and unit shapes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> using lib "software.amazon.smithy:smithy-model:1.26.4" | |
//> using scala "2.13.10" | |
import software.amazon.smithy.model.Model | |
import software.amazon.smithy.model.neighbor.NeighborProvider | |
import software.amazon.smithy.model.shapes.ShapeId | |
import scala.jdk.CollectionConverters._ | |
object demo extends App { | |
val model = Model | |
.assembler() | |
.addUnparsedModel( | |
"test.smithy", | |
"""$version: "2" | |
|namespace test | |
| | |
|operation Hello { output: Unit, input: Unit | |
|} | |
|""".stripMargin, | |
) | |
.assemble() | |
.unwrap() | |
println( | |
NeighborProvider | |
.of(model) | |
.getNeighbors(model.expectShape(ShapeId.from("test#Hello"))) | |
.asScala | |
.toList | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment