我尝试使用 Swagger Editor 指定来自 GET 方法的响应。但是当我查看 Swagger UI 时,没有显示响应 JSON。
我的宣言大摇大摆:
/clients/{id}:
get:
consumes:
- application/hal+json
produces:
- application/hal+json
# This is array of GET operation parameters:
parameters:
# An example parameter that is in query and is required
- name: id
in: path
required: true
type: string
# Expected responses for this operation:
responses:
# Response code
200:
description: Succes
# A schema describing your response object.
# Use JSON Schema format
schema:
example:
application/json: |
- {"produits":[{"idOffre":{"codeBanque":"038","identifiant":"123"},"idProduit":{"codeBanque":"061","identifiant":"123"}},{"idOffre":{"code":"038","identifiant":"123"},"idProduit":{"code":"061","identifiant":"123"}}]}
.....
在 Swagger UI 中,写着 Response Class (Status 200) > Model Schema 的框有一个像这样的空 json -> {}