1

库使用 webapi-parser 0.5.0

与Java一起使用的语言库

描述 我无法找到访问 raml 文件中定义的请求类型的方法的问题

输入您有问题 以下是 RAML 文件的相关部分

/testEndpoint:
      type: rt.Item
      post:
        is: [t.ReturnsItemCreated, t.ExpectsContext, t.ReturnsNotFound, t.ReturnsBadGateway, t.ReturnsCommonErrors, t.NotCacheable]
        body:
          application/json:
            type: bu.BlockCodeUpdatesRequestType
            examples:
              de-cards-bc: !include examples/example1.json
        responses:
          201:
            body:
              application/json:
                type: bu.DeviceManagementResponseType
                example: !include examples/ex2.json   

您遇到问题的代码 阅读完文档后,我尝试使用operation.request().payloads().get(0).mediaType().value()但返回application/json的结果不是我想要的,我想要application/jsonie中的类型bu.BlockCodeUpdatesRequestType。示例也是如此,我无法阅读这些示例,payloads().get(0).examples()由于某种原因显示为空,我不知道如何访问这些。仅获取示例中的路径就足够了。

附加上下文 变量之类rt bu的 RAML 库文件定义在uses:

我在这里在 Github上问了同样的问题。

4

0 回答 0