Skip to content

Commit

Permalink
openapi2_conv: include ExternalDocs prop when converting to v3 (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitforbit authored Jul 7, 2020
1 parent d5e00c2 commit f094a75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openapi2conv/openapi2_conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func ToV3Swagger(swagger *openapi2.Swagger) (*openapi3.Swagger, error) {
Components: openapi3.Components{},
Tags: swagger.Tags,
ExtensionProps: swagger.ExtensionProps,
ExternalDocs: swagger.ExternalDocs,
}
host := swagger.Host
if len(host) > 0 {
Expand Down Expand Up @@ -362,6 +363,7 @@ func FromV3Swagger(swagger *openapi3.Swagger) (*openapi2.Swagger, error) {
Responses: resultResponses,
Tags: swagger.Tags,
ExtensionProps: swagger.ExtensionProps,
ExternalDocs: swagger.ExternalDocs,
}

isHTTPS := false
Expand Down
8 changes: 8 additions & 0 deletions openapi2conv/openapi2_conv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const exampleV2 = `
"schemes": ["https"],
"host": "test.example.com",
"basePath": "/v2",
"externalDocs": {
"url": "https://example/doc/",
"description": "Example Documentation"
},
"tags": [
{
"name": "Example",
Expand Down Expand Up @@ -229,6 +233,10 @@ const exampleV3 = `
"x-root2": "root extension 2",
"openapi": "3.0.2",
"info": {"title":"MyAPI","version":"0.1","x-info":"info extension"},
"externalDocs": {
"url": "https://example/doc/",
"description": "Example Documentation"
},
"components": {
"responses": {
"ForbiddenError": {
Expand Down

0 comments on commit f094a75

Please sign in to comment.