Skip to content

Commit

Permalink
Merge pull request #969 from OpenAPITools/fix_vendor_extension
Browse files Browse the repository at this point in the history
Fix missing top level extensions in OAS v2 spec
  • Loading branch information
gracekarina authored Dec 19, 2018
2 parents 6b8215b + f079abc commit 339e5df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public SwaggerParseResult convert(SwaggerDeserializationResult parse) {

Swagger swagger = parse.getSwagger();

if (swagger.getVendorExtensions() != null) {
openAPI.setExtensions(convert(swagger.getVendorExtensions()));
}

if (swagger.getExternalDocs() != null) {
openAPI.setExternalDocs(convert(swagger.getExternalDocs()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,13 @@ public void testIssue755() throws Exception {
final OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_755_YAML);
assertNotNull(oas);
}

@Test(description = "OpenAPI v2 converter - top-level extensions should be preserved")
public void testTopLevelExtensions() throws Exception {
final OpenAPI oas = getConvertedOpenAPIFromJsonFile(PARAMETER_CONVERSION_JSON);
assertNotNull(oas);
assertEquals((String)oas.getExtensions().get("x-some-extensions"), "hello");
}

@Test(description = "OpenAPI v2 converter - Conversion param extensions should be preserved")
public void testIssue820() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"swagger": "2.0",
"x-some-extensions": "hello",
"info": {
"version": "1.0",
"title": "x-example"
Expand Down

0 comments on commit 339e5df

Please sign in to comment.