openapi-generator with spring-boot, remove generated values

Viewed 2109

I'm using openapi-generator for gradle.

Config:

task generateSalesOffersApi(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
    generatorName = "spring"
    inputSpec = "${projectDir}/src/main/resources/my-contract.yaml".toString()
    outputDir = "${buildDir}/generated".toString()
    additionalProperties = [
            interfaceOnly: 'true',
            reactive: 'true',
            skipDefaultInterface: "true",
            implicitHeaders: "true",
    ]

    configOptions = [
            dateLibrary: 'java8',
            swaggerDocketConfig: "true",
            useTags:  'false',
            apiPackage: 'com.data.api',
            modelPackage: 'com.data.model',
    ]

    systemProperties = [
            apis: "",
            models: "",
            hideGenerationTimestamp: "true"
    ]

The models are generated as expected. Api part mostly too.

But how to get rid of ResponseEntity wrapping and ServerWebExchange as method param in generated interfaces.

Actual:

Mono<ResponseEntity<MyPojo>> getMyPojo(@ApiParam(value = "Param 1",required=true) @PathVariable("param1") String param1, ServerWebExchange exchange);

Expected:

Mono<MyPojo> getMyPojo(@ApiParam(value = "Param 1",required=true) @PathVariable("param1") String param1);

I tried to use the java generator where you can set the library to webclient, but unfortunately this was missing a lot of configuration for me and was generating many unnecessary classes.

1 Answers
Related