From a6e79ed5c5833272b5179c80c52b8f3befab8bd8 Mon Sep 17 00:00:00 2001 From: Alfan Nur Fauzan Date: Mon, 8 Nov 2021 11:35:31 +0700 Subject: [PATCH] Preserve Package (#15) * preserve package * bump version --- content_builder.go | 5 +++-- example/user_add_comment.pps | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/content_builder.go b/content_builder.go index 550afd2..aff9d37 100644 --- a/content_builder.go +++ b/content_builder.go @@ -29,10 +29,11 @@ func (b *contentBuilder) build(protoFile *descriptorpb.FileDescriptorProto) (str compVersion := b.request.GetCompilerVersion() fmt.Fprintf(b.output, "// Code generated by protoc-gen-pubsub-schema. DO NOT EDIT.\n") fmt.Fprintf(b.output, "// versions:\n") - fmt.Fprintf(b.output, "// protoc-gen-pubsub-schema v1.4.4\n") + fmt.Fprintf(b.output, "// protoc-gen-pubsub-schema v1.5.0\n") fmt.Fprintf(b.output, "// protoc v%d.%d.%d%s\n", compVersion.GetMajor(), compVersion.GetMinor(), compVersion.GetPatch(), compVersion.GetSuffix()) fmt.Fprintf(b.output, "// source: %s\n\n", protoFile.GetName()) - fmt.Fprintf(b.output, "syntax = \"%s\";\n", b.schemaSyntax) + fmt.Fprintf(b.output, "syntax = \"%s\";\n\n", b.schemaSyntax) + fmt.Fprintf(b.output, "package %s;\n", protoFile.GetPackage()) b.buildMessages(protoFile.GetMessageType(), 0) b.buildEnums(protoFile.GetEnumType(), 0) return b.output.String(), nil diff --git a/example/user_add_comment.pps b/example/user_add_comment.pps index c02a15b..4692000 100644 --- a/example/user_add_comment.pps +++ b/example/user_add_comment.pps @@ -1,11 +1,13 @@ // Code generated by protoc-gen-pubsub-schema. DO NOT EDIT. // versions: -// protoc-gen-pubsub-schema v1.4.4 +// protoc-gen-pubsub-schema v1.5.0 // protoc v3.19.1 // source: example/user_add_comment.proto syntax = "proto2"; +package example; + message UserAddComment { required User user = 1; required string comment = 2;