I have to generate code from yaml file, in my swagger maven plugin I put :
<configOptions>
<java8>true</java8>
<sourceFolder>src/main/java</sourceFolder>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8</dateLibrary>
<singleContentTypes>true</singleContentTypes>
</configOptions>
even if it says iinterfaceOnly>true however the codegen generate an interface with default implementation as follow:
@ApiOperation(value = "", nickname = "billetsFichiersHealthGet", notes = "Obtient l'état de santé de l'API. ", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 200, message = "Erreur", response = Error.class) })
@RequestMapping(value = "/bills/health",
produces = "application/json",
consumes = "",
method = RequestMethod.GET)
default ResponseEntity<Void> billetsFichiersHealthGet() {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default BilletsApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
How can I disable generation of default interface method and just have definition in interface and not default implementation.
When I remove the following two tags it works
<java8>true</java8>
<dateLibrary>java8</dateLibrary>
However my models are using localdatetime and so I should be on java8 and cant remove these two tags really
Any Idea ?
Please try:
<configOptions>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<defaultInterfaces>false</defaultInterfaces>
</configOptions>
https://github.com/swagger-api/swagger-codegen/issues/8833
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With