我有 swagger-jersey2-jaxrs 1.5.1-M2 与 Drop-wizard 集成。我使用包含在资源和模型中的 swagger 注释生成了以下 yaml:
---
swagger: "2.0"
info:
version: "1.0.0"
title: "test Application"
tags:
- name: "test"
paths:
/v1/test/version:
get:
tags:
- "v1test"
summary: "version number of test"
description: "Returns version number of test"
operationId: "getVersionAndBuildInfo"
produces:
- "application/json"
parameters:
responses:
404:
description: "build number not found."
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/testInformation"
definitions:
testInformation:
properties:
build:
type: "string"
description: "test build number"
version:
type: "string"
description: "test version number"
buildTimestamp:
type: "string"
description: "test build timestamp"
description: "model for test version information"
请注意,参数:包含在从 swagger 生成的 yaml 中。当我将其粘贴到 swagger 编辑器 2.0 中时,它会抛出一个错误,提示“数组太短 (0),最小值为 1”。
有没有办法不生成参数:在 yaml 当 URL 不需要任何参数时?我没有包含任何参数注释,它仍然显示在生成的 yaml 中。