Aleridia
5 years agoVisitor
Swagger codegen/Swagger editor don't want to generate example
Hello,
I'm learning Swagger and I had a problem while building my application.
Indeed, the auto-generate code don't want to generate my examples (I generated only Spring server).
Here is the yaml file (I copy/paste the doc to be sure I wasn't wrong) :
swagger: "2.0"
info:
description: "This is the test's API from the web simulation."
version: "1.0.0"
title: "Plateform"
termsOfService: "http://swagger.io/terms/"
contact:
email: "test@test.com"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "localhost:8080"
basePath: "/"
tags:
- name: "test"
description: "Everything"
schemes:
- "https"
- "http"
paths:
/test:
get:
tags:
- "test"
summary: "Get"
description: ""
operationId: "get"
produces:
- "application/json"
responses:
200:
description: OK
examples:
application/json: { "id": 38, "title": "T-shirt" }
text/csv: >
id,title
38,T-shirt
In the editor, I got the right example :
Editor
But when I try to generate the code I got this :
I got the same problem when I try to add any example (in /#/definitions/ for example).
I generate the code with Swagger codegen 2.0 and 3.0, and with the tool integrated in the Swagger Editor, but it return the same thing.
I'm on Ubuntu and using Maven to run the Spring-boot server.
Do you see anything I did wrong ?
Thanks in advance for your help.