生成服務器代碼中使用this minimal examplespring
或jaxrs-spec
創建2分模型類爲:Pet.java
和InlineResposne200.java
。除了班級名稱,他們是相同的。揚鞭生成複製模型類
,響應/pets
回報List<InlineResponse200>
代替List<Pet>
和類Pet
實際上從來沒有在任何地方使用,即使YAML定義使用$ref: "#/definitions/Pet"
控制器。這是爲什麼發生?
---
swagger: "2.0"
info:
version: "1.0.0"
title: "Swagger Petstore"
description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification"
termsOfService: "http://swagger.io/terms/"
contact:
name: "Swagger API Team"
license:
name: "MIT"
host: "petstore.swagger.io"
basePath: "/api"
schemes:
- "http"
consumes:
- "application/json"
produces:
- "application/json"
paths:
/pets:
get:
description: "Returns all pets from the system that the user has access to"
produces:
- "application/json"
responses:
"200":
description: "A list of pets."
schema:
type: "array"
items:
$ref: "#/definitions/Pet"
definitions:
Pet:
type: "object"
required:
- "id"
- "name"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
tag:
type: "string"
從我的機器生成使用v2.2.2工作正常,謝謝!我使用'http:// editor.swagger.io'上的那個 – cahen