JaxRS Server still use Swagger v2 as dependency
Created by: jmini
Generated JaxRS Server uses this library as dependency:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>1.5.15</version>
</dependency>
It should be:
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
<version>2.0.1</version>
</dependency>
Of course the templates need to be changed in order to adopt the new notation and annotations...
The most visible impact is on the capability for the server to self describe itself.
When you run mvn clean package jetty:run
inside the samples/server/petstore/jaxrs/jersey2/
folder and then call http://localhost:8080/v2/swagger.yaml
, you obtain the corresponding spec:
swagger: "2.0"
info:
...
host: "petstore.swagger.io:80"
basePath: "/v2"
tags:
...
schemes:
- "http"
paths:
/another-fake/dummy:
patch:
...
/fake/outer/boolean:
post:
tags:
- "fake"
summary: ""
description: "Test serialization of outer boolean types"
operationId: "fakeOuterBooleanSerialize"
consumes:
- "*/*"
produces:
- "*/*"
parameters:
- in: "body"
name: "body"
description: "Input boolean as post body"
required: false
schema:
type: "boolean"
responses:
200:
description: "Output boolean"
schema:
type: "boolean"
/fake/outer/composite:
post:
...
/fake/outer/number:
...
The big next step for the JaxRS generators will be to generate code that will be using Swagger v3 artefacts. Then the page to call to get the spec will be http://localhost:8080/v2/openapi.yaml