Document Properties
Last Modified04-Feb-2020
Added to KB19-Jul-2019
Public AccessEveryone
Doc TypeGuidelines, Concepts & Cookbooks
ProductICM 7.10

Guide - Migrating to OpenApi 3.0 and Swagger 2.X Annotations

Product Version


Product To Version



1 Introduction

This document shows major differences between swagger-annotations 1.5.x and 2.x.

2 General

GeneratedOpenApi 2.0OpenApi 3.0
AnnotationsAnnotations 1.5.XSwagger 2.X Annotations
Specification documentationBasic StructureBasic Structure
Maven Repositoryio.swagger:swagger-annotations


3 Annotations for Models

@APIModel(description = "...")@Schema(description = "...")@Schema is used not only to define schemas (which are basically entities/data classes or properties) but also to reference such with @Schema(implementation=<someclass>.class)
@APIModelProperty(description = "...")@Schema(description = "...")Only if the decorated getter is not an array type.
@APIModelProperty(description = "...")@ArraySchema(schema = @Schema(implementation = <someclass>.class, description = "..."))Only if the decorated getter is an array type.
@APIModelProperty(readOnly = true)@Schema(accessMode=AccessMode.READ_ONLY)

4 Annotations for Operations


@Api("Some API")

public class SomeClass

@Tag(name="testpath", description="Some API")

public class SomeClass

@ApiOperation@OperationSee below for usage
@APIResponsesremovedSee below for usage
@APIResponse@ApiResponseSee below for usage; ApiResponse.responseCode is a String now (not int)
@ApiParam(value = "...", example = "...")@Parameter(description = "...", example = "...")

4.1 Examples for Operations

Example for an API Operation
@Operation(summary = "Gets the recurring order with the given identifier",
                    responses = { @ApiResponse(responseCode = OK, description = OK_MSG,
                                    content = @Content(schema = @Schema(implementation = RecurringOrderRO.class))),
                                    @ApiResponse(responseCode = NOT_FOUND, description = NOT_FOUND_MSG) })
public Response get(@Parameter(description = "The external id") @PathParam("externalID") String externalID)
    return Response.ok(something).build();

5 Others

@SwaggerDefinition(basePath = "/myapi", host=""
                info = @Info(...),
                consumes = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML },
                produces = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML },
                schemes = { SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS })
                servers= {
                info = @Info(...))
basePath, host and schemes are now merged into servers
@SwaggerDefinition.consumes, @SwaggerDefinition.producesremovedWas removed, now MediaTypes are specified per-resource (with @Consumes/@Produces)
@Api(hidden = true)@Hidden@Hidden works for models or operations


The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources