Page tree
Skip to end of metadata
Go to start of metadata

OpenAPI 3


Designing a Yaml using

Spring boot openapi generator

Generate Spring Boot Controller from Openapi yaml

Implement ApiDelegateImpl Service

The default method on the generated service delegate will generate an HttpStatus.NOT_IMPLEMENTED response.  This response will allow for a minimal runtime/swagger.  It is up to the developer (us) to provide a custom implementation of the service - which spring will find and inject.  We override the default method.

public class HealthApiDelegateService implements HealthApiDelegate {

	public ResponseEntity<Health> health() {
		Health health = new Health();
		return ResponseEntity.ok(health);

Add Swagger 2 to an existing Maven Java project


REF-15 - Getting issue details... STATUS

Add the following to your pom.xml


Add the following Spring Configuration bean to your Spring Boot project

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

public class SwaggerConfig {
	public Docket api() {
		return new Docket(DocumentationType.SWAGGER_2)

Test swagger live site


Swagger Live Generation and Servlet Filters

Be careful when running filters on all incoming content - as it will disrupt the live swagger site.  For example

import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

public class Base64Filter implements Filter {

Exporting Swagger to OpenAPI 3

Exporting JAXB to OpenAPI 3

Json Schemas



  • No labels