swagger:路径参数中的文件路径 [英] swagger: file path in path parameter

查看:116
本文介绍了swagger:路径参数中的文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的api要求

GET http://localhost:8080/filePath/{path}

例如:

curl http://localhost:8080/filePath/home/users/user/one.txt

这里是yaml配置:

parameters:
        - name: path
          in: path
          description: Todo description
          type: string
          required: true

但是我收到了 404 错误.如何在路径参数中使用文件路径?

But I'm getting 404 error. How can I use file path in path parameter?

推荐答案

OpenAPI 2.0 (Swagger 2.0) 和 OpenAPI 3.0 不允许您在路径参数中使用斜杠,因此您不能这样做.有一个开放的功能请求:

OpenAPI 2.0 (Swagger 2.0) and OpenAPI 3.0 do not allow you to use slashes in path parameters, so you can't do that. There's an open feature request for this:

https://github.com/OAI/OpenAPI-Specification/issues/892

这篇关于swagger:路径参数中的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆