如何迅速更改查询参数名称?

时间:2018-07-02 01:18:19

标签: rest get swagger openapi

我正在尝试获取此网址:

https://search.me/Search/api/search?map=%7B%22query%22:%22CSCI+250%22,%22rows%22:500,%22term%22:%222181%22,%22career%22:%22%22,%7D

如果不将特殊字符转换为十六进制到URL,则为:

https://search.me/Search/api/search?map={query:CSCI-250,rows:500,term:2181,career:}

我知道在openapi 3.0.0中无法将特殊字符序列化为十六进制,因此我可以在查询参数中使用完整的JSON。

其中参数是JSON-> URI JSON是:

{
  map:  {
    "query": "CSCI 250",
    "rows": 500,
    "term": 2181,
    "career": ""
  }
}

但是大张旗鼓地渲染:

https://search.me/search/api/search?query=CSCI-250&rows=500&term=2181&career=

如您所见,特殊字符随后被转换为十六进制。

下面是我的路。我到底在做什么错?

paths:
  /search:
    get:
      summary: Search
      parameters:
      - in: query
        name: map
        description: JSON for lookup
        required: true
        schema:
            $ref: '#/components/schemas/QueryParams'
      responses:
        200:
          description: Course search response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/QueryResults'
        400:
          description: Bad request

0 个答案:

没有答案