From face63d6674aa82cf69b27560c37bd5fa8a1916c Mon Sep 17 00:00:00 2001 From: Jeff Lewis Date: Wed, 31 Jan 2024 17:09:19 -0700 Subject: [PATCH] fix several readme examples --- README.md | 10 +++------- .../smithytranslate/proto3/SmithyToProtoCompiler.scala | 9 ++++++++- modules/readme-validator/src/Validator.scala | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1009436..8e7a975 100644 --- a/README.md +++ b/README.md @@ -1298,11 +1298,9 @@ structure Testing { Proto: ```proto -import "google/protobuf/wrappers.proto"; - message Testing { - google.protobuf.StringValue myString = 1; - google.protobuf.Int32Value myInt = 2; + string myString = 1; + int32 myInt = 2; } ``` @@ -1476,8 +1474,6 @@ structure TestInput { Proto: ```proto -import "google/protobuf/wrappers.proto"; - service FooService { rpc Test(foo.TestInput) returns (foo.Test200); } @@ -1487,7 +1483,7 @@ message InputBody { } message OutputBody { - google.protobuf.Int32Value sNum = 1; + int32 sNum = 1; } message Test200 { diff --git a/modules/proto/src/smithytranslate/proto3/SmithyToProtoCompiler.scala b/modules/proto/src/smithytranslate/proto3/SmithyToProtoCompiler.scala index 925d902..ea8cb61 100644 --- a/modules/proto/src/smithytranslate/proto3/SmithyToProtoCompiler.scala +++ b/modules/proto/src/smithytranslate/proto3/SmithyToProtoCompiler.scala @@ -22,7 +22,14 @@ object SmithyToProtoCompiler { /** Transforms a smithy model into a list of protobuf files. */ def compile(smithyModel: Model): List[RenderedProtoFile] = { - val compiler = new internals.Compiler(smithyModel, allShapes = false) + compile(smithyModel, allShapes = false) + } + + def compile( + smithyModel: Model, + allShapes: Boolean + ): List[RenderedProtoFile] = { + val compiler = new internals.Compiler(smithyModel, allShapes) compiler .compile() .map { compileOutput => diff --git a/modules/readme-validator/src/Validator.scala b/modules/readme-validator/src/Validator.scala index 161437f..a1dbad6 100644 --- a/modules/readme-validator/src/Validator.scala +++ b/modules/readme-validator/src/Validator.scala @@ -217,7 +217,7 @@ object Validator { .unwrap() val rendered = SmithyToProtoCompiler - .compile(inputModel) + .compile(inputModel, allShapes = true) .filter(_.path.contains(namespace)) .map(_.contents) .sorted