Skip to content

Commit

Permalink
Issue-7438 Fix that prevents generating interfaces when interfaceOnly…
Browse files Browse the repository at this point in the history
… is false. (swagger-api#7439)
  • Loading branch information
jarlesat authored and viclovsky committed Jan 23, 2018
1 parent 8af6fa3 commit f9b1aa7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public void processOpts()
}
if (additionalProperties.containsKey(INTERFACE_ONLY)) {
interfaceOnly = Boolean.valueOf(additionalProperties.get(INTERFACE_ONLY).toString());
if (!interfaceOnly) {
additionalProperties.remove(INTERFACE_ONLY);
}
}
if (interfaceOnly) {
// Change default artifactId if genereating interfaces only, before command line options are applied in base class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,18 @@ public void verify_that_interfaceOnly_exists_as_a_parameter_with_default_false()
}
Assert.fail("Missing " + JavaJAXRSSpecServerCodegen.INTERFACE_ONLY);
}

@Test
public void verify_that_interfaceOnly_is_removed_from_additional_properties_if_false() {
generator.additionalProperties().put(JavaJAXRSSpecServerCodegen.INTERFACE_ONLY, Boolean.FALSE.toString());
generator.processOpts();
Assert.assertFalse(generator.additionalProperties().containsKey(JavaJAXRSSpecServerCodegen.INTERFACE_ONLY));
}

@Test
public void verify_that_interfaceOnly_is_preserved_in_additional_properties_if_true() {
generator.additionalProperties().put(JavaJAXRSSpecServerCodegen.INTERFACE_ONLY, Boolean.TRUE.toString());
generator.processOpts();
Assert.assertTrue(generator.additionalProperties().containsKey(JavaJAXRSSpecServerCodegen.INTERFACE_ONLY));
}
}

0 comments on commit f9b1aa7

Please sign in to comment.