为摇摇欲坠指定了无效的模型架构 [英] Invalid model schema specified for swagger

查看:78
本文介绍了为摇摇欲坠指定了无效的模型架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在AWS上部署API,但不允许在JSON文件中添加模型并显示错误:

I tried to deploy API on AWS but it not allowed to add a model in the JSON file and shows error :

它可以在不使用模型的情况下工作,所以也许它不是采用这种方式,所以请向我建议如何在AWS的API JSON中使用模型!

It working without the use of model so maybe it not take model this way so please suggest me how to use a model in API JSON on AWS!

错误是:

Your API was not imported due to errors in the Swagger file.
Unable to create model for 'LandingPageDTO': Invalid model specified: Validation Result: warnings : [], errors : [Invalid model schema specified]
Unable to put method 'POST' on resource at path '/userservice/la/program-summary': Invalid model name specified: null
Additionally, these warnings were found:
Reference to model 'LandingPageDTO' not found. Ignoring.

我的招摇的json是:

And my swagger json is :

{
  "swagger" : "2.0",
  "info" : {
    "description" : "demo",
    "version" : "v0.1",
    "title" : "demo"
  },
  "host": "localhost:7000",
  "basePath": "/",
  "paths" : {
    "/userservice/la/program-summary" : {
      "post" : {
        "tags" : [ "user-controller" ],
        "summary" : "getLALandingPage",
        "operationId" : "getLALandingPageUsingPOST",
        "consumes" : [ "application/json" ],
        "produces" : [ "application/json" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "landingPage",
          "description" : "landingPage",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/LandingPageDTO"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "OK",
            "schema" : {
              "type" : "object",
              "properties" : { }
            }
          },
          "201" : {
            "description" : "Created"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "403" : {
            "description" : "Forbidden"
          },
          "404" : {
            "description" : "Not Found"
          }
        }
      }
    }
  },
  "definitions" : {
  "LandingPageDTO" : {
      "type" : "object",
      "properties" : {
        "filter" : {
          "type" : "object",
          "additionalProperties" : {
            "type" : "string"
          }
        },
        "page" : {
          "type" : "integer",
          "format" : "int32"
        },
        "searchTerm" : {
          "type" : "string"
        },
        "size" : {
          "type" : "integer",
          "format" : "int32"
        },
        "sortDirection" : {
          "type" : "string",
          "enum" : [ "ASC", "DESC" ]
        },
        "sortProperty" : {
          "type" : "string"
        },
        "uid" : {
          "type" : "string"
        }
      },
      "example" : {
        "filter" : {
          "key" : "filter"
        },
        "uid" : "uid",
        "sortDirection" : "ASC",
        "searchTerm" : "searchTerm",
        "size" : 6,
        "sortProperty" : "sortProperty",
        "page" : 0
      }
    }
  }
}

任何人都可以建议如何在AWS的swagger json API中导入模型.

Can any one suggest how to import model in swagger json api on AWS.

推荐答案

根据

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