Skip to content

Commit

Permalink
Merge pull request grpc-ecosystem#133 from ivucica/swagger_defs_type_…
Browse files Browse the repository at this point in the history
…object

Swagger definitions now have `type` set to `object`.
  • Loading branch information
yugui committed Apr 19, 2016
2 parents c080463 + 7c0125f commit 6c680f2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,6 @@ realclean: distclean
rm -f $(EXAMPLE_GWSRCS)
rm -f $(EXAMPLE_SWAGGERSRCS)
rm -f $(GO_PLUGIN)
rm -f $(SWAGGER_PLUGIN)

.PHONY: generate examples test clean distclean realclean
1 change: 1 addition & 0 deletions examples/examplepb/echo_service.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
},
"definitions": {
"examplepbSimpleMessage": {
"type": "object",
"properties": {
"id": {
"type": "string",
Expand Down
8 changes: 7 additions & 1 deletion examples/examplepb/streamless_everything.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
},
"definitions": {
"ABitOfEverythingNested": {
"type": "object",
"properties": {
"amount": {
"type": "integer",
Expand All @@ -362,6 +363,7 @@
"default": "FALSE"
},
"examplepbABitOfEverything": {
"type": "object",
"properties": {
"bool_value": {
"type": "boolean",
Expand Down Expand Up @@ -441,8 +443,11 @@
}
}
},
"examplepbEmptyMessage": {},
"examplepbEmptyMessage": {
"type": "object"
},
"examplepbIdMessage": {
"type": "object",
"properties": {
"uuid": {
"type": "string",
Expand All @@ -459,6 +464,7 @@
"default": "ZERO"
},
"subStringMessage": {
"type": "object",
"properties": {
"value": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions protoc-gen-swagger/genswagger/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func findNestedMessagesAndEnumerations(message *descriptor.Message, reg *descrip
func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, reg *descriptor.Registry) {
for _, msg := range messages {
object := swaggerSchemaObject{
Type: "object",
Properties: map[string]swaggerSchemaObject{},
}
for _, field := range msg.Fields {
Expand Down

0 comments on commit 6c680f2

Please sign in to comment.