[protobuf] Support setting fileName in TypeSpec.Protobuf.PackageDetails #5462
Labels
design:needed
A design request has been raised that needs a proposal
emitter:protobuf
The protobuf emitter
triaged:core
Milestone
Clear and concise description of the problem
The TypeSpec.Protobuf.package decorator
name
property results in a generated file rather than a directory matching the package name.Current State
Given the following:
The protobuf emitter emits a file
/my/example/v1.proto
, see playground.I would expect
/my/example/v1/generated.proto
Problem
This prevents the ability to add multiple manual
.proto
files along side the generated proto under the same package"my.example.v1"
./my/example/v1.proto
, I cannot add/my/example/v1/non-generated.proto
This also breaks the linter for the popular bufbuild tool which expects the package name to match a directory path minus a filename -
"my.example.v1"
->/my/example/v1/
.Solution (non-breaking)
Add a property
fileName
to theTypeSpec.Protobuf.PackageDetails
to allow generating proto files with a specific filename.If no
fileName
is provided, maintain backwards compatibility by emitting the current state.Example with
fileName
would result in emitted file:/my/example/v1/cool.proto
Other considerations
I imagine it is better to add a new property
fileName
toTypeSpec.Protobuf.PackageDetails
rather than a new protobuf emitter--option="@typespec/protobuf.file-name=xxx"
as the former would persist the file name to support.proto
import directives.Checklist
The text was updated successfully, but these errors were encountered: