Skip to content

Instantly share code, notes, and snippets.

@btpnlsl
Created July 11, 2025 18:55
Show Gist options
  • Select an option

  • Save btpnlsl/abb323ab06a638feddaa2c55a143c8e7 to your computer and use it in GitHub Desktop.

Select an option

Save btpnlsl/abb323ab06a638feddaa2c55a143c8e7 to your computer and use it in GitHub Desktop.
webflux-file-upload
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>webflux-file-upload</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<kotlin.version>1.9.10</kotlin.version>
<spring.boot.version>3.2.5</spring.boot.version>
<openapi-generator.version>7.14.0</openapi-generator.version>
<swagger-annotations.version>2.2.20</swagger-annotations.version>
<springdoc.version>2.3.0</springdoc.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<!-- This makes sure the versions of various spring stuff (boot, test, mvc, etc) are all in sync -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<!-- Language feature support -->
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</dependency>
<dependency>
<!-- Kotlin coroutine support -->
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
</dependency>
<dependency>
<!-- Helpers for adapting coroutines to Reactor methods -->
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-reactor</artifactId>
</dependency>
<dependency>
<!-- Enable Spring Boot, selecting the reactive webserver architecture (WebFlux) -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<!-- Enable Spring Boot, selecting the reactive webserver architecture (WebFlux) -->
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<!-- Helper extensions for using Reactor (WebFlux) in Kotlin -->
<groupId>io.projectreactor.kotlin</groupId>
<artifactId>reactor-kotlin-extensions</artifactId>
</dependency>
<dependency>
<!-- Annotations used to mark up generated code -->
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
</plugin>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi-spec.yaml</inputSpec>
<generatorName>kotlin-spring</generatorName>
<library>spring-boot</library>
<generateApiTests>false</generateApiTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelTests>false</generateModelTests>
<generateModelDocumentation>false</generateModelDocumentation>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<useSpringBoot3>true</useSpringBoot3>
<reactive>true</reactive>
<serviceInterface>true</serviceInterface>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Includes the generated code in the build -->
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<!-- Where to find the generated code -->
<sourceDir>${project.build.directory}/generated-sources/openapi/src/main/kotlin/org/openapitools/api</sourceDir>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
openapi: 3.0.1
info:
title: webflux-file-upload
description: Test service for file upload with webflux
version: 0.0.1
paths:
/upload:
post:
summary: uploads a file
operationId: uploadFile
tags:
- upload
description: upload a file
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
description: file to upload
responses:
201:
description: upload was successful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment