Skip to content

[REQ] Is it possible to use swagger 3 annotation in place of swagger 2 for java? #6108

@TehBakker

Description

@TehBakker

Is your feature request related to a problem? Please describe.

I've migrated my API from swagger codeGen and swagger2 to openApi codeGen and openApi.
I used to expose my paths and json spec to customer through springfox, and I want to update that as to expose an openApi spec file.
Following the guide for migration found https://springdoc.org/migrating-from-springfox.html I see the annotation used by openApiCode are still the "swagger2" one

Describe the solution you'd like

Is there a way to configure that in my pom.xml as to use the newer annotation ?
Is there anyway to configure that ?

Replace swagger 2 annotations with swagger 3 annotations (it is already included with springdoc-openapi-ui dependency). Package for swagger 3 annotations is io.swagger.v3.oas.annotations.

@ApiParam -> @parameter
@apioperation -> @operation
@Api -> @tag
@ApiImplicitParams -> @parameters
@ApiImplicitParam -> @parameter
@ApiIgnore -> @parameter(hidden = true) or @operation(hidden = true) or @hidden
@apimodel -> @Schema
@ApiModelProperty -> @Schema

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions