3.0.0
Changelog
- Java 11+ required
- Update dependencies
- Upgrade Swagger/OpenAPI
Upgrade instructions from 2.x to 3.x
- At least Java 11 is required
- If you are using Plume Admin, you will need to follow the specific upgrade instructions
- Swagger/OpenAPI annotations need to be update:
@Api(value = "API Description")->@Tag(name = "api-name", description = "API Description")@ApiOperation(value = "API endpoint operation description")->@Operation(description = "API endpoint operation description")@ApiParam->@Parameter
SwaggerWsAPI needs to be updated, this parts need to be replaced:
BeanConfig beanConfig = new BeanConfig();
beanConfig.setResourcePackage("com.coreoz.webservices.api"); // The package will be different for your project
beanConfig.setBasePath("/api");
beanConfig.setTitle("API plume-demo-admin"); // The title is different for your project
// this is not only a setter, it also starts the Swagger classes analyzing process
beanConfig.setScan(true);
// the swagger object can be changed to add security definition
// or to alter the generated mapping
Swagger swagger = beanConfig.getSwagger();
// serialization of the Swagger definition
try {
this.swaggerDefinition = Json.mapper().writeValueAsString(swagger);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}by (and @SneakyThrows should be added to the constructor):
// Basic configuration
SwaggerConfiguration openApiConfig = new SwaggerConfiguration()
.resourcePackages(Set.of("com.coreoz.webservices.api")) // The package will be different for your project
.sortOutput(true)
.openAPI(new OpenAPI().servers(List.of(
new Server()
.url("/api")
.description("API plume-demo-admin") // The title is different for your project
)));
// Generation of the OpenApi object
OpenApiContext context = new JaxrsOpenApiContextBuilder<>()
.openApiConfiguration(openApiConfig)
.buildContext(true);
// the OpenAPI object can be changed to add security definition
// or to alter the generated mapping
OpenAPI openApi = context.read();
// serialization of the Swagger definition
this.swaggerDefinition = Yaml.mapper().writeValueAsString(openApi);pom.xmlmust be updated:play2-maven-pluginversion must be set to1.0.0-rc5- If a library that provides Swagger annotation (e.g. plume-file is used, the old Swagger annotations library should be excluded:
<dependency>
<groupId>com.coreoz</groupId>
<artifactId>plume-file</artifactId>
<exclusions>
<exclusion>
<artifactId>swagger-jaxrs</artifactId>
<groupId>io.swagger</groupId>
</exclusion>
</exclusions>
</dependency>- Dependency
swagger-jaxrsmust be updated and the exclusion ofjoda-time&jsr311-apican be removed:
from:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
</dependency>to:
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
</dependency>index.htmlfile should be updated:
From:
<a href="webjars/swagger-ui/2.2.10-1/index.html?url=/api/swagger">webjars/swagger-ui/2.2.10-1/index.html?url=/api/swagger</a>To:
<a href="webjars/swagger-ui/3.52.1/index.html?url=/api/swagger">webjars/swagger-ui/3.52.1/index.html?url=/api/swagger</a>