How to hide type of model in swagger with springfox?

22 views Asked by At

I have rest controller and method below

    @PostMapping(value = /createNewCredit, produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<NewCreditResponse> createNewCredit(
 @Valid @RequestBody CreateNewCreditRequest request,
 @RequestHeader(value = HttpHeaders.AUTHORIZATION) String token) {
        ResponseEntity<NewCreditResponse> response = ok(
                creditService.createCredit(request, token));
        return response;
    }

I have DTO below

@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class CreateNewCreditRequest {
//some fields
}

in swagger i have output what i have

All I want is to remove the output of this 'type: object' so that it does not end up in the swagger.yaml autogeneration and so that the line is not shown to me in the interface, and I could also send any values (this is the final goal) to the request body, but keeping application/ json. How to do it in java code?

what i need

my dependecies

<dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>1.6.3</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>

I tried many ways but nothing worked

0

There are 0 answers