相同的路径网址-列出多个API

时间:2019-08-21 09:42:56

标签: swagger-ui openapi

我有一个基本路径URL,并且所有API都在此列表下列出,API具有不同的查询参数。为了解决此问题,我为每个API使用了片段标识符

openapi: 3.0.0
info:
  title:  API Documentation
  description: This documentation gives you real time experience 

servers:
   - url: https://secure.server.in/merchant
     description: Optional server description, e.g. Main (production) server
   - url: https://test.server.in/merchant
     description: Optional server description, e.g. Internal staging server for testing
paths:
  /postservice#api_to_vefiry:

Swagger用户界面没有给我任何错误,我也收到了API响应。

但是响应不正确,因为片段标识符附加在请求URL和cURL请求上。

https://test.server.in/merchant/postservice#api_to_vefiry?form=2

这是形成的cURL请求:

curl -X POST "https://test.server.in/merchant/postservice#api_to_vefiry?form=2" -H  "accept: application/json" -H  "Content-Type: application/x-www-form-urlencoded" -d "key=gtKFFx&command=verify_payment&var1=20190729&hash=063457c2c37daed990c8a6aee86a993df72dcd48ddef8fa384e587222a12529a2549d74b3713cb721d49170d5ac73e8835c0b2ca08a39323af8747becb8368bf"

现在,通过在路径中添加片段标识符,我可以记录不同的API,但是同时,它附加到请求URL上,从而给出不需要的响应。


有什么方法可以防止Swagger UI将片段标识符添加到请求URL?

或者还有其他方法可以用同一URL定义多个API操作吗?请注意,每个操作都有其自己不同的查询参数。

0 个答案:

没有答案
相关问题