forked from loafle/openapi-generator-original
Issue-7438 Fix that prevents generating interfaces when interfaceOnly is false. (#7439)
This commit is contained in:
parent
9e1bbe0c1c
commit
5ea3d3bb18
@ -85,6 +85,9 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
|||||||
}
|
}
|
||||||
if (additionalProperties.containsKey(INTERFACE_ONLY)) {
|
if (additionalProperties.containsKey(INTERFACE_ONLY)) {
|
||||||
interfaceOnly = Boolean.valueOf(additionalProperties.get(INTERFACE_ONLY).toString());
|
interfaceOnly = Boolean.valueOf(additionalProperties.get(INTERFACE_ONLY).toString());
|
||||||
|
if (!interfaceOnly) {
|
||||||
|
additionalProperties.remove(INTERFACE_ONLY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (interfaceOnly) {
|
if (interfaceOnly) {
|
||||||
// Change default artifactId if genereating interfaces only, before command line options are applied in base class.
|
// Change default artifactId if genereating interfaces only, before command line options are applied in base class.
|
||||||
|
@ -74,4 +74,18 @@ public class JavaJAXRSSpecServerCodegenTest {
|
|||||||
}
|
}
|
||||||
Assert.fail("Missing " + JavaJAXRSSpecServerCodegen.INTERFACE_ONLY);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user