How to add button for file upload in swagger-ui (spring doc) which accepts Flux

I use spring doc 1.6.12:

<spring-doc.version>1.6.12</spring-doc.version>
...
<dependency>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-webmvc-core</artifactId>
  <version>${spring-doc.version}</version>
</dependency>
<dependency>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-webflux-ui</artifactId>
  <version>${spring-doc.version}</version>
</dependency>
<dependency>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-data-rest</artifactId>
  <version>${spring-doc.version}</version>
</dependency>
<dependency>
  <groupId>org.springdoc</groupId>
  <artifactId>springdoc-openapi-security</artifactId>
  <version>${spring-doc.version}</version>
</dependency>

I have following controller method:

  @PostMapping(produces = "application/hal+json")
  @ResponseStatus(code = HttpStatus.CREATED)
  public Mono<ResponseEntity<MyDTO>> upload(
      @RequestBody Flux<ByteBuffer> data,
      @RequestHeader(name = CONTENT_LENGTH) long contentLength,
      @RequestHeader(name = CONTENT_TYPE, required = false) MediaType contentType,
      @RequestHeader(name = CONTENT_DISPOSITION) @ContentDispositionConstraint ContentDisposition contentDisposition,
      @RequestParam(name = "archive", required = false, defaultValue = "false") boolean archive,
      @RequestParam(name = "folder", required = false) @Pattern(regexp = FOLDER_PATTERN) String folder,
      @RequestParam(name = "folderOwner", required = false) String folderOwner,
      @RequestParam(value = "folderUuid", required = false) UUID folderUuid,
      @RequestParam(name = "expirationDate", required = false) Instant expirationDate,
      JwtAuthenticationToken jwtToken,
      ServerHttpRequest request) {

In swagger ui I see:

enter image description here

So I have no button to upload file. Is there way to acheve it ?

P.S.

If I change

@RequestBody Flux<ByteBuffer> data

to

@RequestPart ("file") MultipartFile data,

I see the upload button in swagger but underlying code depends on Flux<ByteBuffer> data so I don't wanna change it.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation