【问题标题】:ECMA 262 regex "^/" does not match input string "https://domain.herokuapp.com"ECMA 262 正则表达式“^/”与输入字符串“https://domain.herokuapp.com”不匹配
【发布时间】:2016-08-08 06:56:54
【问题描述】:

我已将我的基于 play 2.4 API 的项目部署到 heroku。在生产中,可以在/swagger 上看到 api,但它也显示了一些错误。在浏览错误时,它会显示 json。

{
    schemaValidationMessages: [{
        level: "error",
        domain: "validation",
        keyword: "pattern",
        message: "ECMA 262 regex "^/" does not match input string "https://domain.herokuapp.com "",
        schema: {
            loadingURI: "#",
            pointer: "/properties/basePath"
        },
        instance: {
            pointer: "/basePath"
        }
    }]
}

我添加的依赖是

  "io.swagger" %% "swagger-play2" % "1.5.2"

根据 play prod 配置,我的 procfile 中有 overrided swagger 基本路径。

-Dswagger.api.basepath=https://domain.herokuapp.com

错误的原因可能是什么?如何消除它?

谢谢

【问题讨论】:

  • “域”是您的 Heroku 应用程序的名称,还是您刚刚将您的应用程序名称替换为“域”?
  • 是的,我已将 domain 替换为我的 heroku 应用名称

标签: heroku playframework swagger swagger-ui playframework-2.4


【解决方案1】:

我认为这是主机,basePath 应该是“/”。至少这为我解决了它

  "host" : "https://domain.herokuapp.com",
  "basePath" : "/",

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多