visual-studio - VisualStudio/NSwag 无法解析 Swagger.ui 兼容 Json?
问题描述
我正在使用 Visual Studio 添加服务参考功能添加新的 OpenAPI 服务参考。
结果:
“添加服务引用失败。无法从https://10.183.177.223:9002/v2/api-docs 下载元数据文件。”
但 Swagger-ui.html 运行良好并从https://10.183.177.233:9002/v2/api-docs获取其资源
之前添加 web 服务引用从来没有任何问题......我做错了什么?
如果我手动添加 JSON 文件。我在构建以下错误时得到:
命令 ""../tools/Win/NSwag.exe" openapi2csclient /className:SoluMAPIClient /namespace:test_integrate_SoluM_API /input:C:\Users\pascherp\source\repos\test 集成 SoluM API\test 集成 SoluM API\OpenAPIs\ SoluMAPI.json /output:obj\SoluMAPIClient.cs " 以代码 -1 退出
和 w 警告
"TagScheduleTime": {
"type": "object",
"required": [ "displayPage", "endTime", "startTime" ],
"properties": {
"displayPage": {
"type": "integer",
"format": "int32",
"example": 1,
"minimum": 1,
"maximum": 3
},
"startTime": {
"example": "2017-01-01 00:00",
"$ref": "#/definitions/LocalDateTime"
},
"endTime": {
"example": "2017-01-01 23:59",
"$ref": "#/definitions/LocalDateTime" //<--- Reference could not be resolved
}
}
},
Swagger 怎么能很好地运行它,但 VS 不是?我可以为此责怪 Api 提供者吗?:)
解决方案
推荐阅读
- c++ - 为什么 C++ ofstream 比 C FILE 快?
- r - R:将字符类型转换为日期类型时出错
- r - R - ggplot2 - 在具有两个 y 轴的图形上执行双 geom_smooth() 时无法看到标准误差范围
- extjs - 放置自定义 CSS 的最佳位置在哪里?
- linux-kernel - Linux 配置“选择者”是什么?
- html - 在仍然响应的同时限制 img 的大小
- html - VB.NET:如何在表单上激活 html 事件
- c - FP:无效操作:C (UB) 和 IEEE 754 (WDB) 之间的矛盾?
- javascript - 使用 Joi、nodejs 验证标头参数?
- node.js - 如何在 socket.io 中实现中间件,如 NodeJS 中的 express?