首页 > 其他分享 >报错“Please indicate a valid Swagger or OpenAPI version field”

报错“Please indicate a valid Swagger or OpenAPI version field”

时间:2024-05-01 12:55:05浏览次数:25  
标签:field Please openapi application version 报错 schema

报错“Please indicate a valid Swagger or OpenAPI version field”

报错信息

Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).

 原因分析

根据报错信息,分析是没指定版本信息

代码修改

def custom_openapi():
    if application.openapi_schema:
        return application.openapi_schema
    openapi_schema = get_openapi(
        description=settings.DESCRIPTION,
        version=settings.VERSION,
        title=settings.PROJECT_NAME,
        routes=app.routes,
    )
    openapi_schema["openapi"] = "3.0.0"
    openapi_schema["info"]["version"] = settings.VERSION
    openapi_schema["info"]["x-logo"] = {
        "url": "/static/logo-teal.png"
    }
    application.openapi_schema = openapi_schema
    return application.openapi_schema

 

标签:field,Please,openapi,application,version,报错,schema
From: https://www.cnblogs.com/weiweirui/p/18169256

相关文章

  • CF1967B2 Reverse Card (Hard Version) 题解
    题意:求有多少对\((a,b)\)满足\(b\times\gcd(a,b)\equiv0\pmod{a+b},1\lea\len,1\leb\lem\)。首先我们设\(\gcd(a,b)=G,a=i\timesG,b=j\timesG\),显然有\(\gcd(i,j)=1\)。那么可以把原条件转化为\(j\timesG\)是\((i+j)\)的倍数。因为\(\gcd(i+......
  • Reverse Card (Hard Version)
    事情是这样的,我验了这一场CF。显然我玩原神玩多了有一个很奇怪的、不能过的算法,哦,当然,在我本机可以过。为了展现自己的智慧糖,我写一下。出题人是先发给我了一个限制都是\(n\)的,因此只有这个。\(n,m\)改改就是了。要求\(1\lea\len,1\leb\len\)满足\(a+b\midb\times......
  • IDEA在运行maven打war的时候报错:Cannot access defaults field of Properties
    问题描述:解决方案在pom.xml文件中引入:<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId>......
  • mycat启动报错Could not reserve enough space for 2097152KB object heap
    mycat启动报错:报错1:Couldnotreserveenoughspacefor2097152KBobjectheap找到wrapper.conf修改内存大小为1G #InitialJavaHeapSize(inMB)#wrapper.java.initmemory=3wrapper.java.initmemory=1024#MaximumJavaHeapSize(inMB)#wrapper.java.maxmemor......
  • macOS OpenCV报错:Undefined symbols for architecture x86_64
    这个错误可能是链接的OpenCV库不对,我这里的情况是我代码使用的GCC编译器,但是通过brewinstallopencv安装的OpenCV是使用clang编译的,代码也使用clang编译器可以解决这个问题。要查看opencv的编译信息,可以使用这个命令opencv_version-v我这边输出Generalconfigurationfo......
  • FPS游戏里添加物理材质后,没有击中目标时射击会报错的问题
    设置了不同的物理材质后 然后设定了子弹打中不同材质时,播放不同的命中特效 但是如果某次开枪,如果没有击中任何物体,比如天空,远处,子弹无论有没有被销毁,此次射击没有命中目标,那么系统会判定子弹产生的命中特效无访问,应该是找不到生成特效的点 只需要设置个变量布尔值,判断......
  • 嵌入式Linux,openssh连接报错:ssh_sandbox_violation: unexpected system call
     背景:使用buildroot编译完镜像,烧录到开发板,板子上电启动后,网络正常,ssh不能连接,sshd相同配置在其他机器上可以正常使用;查看内核日志,看到连接时上报异常系统调用的错误:Jan100:01:18NanoPC-T2auth.critsshd[278]:fatal:ssh_sandbox_violation:unexpectedsystemcall......
  • 当Surveymonkey报错Request Header Fields Too Large时需要清理Edge浏览器缓存
     第一步:点击浏览器左上角的...第二步:依次进入Cookie和网站权限---管理和删除Cookie和站点数据。第三步:点击查看所有Cookie和站点数据。第四步:点击全部删除。第五步:清除站点Cooke数据。......
  • npm install报错提示证书过期CERT_HAS_EXPIRED
    npminstall报错提示证书过期CERT_HAS_EXPIREDnpm ERR! code CERT_HAS_EXPIREDnpm ERR! errno CERT_HAS_EXPIREDnpm ERR! request to https://registry.npm.taobao.org/xxx failed, reason: certificate has expired这个错误是由于您尝试连接的服务器上的SSL证......
  • spring-web-mvc项目运行报错:java.lang.NoClassDefFoundError: org/apache/catalina/We
    使用idea运行spring-web-mvc项目时,报错如下:错误:无法初始化主类com.itranswarp.learnjava1.AppConfig原因:java.lang.NoClassDefFoundError:org/apache/catalina/WebResourceRoot 首先,保证当前项目在独立的项目中打开,不要在多个项目中运行。导入Maven工程要选择:File......