【发布时间】:2020-05-21 08:24:43
【问题描述】:
目的:将示例添加到 yaml 文件中,以便在 Postman 集合中公开。
我正在尝试添加 2 个简单示例,但不断出现错误。当前错误是:流集合条目之间缺少逗号。
你能帮忙吗?
swagger: "2.0"
info:
description: "Test"
version: "1.4.4"
title: "my-test"
host: "somehost"
basePath: "/somepath"
schemes:
- "https"
tags:
- name: Recommend
description: helloWorld
paths:
/hello:
post:
description: "some description"
operationId: "example-test"
tags: ["example-test"]
produces:
"application/json"
parameters:
name: "myRequest"
in: "body"
description: "bla"
required: true
schema:
$ref: "#/definitions/myRequest"
examples: {ex1: $ref: "#/components/examples/test1" , ex2: $ref: "#/components/examples/test2" }
responses:
"204":
description: "All good"
definitions:
myRequest:
type: object
required:
- name
- lastname
properties:
name:
type: string
lastname:
type: string
components:
examples:
test1:
value:
name: test1
lastname: test1
test2:
value:
name: test2
lastname: test2
【问题讨论】:
标签: yaml openapi swagger-2.0