PREREQUISITE: following PR needs to be merged:
JaxRS generators were introduced here with #29 (and with the follow up tasks #38, #36 and #39). JaxRS Client CFX generator was introduce with #47. JaxRS examples in the samples/ folder are going to be updated with swagger-api/swagger-codegen#7854.
As indicated in the help description message, the mentioned generators still generate code for Swagger v2:
WORK IN PROGRESS: generated code depends from Swagger v2 libraries
One example of the impact:
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:
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
I did not look at all the details yet, but I think the main point is to replace:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>1.5.15</version>
</dependency>
With:
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
The swagger-samples repository on branch 2.0 contains valuable examples that already works with Swagger v3. See: https://github.com/swagger-api/swagger-samples/tree/2.0/
I will work on this as soon as the blocking PR are merged.
PREREQUISITE: following PR needs to be merged:
JaxRS generators were introduced here with #29 (and with the follow up tasks #38, #36 and #39). JaxRS Client CFX generator was introduce with #47. JaxRS examples in the
samples/folder are going to be updated with swagger-api/swagger-codegen#7854.As indicated in the help description message, the mentioned generators still generate code for Swagger v2:
One example of the impact:
When you run
mvn clean package jetty:runinside thesamples/server/petstore/jaxrs/jersey2/folder and then callhttp://localhost:8080/v2/swagger.yaml, you obtain: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.yamlI did not look at all the details yet, but I think the main point is to replace:
With:
The
swagger-samplesrepository on branch2.0contains valuable examples that already works with Swagger v3. See: https://github.com/swagger-api/swagger-samples/tree/2.0/I will work on this as soon as the blocking PR are merged.