Skip to content

Commit e0001fe

Browse files
feat: path (method & service) generation
1 parent 5e38f8c commit e0001fe

File tree

5 files changed

+546
-70
lines changed

5 files changed

+546
-70
lines changed

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require (
88
github.com/google/go-cmp v0.7.0
99
github.com/rogpeppe/fastuuid v1.2.0
1010
go.yaml.in/yaml/v3 v3.0.4
11+
github.com/stretchr/testify v1.9.0
1112
golang.org/x/oauth2 v0.30.0
1213
golang.org/x/text v0.28.0
1314
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c
@@ -21,6 +22,7 @@ require (
2122
golang.org/x/net v0.41.0 // indirect
2223
golang.org/x/sys v0.33.0 // indirect
2324
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
25+
github.com/davecgh/go-spew v1.1.1 // indirect
2426
github.com/go-openapi/jsonpointer v0.21.0 // indirect
2527
github.com/go-openapi/swag v0.23.0 // indirect
2628
github.com/josharian/intern v1.0.0 // indirect
@@ -29,6 +31,7 @@ require (
2931
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect
3032
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect
3133
github.com/perimeterx/marshmallow v1.1.5 // indirect
34+
github.com/pmezard/go-difflib v1.0.0 // indirect
3235
golang.org/x/net v0.37.0 // indirect
3336
golang.org/x/sys v0.31.0 // indirect
3437
)

internal/descriptor/registry.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ type Registry struct {
181181

182182
// generateXGoType is a global generator option for generating x-go-type annotations
183183
generateXGoType bool
184+
185+
// indicates how the one ofs are handled
186+
oneOfStrategy string
184187
}
185188

186189
type repeatedFieldSeparator struct {
@@ -930,3 +933,11 @@ func (r *Registry) SetGenerateXGoType(generateXGoType bool) {
930933
func (r *Registry) GetGenerateXGoType() bool {
931934
return r.generateXGoType
932935
}
936+
937+
func (r *Registry) SetOneOfStrategy(oneOfStrategy string) {
938+
r.oneOfStrategy = oneOfStrategy
939+
}
940+
941+
func (r *Registry) GetOneOfStrategy() string {
942+
return r.oneOfStrategy
943+
}

protoc-gen-openapiv3/internal/genopenapiv3/file_options.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import (
99

1010
func (g *generator) extractFileOptions(target *descriptor.File) (*openapi3.T, bool) {
1111
if openAPIAno := proto.GetExtension(target.GetOptions(), options.E_Openapiv3Document).(*options.OpenAPI); openAPIAno != nil {
12-
doc := &openapi3.T{}
12+
doc := &openapi3.T{
13+
OpenAPI: "3.0.2",
14+
}
1315
doc.Info = g.extractInfo(openAPIAno.GetInfo())
1416
// TODO: implement other openapi file annotation fields
1517
return doc, true

0 commit comments

Comments
 (0)