gpt4 book ai didi

swagger - 获取 "Cannot read property ' 参数为 null”的 swagger 规范

转载 作者:行者123 更新时间:2023-12-02 04:07:09 28 4
gpt4 key购买 nike

我有以下我自己从代码生成的 JSON。我基本上是在编写代码来生成 UI 的 swagger 规范。我正在编写一个新的,因为我仍然使用 play 1.3 并且其 swagger 模块已经有一段时间没有更新了。但是,我从代码生成器中获取了此 JSON,但 UI 卡在“正在获取资源列表:http://localhost:9100/resources.json;请稍候”。 JavaScript 控制台显示错误“针对 swagger 规范获取“无法读取 null 的属性‘参数’”。我不知道该怎么做,任何帮助将不胜感激。

     {
"swagger": "2.0",
"info": null,
"host": null,
"basePath": null,
"tags": [
{
"name": "payments",
"description": null,
"externalDocs": null
}
],
"schemes": null,
"consumes": null,
"produces": null,
"paths": {
"/": {
"get": {
"tags": [
"payments"
],
"summary": "/payment_methods",
"description": "",
"operationId": "paymentMethods",
"schemes": null,
"consumes": null,
"produces": [
"application/json"
],
"parameters": [],
"responses": {
"default": {
"description": "successful operation",
"schema": null,
"examples": null,
"headers": null
}
},
"security": null,
"externalDocs": null,
"deprecated": null
},
"head": null,
"post": {
"tags": [
"payments"
],
"summary": null,
"description": null,
"operationId": "addPaypalAccount",
"schemes": null,
"consumes": null,
"produces": null,
"parameters": [],
"responses": {
"default": {
"description": "successful operation",
"schema": null,
"examples": null,
"headers": null
}
},
"security": null,
"externalDocs": null,
"deprecated": null
},
"put": null,
"delete": {
"tags": [
"payments"
],
"summary": null,
"description": null,
"operationId": "deletePaypalAccount",
"schemes": null,
"consumes": null,
"produces": null,
"parameters": [],
"responses": {
"default": {
"description": "successful operation",
"schema": null,
"examples": null,
"headers": null
}
},
"security": null,
"externalDocs": null,
"deprecated": null
},
"options": null,
"patch": null,
"parameters": null
}
},
"securityDefinitions": null,
"definitions": null,
"parameters": null,
"responses": null,
"externalDocs": null,
"securityRequirement": null
}

最佳答案

问题在于 null 值。它们需要被禁用——null 与“不存在”不同。也就是说,我相信您需要将映射器配置为不写入空值。

关于swagger - 获取 "Cannot read property ' 参数为 null”的 swagger 规范,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34403058/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com