Unexpected `.` in generated file names results in `buf` warning

Open
#148 2 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
tooling

Research direction

Reproduce the warning with the shown buf generate command, buf.gen.yaml template, and plugin v3.21.2 on Linux, then compare the generated path with direct protoc output. Trace the plugin output against the referenced plugin.proto generation specification; done means buf receives a relative filename without a leading "." component and no longer warns.

Written by the indexing model from the issue text.

Description

good first issue P3 triaged

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.

Dominant language
JavaScript
Stars
471
Forks
92
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from protocolbuffers/protobuf-javascript

All issues in protocolbuffers/protobuf-javascript

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.