c# - 引用另一个文件时无法导入 JSON 文件
问题描述
我正在使用 NSwag.OpenaPiDocument.FromJsonAsync() 加载 JSON 文件。JSON 文件分为几个文件。不幸的是,我收到了这个错误:
Could not resolve the JSON path 'parameters.json#/tagsParam' with the full JSON path 'C:\Users\ribuss\Desktop\Swagger\json\petstore-separate\spec\parameters.json#/tagsParam'
我正在尝试导入以下文件(通过调用 swagger.json 的方法)
在我的应用程序中,我使用以下命令:
NSwag.OpenApiDocument.FromJsonAsync(content, "C:/Users/ribuss/Desktop/Swagger/json/petstore-separate/spec/swagger.json").Result; // content is the full json text of swagger.json
编辑:
这是不起作用的架构:
{
"tagsParam": {
"name": "tags",
"in": "query",
"description": "tags to filter by",
"required": false,
"type": "array",
"collectionFormat": "csv",
"items": {
"type": "string"
}
},
"limitsParam": {
"name": "limit",
"in": "query",
"description": "maximum number of results to return",
"required": false,
"type": "integer",
"format": "int32"
}
}
我已经通过使用定义更改了架构,它现在正在工作。
解决方案
推荐阅读
- php - 如何访问返回的 json 值
- java - 从java执行bash脚本
- java - Spring Boot在测试中没有自动装配类
- vue.js - vue 路由在 chrome 中不起作用...在 IE 和 firefox 中运行良好
- multithreading - Wildfly 10:尝试实现 Java 并发实用程序时出错
- django - 如何根据表达式过滤对象
- javascript - 使用 node 或 express 返回 json 格式的正确方法
- matlab - 标量时间向量积的可绘制性
- java - iText 7.1.5 从 CSV 获取表格的实际宽度
- jquery - 如何修复 Google Chrome 移动加载页面上的黑屏