Skip to content

Commit

Permalink
Remove extensions from Schema
Browse files Browse the repository at this point in the history
As they are already included in JSONSchema
  • Loading branch information
james-o-johnstone committed Nov 16, 2021
1 parent b0e52fa commit 615922e
Show file tree
Hide file tree
Showing 28 changed files with 828 additions and 858 deletions.
2 changes: 1 addition & 1 deletion examples/internal/helloworld/helloworld.pb.go

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

1,118 changes: 559 additions & 559 deletions examples/internal/proto/examplepb/a_bit_of_everything.pb.go

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions examples/internal/proto/examplepb/a_bit_of_everything.proto
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,18 @@ message ABitOfEverything {
title: "A bit of everything"
description: "Intentionaly complicated message type to cover many features of Protobuf."
required: ["uuid", "int64_value", "double_value"]
extensions: {
key: "x-a-bit-of-everything-foo";
value {
string_value: "bar";
}
}
}
external_docs: {
url: "https://github.com/grpc-ecosystem/grpc-gateway";
description: "Find out more about ABitOfEverything";
}
example: "{\"int64_value\": 12, \"double_value\": 12.3}"
extensions: {
key: "x-a-bit-of-everything-foo";
value {
string_value: "bar";
}
}
};

// Nested is nested type.
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/echo_service.pb.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/flow_combination.pb.go

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

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/non_standard_names.pb.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/openapi_merge_a.pb.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/openapi_merge_b.pb.go

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

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/stream.pb.go

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

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/use_go_template.pb.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/examplepb/wrappers.pb.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/pathenum/path_enum.pb.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/sub/message.pb.go

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

2 changes: 1 addition & 1 deletion examples/internal/proto/sub2/message.pb.go

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

2 changes: 1 addition & 1 deletion internal/descriptor/apiconfig/apiconfig.pb.go

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

2 changes: 1 addition & 1 deletion internal/descriptor/openapiconfig/openapiconfig.pb.go

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

8 changes: 0 additions & 8 deletions protoc-gen-openapiv2/internal/genopenapi/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -2269,14 +2269,6 @@ func openapiSchemaFromProtoSchema(s *openapi_options.Schema, reg *descriptor.Reg
ret.Example = json.RawMessage(s.Example)
}

if s != nil && s.Extensions != nil {
exts, err := processExtensions(s.Extensions)
if err != nil {
panic(err)
}
ret.extensions = exts
}

return ret
}

Expand Down
6 changes: 4 additions & 2 deletions protoc-gen-openapiv2/internal/genopenapi/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1404,8 +1404,10 @@ func TestApplyTemplateExtensions(t *testing.T) {
},
}
openapiSchema := openapi_options.Schema{
Extensions: map[string]*structpb.Value{
"x-schema-foo": {Kind: &structpb.Value_StringValue{StringValue: "baz"}},
JsonSchema: &openapi_options.JSONSchema{
Extensions: map[string]*structpb.Value{
"x-schema-foo": {Kind: &structpb.Value_StringValue{StringValue: "baz"}},
},
},
}
verifyTemplateExtensions := func(t *testing.T, reg *descriptor.Registry, file *descriptor.File,
Expand Down
2 changes: 1 addition & 1 deletion protoc-gen-openapiv2/options/annotations.pb.go

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

Loading

0 comments on commit 615922e

Please sign in to comment.