Skip to content

feat(openapi): Remove go_package option requirement - #20

Merged
amckinney merged 1 commit into
mainfrom
amckinney/go_package
Mar 16, 2026
Merged

amckinney merged 1 commit into
mainfrom
amckinney/go_package

Conversation

@amckinney

Copy link
Copy Markdown

Problem

The protogen library requires every .proto file to have a go_package option, but this plugin generates OpenAPI specs — not Go code.

Solution

Instead of calling opts.Run(), we now do the following:

  1. Read and unmarshal the CodeGeneratorRequest from stdin ourselves.
  2. Inject a synthetic go_package option (example.com/fake/<package>) into any .proto file that's missing one — this satisfies protogen's validation without affecting the OpenAPI output at all.
  3. Call opts.New(req) with the patched request, then handle the response ourselves.

@amckinney
amckinney merged commit 334199f into main Mar 16, 2026
1 check passed
@amckinney
amckinney deleted the amckinney/go_package branch March 16, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants