OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.45k stars 6.49k forks source link

[JAVA - SpringCodegen] Bug/feature generating code with swagger annotations v3 #3902

Open vsizko opened 5 years ago

vsizko commented 5 years ago
Description

In Spring Boot 2.1.6 project we use SpringCodegen and openapi-generator-maven-plugin to generate DTOs and interfaces for controllers from yaml-file with openapi 3.0.0. Generated files contains swagger annotations from package "io.swagger.annotations", although expected annotations from package "io.swagger.v3.oas.annotations", because in source yaml-file used openapi v3. Generated classes works fine, but we cannot later generate swagger documentation with specification v3 from that classes. Only v2. We want to control, that output documentation is the same version 3, like in input yaml-file, to exclude override errors in our code. To generate swagger documentation from java-classes we use another component, that needs swagger annotations v3. Please tell me how can I fix this problem: edit templates or maybe a ready-made solution already exists?

openapi-generator version

4.0.2

OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
macjohnny commented 5 years ago

please post some example code