Api-blueprint: 属性名称中的下划线

创建于 2015-07-07  ·  4评论  ·  资料来源: apiaryio/api-blueprint

如果下划线在Attribute名称及其示例值中,解析器会将整行视为具有空值的属性名称。

例如这个蓝图:

# GET /message
+ Response 200 (text/plain)
        + Attributes
            + some_thing: an_example_thing

由 Drafter 解析结果如下:

_version: "3.0"
metadata: []
name: ""
description: ""
element: "category"
resourceGroups:
  -
    name: ""
    description: ""
    resources:
      -
        element: "resource"
        name: ""
        description: ""
        uriTemplate: "/message"
        model: {}
        parameters: []
        actions:
          -
            name: ""
            description: ""
            method: "GET"
            parameters: []
            attributes:
              relation: ""
              uriTemplate: ""
            content: []
            examples:
              -
                name: ""
                description: ""
                requests: []
                responses:
                  -
                    name: "200"
                    description: ""
                    headers:
                      -
                        name: "Content-Type"
                        value: "text/plain"
                    body: ""
                    schema: ""
                    content:
                      -
                        element: "dataStructure"
                        name: null
                        typeDefinition:
                          typeSpecification:
                            name: null
                            nestedTypes: []
                          attributes: []
                        sections:
                          -
                            class: "memberType"
                            content:
                              -
                                content:
                                  name:
                                    literal: "some_thing: an_example_thing"
                                  description: ""
                                  valueDefinition:
                                    values: []
                                    typeDefinition:
                                      typeSpecification:
                                        name: null
                                        nestedTypes: []
                                      attributes: []
                                  sections: []
                                class: "property"
        content: []
content:
  -
    element: "category"
    content:
      -
        element: "resource"
        name: ""
        description: ""
        uriTemplate: "/message"
        model: {}
        parameters: []
        actions:
          -
            name: ""
            description: ""
            method: "GET"
            parameters: []
            attributes:
              relation: ""
              uriTemplate: ""
            content: []
            examples:
              -
                name: ""
                description: ""
                requests: []
                responses:
                  -
                    name: "200"
                    description: ""
                    headers:
                      -
                        name: "Content-Type"
                        value: "text/plain"
                    body: ""
                    schema: ""
                    content:
                      -
                        element: "dataStructure"
                        name: null
                        typeDefinition:
                          typeSpecification:
                            name: null
                            nestedTypes: []
                          attributes: []
                        sections:
                          -
                            class: "memberType"
                            content:
                              -
                                content:
                                  name:
                                    literal: "some_thing: an_example_thing"
                                  description: ""
                                  valueDefinition:
                                    values: []
                                    typeDefinition:
                                      typeSpecification:
                                        name: null
                                        nestedTypes: []
                                      attributes: []
                                  sections: []
                                class: "property"
        content: []

同样,这被 Apiary 错误解析,并且语法高亮显示不正确。

Question

最有用的评论

嘿,如果您阅读 MSON 规范,您可以看到 _ 是一个保留字符。 请使用反引号来转义整个单词。 下面是一个例子:

+ `some_thing`: `an_example_thing`

请注意,#210 计划进行 UX 改进

所有4条评论

嘿,如果您阅读 MSON 规范,您可以看到 _ 是一个保留字符。 请使用反引号来转义整个单词。 下面是一个例子:

+ `some_thing`: `an_example_thing`

请注意,#210 计划进行 UX 改进

伙计们,我们可以这样做:

+ Parameters
     + `grant_type`: `refresh_token` (string, required) - Tipo de concessão

效果很好!

好像不是真的。 如果参数和值都有下划线,则 JSON 呈现不正确。 喜欢

+ aaa_bbb: `ccc_ddd` (string, required) - Example

是的,在这种情况下,您需要用`包围aaa_bbb `

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

annappropriate picture annappropriate  ·  5评论

spark-developer picture spark-developer  ·  12评论

alronlam picture alronlam  ·  4评论

danilvalov picture danilvalov  ·  3评论

agougousis picture agougousis  ·  8评论