Api-blueprint: الخطوط السفلية في أسماء السمات

تم إنشاؤها على ٧ يوليو ٢٠١٥  ·  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 ، يمكنك أن ترى أن _ هو حرف محجوز. الرجاء استخدام backticks للهروب من الكلمة بأكملها. هنا مثال:

+ `some_thing`: `an_example_thing`

يرجى ملاحظة أن هناك تحسين UX مخطط له في # 210

ال 4 كومينتر

مرحبًا ، إذا قرأت مواصفات MSON ، يمكنك أن ترى أن _ هو حرف محجوز. الرجاء استخدام backticks للهروب من الكلمة بأكملها. هنا مثال:

+ `some_thing`: `an_example_thing`

يرجى ملاحظة أن هناك تحسين UX مخطط له في # 210

يا رفاق يمكننا القيام بذلك:

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

يعمل بشكل رائع!

لا يبدو ذلك حقًا. إذا كان لكل من المعلمة والقيمة شرطات سفلية ، فسيتم تقديم JSON بشكل غير صحيح. يحب

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

نعم ، في هذه الحالة ، تحتاج إلى إحاطة aaa_bbb بـ `

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات