Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cmd/protoc-gen-openapi/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
any_pb "google.golang.org/protobuf/types/known/anypb"

wk "github.com/fern-api/protoc-gen-openapi/cmd/protoc-gen-openapi/generator/wellknown"
fernoptions "github.com/fern-api/protoc-gen-openapi/extensions/fern"
v3 "github.com/fern-api/protoc-gen-openapi/openapiv3"
)

Expand Down Expand Up @@ -761,6 +762,13 @@ func (g *OpenAPIv3Generator) addPathsToDocumentV3(d *v3.Document, services []*pr
op, path2 := g.buildOperationV3(
d, operationID, service.GoName, comment, defaultHost, path, body, inputMessage, outputMessage)

extFernSummary := proto.GetExtension(method.Desc.Options(), fernoptions.E_Summary)
if extFernSummary != nil {
if summary, ok := extFernSummary.(string); ok && summary != "" {
op.Summary = summary
}
}

// Merge any `Operation` annotations with the current
extOperation := proto.GetExtension(method.Desc.Options(), v3.E_Operation)
if extOperation != nil {
Expand Down Expand Up @@ -1179,4 +1187,4 @@ func (g *OpenAPIv3Generator) addOneOfFieldsToSchema(d *v3.Document, oneofs []*pr
},
)
}
}
}
85 changes: 85 additions & 0 deletions extensions/fern/options.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions extensions/fern/options.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

package fern;

import "google/protobuf/descriptor.proto";

option go_package = "github.com/fern-api/protoc-gen-openapi/extensions/fern";

extend google.protobuf.MethodOptions {
// Custom summary for the RPC method that will be used as the OpenAPI operation summary.
// This overrides any auto-generated summary.
string summary = 51001;
}