Skip to content

feat: add support for custom fern.summary proto option#13

Merged
kennyderek merged 1 commit intomainfrom
devin/1763067740-fern-summary-option
Nov 13, 2025
Merged

feat: add support for custom fern.summary proto option#13
kennyderek merged 1 commit intomainfrom
devin/1763067740-fern-summary-option

Conversation

@devin-ai-integration
Copy link

feat: add support for custom fern.summary proto option

Summary

This PR adds support for a custom protobuf option fern.summary that allows users to explicitly set the display name for gRPC endpoints in their proto files. The custom summary is emitted as the OpenAPI operation's summary field, which Fern CLI uses as the endpoint display name.

Usage example:

import "fern/options.proto";

rpc CreateComment(CreateCommentRequest) returns (CreateCommentResponse) {
  option (google.api.http) = { post: "/comments" };
  option (fern.summary) = "Add a Comment";  // Custom display name
}

Changes:

  • Added extensions/fern/options.proto defining the custom option (field number 51001)
  • Generated Go code from the proto definition
  • Modified generator.go to read the fern.summary option and set it on the OpenAPI operation's Summary field
  • The option is read after building the operation but before merging generic Operation annotations

Review & Testing Checklist for Human

  • Verify option ordering is correct: The code reads fern.summary BEFORE merging the generic Operation annotation (line 765-770 vs 772-776). This means if both are set, the Operation annotation will override fern.summary. Is this the intended behavior, or should fern.summary take precedence?

  • Confirm field number 51001 is appropriate: Custom protobuf extensions should use field numbers in specific ranges. Verify that 51001 is in the correct range and doesn't conflict with other extensions.

  • Test end-to-end: While this was tested through the Fern CLI test suite, please test manually with a real proto file to ensure:

    • The option is correctly read from proto files
    • The summary appears in the generated OpenAPI YAML
    • The option works with buf dependencies (users need to import the proto file)
  • Consider adding unit tests: This PR has no tests in the protoc-gen-openapi repo itself. Should we add tests for the new functionality?

Notes

  • This PR is part of a larger feature to support custom endpoint display names in gRPC. The corresponding Fern CLI changes are in PR #10552.
  • The type assertion on line 767 (extFernSummary.(string)) is safe because protobuf extensions are strongly typed, but we could add better error handling if needed.
  • No validation is performed on the summary string (length, special characters, etc.). This matches the behavior of other OpenAPI fields.

Devin session: https://app.devin.ai/sessions/35ba7fe604104e64afe342a676df4463
Requested by: kenny@buildwithfern.com

- Add extensions/fern/options.proto defining custom summary option for RPC methods
- Generate Go code from options.proto
- Modify generator to read fern.summary option and set it as OpenAPI operation summary
- This allows users to explicitly set endpoint display names in gRPC proto files

Usage:
  import "fern/options.proto";

  rpc CreateComment(CreateCommentRequest) returns (CreateCommentResponse) {
    option (google.api.http) = { post: "/comments" };
    option (fern.summary) = "Add a Comment";
  }

The custom summary will be emitted as the OpenAPI operation's summary field,
which Fern CLI uses as the endpoint display name.

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot added a commit to fern-api/fern that referenced this pull request Nov 13, 2025
Temporarily pin CI to use the modified protoc-gen-openapi that supports
reading the custom fern.summary option. This allows the grpc-comments test
to pass with the custom summary 'Add a Comment'.

Once fern-api/protoc-gen-openapi#13 is merged and
released, this should be updated to use @latest or a tagged release.

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>
devin-ai-integration bot added a commit to fern-api/fern that referenced this pull request Nov 13, 2025
Update both ci.yml and bootstrap.sh to use the modified protoc-gen-openapi
that supports reading the custom fern.summary option from proto files.

This allows the grpc-comments test to pass with the custom summary
'Add a Comment' instead of the auto-generated 'Create Comment'.

Once fern-api/protoc-gen-openapi#13 is merged and
released, these should be updated to use @latest or a tagged release.

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>
@kennyderek kennyderek merged commit dc6f6fa into main Nov 13, 2025
1 check passed
kennyderek added a commit to fern-api/fern that referenced this pull request Nov 14, 2025
* test: add gRPC fixture with comments service

- Add grpc-comments fixture with proto configuration
- Create comments.proto with CreateComment RPC using google.api.http annotations
- Add test case to verify gRPC proto processing pipeline
- Generate FDR snapshots for regression testing

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>

* style: fix formatting in openapi-from-flag.test.ts

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>

* style: fix YAML formatting in grpc-comments generators.yml

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>

* feat(register): improve gRPC endpoint name display in FDR output

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>

* fix(register): correct TypeReference property access for endpoint naming

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>

* feat(cli): add support for custom fern.summary proto option

- Add fern/options.proto defining custom summary option for RPC methods
- Update grpc-comments fixture to use fern.summary option
- Custom summary 'Add a Comment' now appears in FDR output
- Remove unused grpc-gateway dependency from fixture

This allows users to explicitly set endpoint display names in gRPC proto files using:
option (fern.summary) = "Custom Name";

Requires protoc-gen-openapi to support reading the fern.summary option.

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>

* chore: pin protoc-gen-openapi to PR #13 commit for fern.summary support

Temporarily pin CI to use the modified protoc-gen-openapi that supports
reading the custom fern.summary option. This allows the grpc-comments test
to pass with the custom summary 'Add a Comment'.

Once fern-api/protoc-gen-openapi#13 is merged and
released, this should be updated to use @latest or a tagged release.

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>

* chore: pin CI to use protoc-gen-openapi PR #13 commit

Update both ci.yml and bootstrap.sh to use the modified protoc-gen-openapi
that supports reading the custom fern.summary option from proto files.

This allows the grpc-comments test to pass with the custom summary
'Add a Comment' instead of the auto-generated 'Create Comment'.

Once fern-api/protoc-gen-openapi#13 is merged and
released, these should be updated to use @latest or a tagged release.

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>

* fix: bump CLI version to 0.123.0 for feat type change

The changelog validator requires a minor version bump (0.122.1 -> 0.123.0)
for 'feat' type changes per semver rules. Changed from 0.122.2 to 0.123.0.

Co-Authored-By: kenny@buildwithfern.com <kenny@buildwithfern.com>

* tmp rm versions.yml

* test only

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: kenny@buildwithfern.com <kenny@buildwithfern.com>
Co-authored-by: Kenny Derek <pickypulsars@gmail.com>
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.

1 participant