Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom options to allow more control of swagger/openapi output #145

Merged
merged 26 commits into from
Nov 3, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6ff06d8
Apply additional Swagger properties using JSON.
ivucica May 7, 2016
fcc2dca
Swagger: Replaced '<!-- ... -->' for raw JSON with last paragraph 'Sw…
ivucica May 7, 2016
20a6d40
Change from 'Swagger: ' to 'OpenAPI: ' prefix.
ivucica May 7, 2016
321663d
WIP: Use a proto option to describe whether a Swagger Operation is de…
ivucica Feb 13, 2017
7043966
WIP: Setting API properties through an option.
ivucica Mar 7, 2017
cdc1094
WIP: Correctly reserve fields. Update link. TODO: merge with commit M…
ivucica Oct 27, 2017
41b436f
WIP: Refer to the specification as OpenAPI v2, not Swagger.
ivucica Oct 27, 2017
74cd394
WIP: Clean up after OpenAPIv2 options proto generation.
ivucica Oct 27, 2017
549ccee
WIP: JSON is disappearing from the output protos.
ivucica Oct 27, 2017
6b2b321
WIP: Fix typo 'want an Swagger' -> 'want a Swagger object'.
ivucica Oct 27, 2017
db4a056
WIP: Process all remaining fields of the OpenAPI v2 Swagger object.
ivucica Oct 27, 2017
7697bcf
WIP: ExternalDocs belongs on OpenAPIv2's Swagger object, not on the I…
ivucica Oct 27, 2017
162c375
WIP: Remove use of JSON. Introduce schema and tag object. Support ext…
ivucica Oct 28, 2017
b53579c
WIP: Add built annotations.pb.go and openapiv2.pb.go.
ivucica Oct 28, 2017
60d116f
WIP: go fmt on protoc-gen-swagger.
ivucica Oct 28, 2017
d509096
WIP: Provide a more unique operation ID in case of additional bindings.
ivucica Oct 28, 2017
3949620
WIP: Try to fix integration test by removing 'host' from the Swagger …
ivucica Oct 28, 2017
a386e97
WIP: Remove swaggerExtrasRegexp.
ivucica Oct 29, 2017
290f777
WIP: Move error checking for extractSchemaOptionFromMessageDescriptor…
ivucica Oct 29, 2017
97ee19b
WIP: Fix typo: 'want a Schema'.
ivucica Oct 29, 2017
ceb4c4e
Assign IDs for proto options extensions.
ivucica Nov 1, 2017
099fda5
Move test definitions for options-based extension to Swagger output f…
ivucica Nov 1, 2017
d7b0ba4
Undo commenting out dependency on EXAMPLE_CLIENT_SRCS.
ivucica Nov 2, 2017
d7a9a69
Change the proto package to start with 'grpc.gateway', as seems to be…
ivucica Nov 2, 2017
84c3046
Add a comment about all IDs being ok to be the same.
ivucica Nov 2, 2017
a543b9e
Regenerated Swagger-generated clients.
ivucica Nov 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 29 additions & 30 deletions protoc-gen-swagger/options/annotations.pb.go

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

16 changes: 8 additions & 8 deletions protoc-gen-swagger/options/annotations.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import "protoc-gen-swagger/options/openapiv2.proto";
import "google/protobuf/descriptor.proto";

extend google.protobuf.FileOptions {
// TODO(ivucica): ask protobuf-global-extension-registry@google.com to assign ID
Swagger openapiv2_swagger = 123456788;
// ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a note on why they are all the same ID and why that is okay?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Swagger openapiv2_swagger = 1042;
}
extend google.protobuf.MethodOptions {
// TODO(ivucica): ask protobuf-global-extension-registry@google.com to assign ID
Operation openapiv2_operation = 123456789;
// ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project.
Operation openapiv2_operation = 1042;
}
extend google.protobuf.MessageOptions {
// TODO(ivucica): ask protobuf-global-extension-registry@google.com to assign ID
Schema openapiv2_schema = 123456790;
// ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project.
Schema openapiv2_schema = 1042;
}
extend google.protobuf.ServiceOptions {
// TODO(ivucica): ask protobuf-global-extension-registry@google.com to assign ID
Tag openapiv2_tag = 123456791;
// ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project.
Tag openapiv2_tag = 1042;
}