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

Table of Contents

Product Version


Product To Version



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


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


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)

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 = "...")

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();


@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.

The Intershop Customer Portal uses only technically necessary cookies. We do not track visitors or have visitors tracked by 3rd parties. Please find further information on privacy in the Intershop Privacy Policy and Legal Notice.
Customer Support
Knowledge Base
Product Resources