我想寫與揚鞭的UI(招搖版本2.0)一個開放的API規範,我不知道如何表示與path
參數開放API POST
POST /ping/{text}
POST
參數
我的規格如下,
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
title: Mock API
description: Mock API
version: "1.0.0"
# the domain of the service
host: api.mock.com
# array of all schemes that your API supports
schemes:
- https
# will be prefixed to all paths
basePath: /v1
produces:
- application/json
paths:
/ping:
get:
summary: Ping
description: |
Respond to PING requests, similar to heart beat
parameters:
- name: path
in: path
description: String input for echo service
required: false
type: string
tags:
- ping
responses:
200:
description: The text passed in the request
schema:
type: string
default:
description: Empty response for request passed
schema:
type: string
而招搖UI顯示錯誤如下 -
code: "ONE_OF_MISSING"
message: "Not a valid parameter definition"
但是如果我將其更改爲in: query
錯誤消失。我究竟做錯了什麼?或者在開放式API規範中指定路徑參數的正確方法是什麼?
:( –