RAML formParameters没有使它发布方法签名

时间:2016-01-11 13:32:12

标签: raml

当我的raml定义指定我的服务的post方法期望json时,生成的post方法正确地获取了一个封装json并符合我的模式的对象。

但是,并非我已经将post方法更改为接受application / x-www-form-encoded formParameters,生成的post方法不包含与每个参数对应的参数。我错了预期吗?

之前和工作:

post:
  description: blah
  body:
  application/json:
    schema: myschema
    example: !include myexample_request_json.json

这生成了一个带签名的post方法:

public Response post(final Myrequest myrequest)

但已将RAML更改为:

post:
  description: blah
  body:
    application/x-www-form-urlencoded:
      formParameters:
        myparam1:
          description: aaa
          required: true
          type: string

我原本期望生成的post方法是:

public Response post(final String myparam1)

但是它是:

public Response post()

有人可以解释为什么吗?

谢谢,

1 个答案:

答案 0 :(得分:0)

我认为您在撰写e时错过了formParameters字母。请注意,您有formParamters

我建议您检查API Designer作为编辑RAML文件的工具。

修改

所以,它似乎不是拼写错误。不幸的是,我无法解释为什么它会产生这种方式,但我可以建议你如何实现它会产生你

public Response post(final String myparam1)

因此,您可以使用formParameters代替queryParameters和特定类型的内容:

  post:
    description: blah        
    queryParameters:    
      myparam1:
        description: aaa
        required: true
        type: string