-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Use a proto option to describe whether a Swagger Operation is de…
…precated. Issues: - This change breaks tests, uses possibly inappropriate package names etc. - 'deprecated' status of an operation should be determined by whether the proto method has been declared deprecated. - Previous way of declaring extra values using JSON prefixed with "OpenAPI: " in the comments has not been removed. - Extension for Swagger options has an arbitrary, but almost certainly wrong, identifier assigned to it. - Neither global API properties nor the main useful property on a swagger Operation, "externalDocs", are supported with this new method. - As a possible idea, we may want to support raw JSON in an option as well.
- Loading branch information
Showing
5 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax = "proto3"; | ||
|
||
package grpc_gateway.protoc_gen_swagger.options; | ||
|
||
import "protoc-gen-swagger/options/swagger.proto"; | ||
import "google/protobuf/descriptor.proto"; | ||
|
||
extend google.protobuf.MethodOptions { | ||
Operation swagger_operation = 123456789; // TODO(ivucica): how to determine ID? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
syntax = "proto3"; | ||
|
||
package grpc_gateway.protoc_gen_swagger.options; | ||
|
||
// `Operation` is a representation of Swagger specification's Operation object. | ||
// | ||
// See: http://swagger.io/specification/#operation-object-36 | ||
// | ||
// TODO(ivucica): document fields | ||
message Operation { | ||
repeated string tags = 1; | ||
string summary = 2; | ||
string description = 3; | ||
ExternalDocumentation external_docs = 4; | ||
string operation_id = 5; | ||
repeated string consumes = 6; | ||
repeated string produces = 7; | ||
// field 8 is reserved for 'parameters'. | ||
// field 9 is reserved for 'responses'. | ||
repeated string schemes = 10; | ||
bool deprecated = 11; | ||
// field 12 is reserved for 'security'. | ||
|
||
} | ||
|
||
// `ExternalDocumentation` is a representation of Swagger specification's | ||
// ExternalDocumentation object. | ||
// | ||
// See: http://swagger.io/specification/#external-documentation-object-40 | ||
// | ||
// TODO(ivucica): document fields | ||
message ExternalDocumentation { | ||
string description = 1; | ||
string url = 2; | ||
} |