Skip to content

Unexpected . in generated file names results in buf warning #148

Open
@nahk-ivanov

Description

@nahk-ivanov

When using the plugin v3.21.2 through buf on Linux (Ubuntu), I'm getting the following warning:

Warning: Generated file name "./some/path/to/file/my_message_pb.js" does not conform to the Protobuf generation specification. Note that the file name must be relative, use "/" instead of "", and not use "." or ".." as part of the file name. Buf will continue without error here, but please raise an issue with the maintainer of the plugin and reference https://github.com/protocolbuffers/protobuf/blob/95e6c5b4746dd7474d540ce4fb375e3f79a086f8/src/google/protobuf/compiler/plugin.proto#L122

...which is rather self-explanatory. I suspect this might be because of the . at the beginning.

The buf command I was using is the following:

buf generate /path/to/protos --template buf.gen.yaml -o /output/location

(i.e. I used full path for both - input and output paths)

buf generation template is

version: v1
plugins:
  - name: js
    out: .
    opt: import_style=commonjs

I tried changing out to not be . to no avail.

There are no warnings when plugin is used through protoc directly, but I think the buf is right that returned file path should not have . components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions