Skip to content

Commit

Permalink
protoc-gen-swagger: output https first in schemas key
Browse files Browse the repository at this point in the history
Workaround for grpc-ecosystem#161
  • Loading branch information
edrex committed Aug 12, 2016
1 parent a8f25bd commit 79981f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion protoc-gen-swagger/genswagger/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ func applyTemplate(p param) (string, error) {
s := swaggerObject{
// Swagger 2.0 is the version of this document
Swagger: "2.0",
Schemes: []string{"http", "https"},
Schemes: []string{"https", "http"},
Consumes: []string{"application/json"},
Produces: []string{"application/json"},
Paths: make(swaggerPathsObject),
Expand Down
4 changes: 2 additions & 2 deletions protoc-gen-swagger/genswagger/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestApplyTemplateSimple(t *testing.T) {
if want, is, name := "", got.BasePath, "BasePath"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want)
}
if want, is, name := []string{"http", "https"}, got.Schemes, "Schemes"; !reflect.DeepEqual(is, want) {
if want, is, name := []string{"https", "http"}, got.Schemes, "Schemes"; !reflect.DeepEqual(is, want) {
t.Errorf("applyTemplate(%#v).%s = %s want to be %s", file, name, is, want)
}
if want, is, name := []string{"application/json"}, got.Consumes, "Consumes"; !reflect.DeepEqual(is, want) {
Expand Down Expand Up @@ -261,7 +261,7 @@ func TestApplyTemplateRequestWithoutClientStreaming(t *testing.T) {
if want, got := "", obj.BasePath; !reflect.DeepEqual(got, want) {
t.Errorf("applyTemplate(%#v).BasePath = %s want to be %s", file, got, want)
}
if want, got := []string{"http", "https"}, obj.Schemes; !reflect.DeepEqual(got, want) {
if want, got := []string{"https", "http"}, obj.Schemes; !reflect.DeepEqual(got, want) {
t.Errorf("applyTemplate(%#v).Schemes = %s want to be %s", file, got, want)
}
if want, got := []string{"application/json"}, obj.Consumes; !reflect.DeepEqual(got, want) {
Expand Down

0 comments on commit 79981f8

Please sign in to comment.