Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect open api yaml file if not adding swagger-annotations dependencies #8

Open
paololersey opened this issue Jan 8, 2021 · 1 comment

Comments

@paololersey
Copy link

paololersey commented Jan 8, 2021

Hello, good job this pluginfor spring mvc!

Actually I raise this issue: the openapi3.yaml produced by default only adding the plugin produce an open api which is not a correct api yaml file.

The precondition is:

  • java 11;
  • maven 3.3.9
  • windows op. system;

The steps are:

  • Generating a spring boot with web dependency from https://start.spring.io/ with Spring boot 2.4.1 version;
  • add spring-boot-starter-web dependency
  • adding the plugin as documented;
  • perform mvn clean install;

The result is an open api yaml file which is not correct in https://editor.swagger.io/.

openapi: 3.0.1
info:
  title: OpenAPI definition
  version: v0
servers:
- url: http://localhost/
  description: ' Default server url'
paths:
  /is-alive:
    get:
      description: is-alive
      operationId: isAlive
      responses:
        200 OK: {}
components: {}

Reference to: https://github.com/paololersey/spring-boot-2.4.1-open-api/

I had to add to add to the method in Controller.java
@operation(responses = {@ApiResponse(responseCode = "200", description = "OK")})
and in pom.xml:

<dependency>
       <groupId>io.swagger.core.v3</groupId>
       <artifactId>swagger-annotations</artifactId>
       <version>2.1.6</version>
</dependency>

Is it possible to generate it correctly without adding @operation by default?
The issue is present also for version 2.1.0.RELEASE spring boot.
Thanks for all.

@ahmadshadab
Copy link
Collaborator

Sorry for the late response, i was reminded by my colleague on this.
I will take a look and get back to you if it is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants