From d0713ed33125c3e9a54e86cfabdd1d5700380f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Vu=C4=8Dica?= Date: Sun, 8 May 2016 00:04:32 +0100 Subject: [PATCH] Change from 'Swagger: ' to 'OpenAPI: ' prefix. --- examples/examplepb/echo_service.pb.go | 8 ++++---- examples/examplepb/echo_service.proto | 6 +++--- protoc-gen-swagger/genswagger/template.go | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 54eb9da7ddd..e9a8b002485 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -10,7 +10,7 @@ Echo Service Echo Service API consists of a single service which returns a message. -Swagger: { +OpenAPI: { "info": { "title": "Echo Service", "version": "1.0", @@ -65,7 +65,7 @@ const _ = proto.ProtoPackageIsVersion1 // SimpleMessage represents a simple message sent to the Echo service. // -// Swagger: { +// OpenAPI: { // "externalDocs": { // "url": "http://github.com/gengo/grpc-gateway", // "description": "Find out more about EchoService" @@ -101,7 +101,7 @@ type EchoServiceClient interface { // The message posted as the id parameter will also be // returned. // - // Swagger: { + // OpenAPI: { // "externalDocs": { // "url": "http://github.com/gengo/grpc-gateway", // "description": "Find out more about EchoService" @@ -146,7 +146,7 @@ type EchoServiceServer interface { // The message posted as the id parameter will also be // returned. // - // Swagger: { + // OpenAPI: { // "externalDocs": { // "url": "http://github.com/gengo/grpc-gateway", // "description": "Find out more about EchoService" diff --git a/examples/examplepb/echo_service.proto b/examples/examplepb/echo_service.proto index 3da0087eecb..4a90bbe0845 100644 --- a/examples/examplepb/echo_service.proto +++ b/examples/examplepb/echo_service.proto @@ -6,7 +6,7 @@ option go_package = "examplepb"; // Echo Service API consists of a single service which returns // a message. // -// Swagger: { +// OpenAPI: { // "info": { // "title": "Echo Service", // "version": "1.0", @@ -28,7 +28,7 @@ import "google/api/annotations.proto"; // SimpleMessage represents a simple message sent to the Echo service. // -// Swagger: { +// OpenAPI: { // "externalDocs": { // "url": "http://github.com/gengo/grpc-gateway", // "description": "Find out more about EchoService" @@ -46,7 +46,7 @@ service EchoService { // The message posted as the id parameter will also be // returned. // - // Swagger: { + // OpenAPI: { // "externalDocs": { // "url": "http://github.com/gengo/grpc-gateway", // "description": "Find out more about EchoService" diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index f012d3460ab..4d35e6f51e9 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -552,7 +552,7 @@ func applyTemplate(p param) (string, error) { // // To apply additional Swagger properties, one can pass valid JSON // in the last paragraph of the comment. The last paragraph needs to start -// with the string 'Swagger: '. This JSON gets parsed and applied to +// with the string 'OpenAPI: '. This JSON gets parsed and applied to // the passed swaggerObject directly. This lets developers easily apply // custom properties such as contact details, API base path, et al. func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) error { @@ -582,8 +582,8 @@ func updateSwaggerDataFromComments(swaggerObject interface{}, comment string) er // TODO(ivucica): apply extras /after/ applying summary // and description. paragraphs := strings.Split(comment, "\n\n") - if len(paragraphs) > 0 && strings.HasPrefix(strings.TrimLeft(paragraphs[len(paragraphs)-1], " "), "Swagger: ") { - if err := json.Unmarshal([]byte(strings.TrimLeft(paragraphs[len(paragraphs)-1], " "))[len("Swagger: "):], swaggerObject); err != nil { + if len(paragraphs) > 0 && strings.HasPrefix(strings.TrimLeft(paragraphs[len(paragraphs)-1], " "), "OpenAPI: ") { + if err := json.Unmarshal([]byte(strings.TrimLeft(paragraphs[len(paragraphs)-1], " "))[len("OpenAPI: "):], swaggerObject); err != nil { return fmt.Errorf("error: %s, parsing: %s", err.Error(), paragraphs[len(paragraphs)-1]) } paragraphs = paragraphs[:len(paragraphs)-1]