【问题标题】:RAML, Request parameter title not definedRAML,请求参数标题未定义
【发布时间】:2017-12-04 13:31:46
【问题描述】:

我的 RAML 文件有问题。

当我在 GET 中调用此 URL 时:

mysite.com/test/nextversion?msn=xxx&ata=xx&title=xxx

它告诉我参数没有定义:

"Request parameter msn not defined in RAML\nRequest parameter title not defined in RAML\nRequest parameter ata not defined in RAML"

这是我的 RAML 定义:

/test/nextversion:
  get:
    queryParameters:
      msn:
        description: msn id
        type: string
        required: false
      title:
        description: ata title
        type: string
        required: false
      ata:
        description: ata id
        type: string
        required: false
    responses:
      200:
        description: OK
        body:
          application/json:
            type: string
      550:
        body:
          application/json:
            type: DefaultResponse

/test/{ipid}/nextversion:
  uriParameters:
    ipid:
      type: string
  get:
    responses:
      200:
        description: OK
        body:
          application/json:
            type: string
      550:
        body:
          application/json:
            type: DefaultResponse

现在我注意到,当我删除第一个定义时,它总是进入第二个原因,它给了我同样的错误,即使它应该告诉我它找不到正确的定义。 当我删除第二个定义时,它工作正常,但我有另一个端点取决于那个。

谁能向我解释为什么这在我的 RAML 文件中不起作用?

【问题讨论】:

    标签: java hibernate url yaml raml


    【解决方案1】:

    看来这完全与 RAML url 定义的顺序有关。

    它应该从最具体到最一般的情况,因为 RAML 将在第一个适合的 url 定义处停止,这并不总是正确的。

    在我的情况下,请求实际上进入了在我的问题中描述的那些之前定义的 url 定义,因为它符合 url 定义减去它之后的所有内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-02
      • 2017-10-16
      • 1970-01-01
      • 2018-06-04
      • 1970-01-01
      • 1970-01-01
      • 2016-08-28
      • 2015-12-18
      相关资源
      最近更新 更多