Generieren von Servercode für this minimal example mit spring
oder jaxrs-spec
schafft 2 Modellklassen: Pet.java
und InlineResposne200.java
. Bis auf den Klassennamen sind sie identisch.Swagger Erzeugen Modellklassen dupliziert
Der Controller, der nie irgendwo verwendet wird, ein List<InlineResponse200>
statt List<Pet>
und die Klasse Pet
tatsächlich /pets
Renditen reagiert, obwohl die yaml Definition $ref: "#/definitions/Pet"
verwendet. Warum passiert dies?
---
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"
Generierung von meiner Maschine mit der v2.2.2 funktionierte gut, danke! Ich benutzte den einen bei 'http: // editor.swagger.io' – cahen