Skip to content

Commit

Permalink
Merge pull request #147 from gengo/feature/map-swagger
Browse files Browse the repository at this point in the history
Support map types in swagger generator
  • Loading branch information
yugui committed May 9, 2016
2 parents ad33b2f + 4fa18b9 commit 8205819
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 268 deletions.
157 changes: 89 additions & 68 deletions examples/examplepb/a_bit_of_everything.pb.go

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

4 changes: 3 additions & 1 deletion examples/examplepb/a_bit_of_everything.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ message ABitOfEverything {
sint32 sint32_value = 17;
sint64 sint64_value = 18;
repeated string repeated_string_value = 19;

oneof oneof_value {
EmptyMessage oneof_empty = 20;
string oneof_string = 21;
}

map<string, NumericEnum> map_value = 22;
map<string, string> mapped_string_value = 23;
map<string, Nested> mapped_nested_value = 24;
}

message EmptyMessage {
Expand Down
8 changes: 8 additions & 0 deletions examples/examplepb/streamless_everything.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ message ABitOfEverything {
sint32 sint32_value = 17;
sint64 sint64_value = 18;
repeated string repeated_string_value = 19;
oneof oneof_value {
EmptyMessage oneof_empty = 20;
string oneof_string = 21;
}

map<string, NumericEnum> map_value = 22;
map<string, string> mapped_string_value = 23;
map<string, Nested> mapped_nested_value = 24;
}

message EmptyMessage {
Expand Down
26 changes: 26 additions & 0 deletions examples/examplepb/streamless_everything.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,38 @@
"type": "integer",
"format": "int64"
},
"map_value": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/examplepbNumericEnum"
}
},
"mapped_nested_value": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ABitOfEverythingNested"
}
},
"mapped_string_value": {
"type": "object",
"additionalProperties": {
"type": "string",
"format": "string"
}
},
"nested": {
"type": "array",
"items": {
"$ref": "#/definitions/ABitOfEverythingNested"
}
},
"oneof_empty": {
"$ref": "#/definitions/examplepbEmptyMessage"
},
"oneof_string": {
"type": "string",
"format": "string"
},
"repeated_string_value": {
"type": "array",
"items": {
Expand Down
Loading

0 comments on commit 8205819

Please sign in to comment.