Skip to content

Commit

Permalink
Explode on unrecognized shape types in event stream test tools
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti committed Dec 20, 2022
1 parent be77fa0 commit c608a77
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ object EventStreamTestTools {
CodegenTarget.CLIENT -> CombinedErrorGenerator(model, symbolProvider, operationSymbol, errors).render(this)
CodegenTarget.SERVER -> ServerCombinedErrorGenerator(model, symbolProvider, operationSymbol, errors).render(this)
}
for (shape in model.shapes().filter { shape -> shape.isStructureShape && shape.hasTrait<ErrorTrait>() }) {
for (shape in model.shapes().filter { shape -> shape is StructureShape && shape.hasTrait<ErrorTrait>() }) {
StructureGenerator(model, symbolProvider, this, shape as StructureShape).render(codegenTarget)
requirements.renderBuilderForShape(this, codegenContext, shape)
}
Expand Down Expand Up @@ -155,10 +155,16 @@ object EventStreamTestTools {
for (member in shape.members()) {
val target = model.expectShape(member.target)
if (target is StructureShape || target is UnionShape) {
if (target is StructureShape) {
target.renderWithModelBuilder(model, symbolProvider, writer)
} else if (target is UnionShape) {
UnionGenerator(model, symbolProvider, writer, target, renderUnknownVariant = mode.renderUnknownVariant()).render()
when (target) {
is StructureShape -> target.renderWithModelBuilder(model, symbolProvider, writer)
is UnionShape -> UnionGenerator(
model,
symbolProvider,
writer,
target,
renderUnknownVariant = mode.renderUnknownVariant(),
).render()
else -> TODO("EventStreamTestTools doesn't support rendering $target")
}
recursivelyGenerateModels(model, symbolProvider, target, writer, mode)
}
Expand Down

0 comments on commit c608a77

Please sign in to comment.