首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解决raml文件错误

无法解决raml文件错误
EN

Stack Overflow用户
提问于 2016-12-14 17:56:11
回答 1查看 1.2K关注 0票数 0

我已经给了附加的RAML文件在Mule中使用,但我有问题,如何清理文件中的错误,甚至不确定这个raml文件是否符合标准。我得到的错误是因为缺少{},而另一个错误是删除版本时缺少块条目。不知道怎么解决这些问题。

下面是RAML的精简版本:

代码语言:javascript
复制
#%RAML 0.8
---
title: Databox
version: v1
protocols: [HTTPS]
baseUri: https://databox/v1/{version}
mediaType: application/json
traits:
  - http-data: !include http-data.raml
resourceTypes: !include types.raml

documentation:
  - title: Home
    content: |
      Databox 1st draft

/stores:
  type:
    store:
      description: Stores
      dataSchema: !include stores.json

的特征(http-data.raml):

代码语言:javascript
复制
responses:
  200:
    description: |
      Success

resourceType (types.raml):

代码语言:javascript
复制
- store:
    head:
      description: Retrieve data for <<description>>.
      is: [ http-data ]
    get:
      description: Retrieve data for <<description>>.
      responses:
        200:
          body:
            application/json:
              schema: |
               {
                "type": "object",
                "properties": {
                  "meta": {
                    "title": "Data",
                    "type": "object",
                    "properties": {
                      "createdOn": {
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "createdOn"
                    ]
                  },
                  "data": {
                   "type": "array",
                   "items": <<dataSchema>>
                  }
                },
                "required": [
                  "data"
                ]
               }
          description: |
            Success. Returns a JSON object containing all <<description>>.

模式(stores.json):

代码语言:javascript
复制
{
  "id": "http://localhost:8000/stores.json#",
  "$schema": "http://json-schema.org/draft-04/schema",
  "title": "Databox Store Schema",
  "type": "object",
  "properties": {
    "storeId": {
      "type": "string"
    },
    "storeDescription": {
      "type": "string"
    },
  },
  "required": [
    "storeId"
  ],
  "additionalProperties": false
}

谢谢

EN

回答 1

Stack Overflow用户

发布于 2016-12-14 20:58:15

除了json模式中使用的<<dataSchema>>参数外,RAML是有效的,不确定这是否是参数的有效使用。

首先,将<<dataSchema>>替换为stores.json中的json,然后再试一次。

让我知道,如果这是可行的,或你有什么错误。

更新:

Mulesoft的anypoint门户仅用一个更改就可以验证您的RAML,您可以看到它是这里

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41149092

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档