Api-blueprint: لا يعمل النوع Nullable ضمن إعلان الأسلوب

تم إنشاؤها على ١٣ أبريل ٢٠١٦  ·  3تعليقات  ·  مصدر: apiaryio/api-blueprint

أحاول استخدام النوع nullable في العينة التالية mson في التوثيق ، لكنه فشل بسبب الخطأ الدلالي.

الرجاء مساعدتي في اكتشاف الخطأ في mson الخاص بي وكيفية عمل التوثيق الصحيح لحالة الاستخدام الخاصة بي؟

شكرا!

Apiary.io Question

التعليق الأكثر فائدة

أريد فقط أن أشير إلى أنه تم نشر هذا الآن في Apiary (بدون نسخة تجريبية).

كمثال ، يمكنك استخدام nullable مثل ما يلي:

+ Response 200 (application/json)
    + Attributes
        + example1 (string, optional, nullable) - An example optional nullable string
        + example2: value (string, optional, nullable) - An example optional nullable string with a sample value

حيث سينتج عن ذلك مثال حمولة لما يلي:

{
  "example1": null,
  "example2": "value"
}

جنبًا إلى جنب مع مخطط JSON التالي:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "example1": {
      "type": [
        "string",
        "null"
      ],
      "description": "An example optional nullable string"
    },
    "example2": {
      "type": [
        "string",
        "null"
      ],
      "description": "An example optional nullable string with a sample value"
    }
  }
}

لم يذكر جدول السمات في Apiary بعد أن القيمة لاغية ، لكن هذا قادم.

screen shot 2016-06-20 at 17 46 45

ال 3 كومينتر

مرحبًا danilvalov ، لا يستخدم

لدى Apiary إصدار تجريبي لتحسين عرض السمات ، والذي يتضمن دعم nullability. يمكنك العثور على المزيد حول الإصدار التجريبي على https://github.com/apiaryio/api-blueprint/issues/191#issuecomment -178044764 بالإضافة إلى كيفية الانضمام إليه.

يعتبر،

كايل

أريد فقط أن أشير إلى أنه تم نشر هذا الآن في Apiary (بدون نسخة تجريبية).

كمثال ، يمكنك استخدام nullable مثل ما يلي:

+ Response 200 (application/json)
    + Attributes
        + example1 (string, optional, nullable) - An example optional nullable string
        + example2: value (string, optional, nullable) - An example optional nullable string with a sample value

حيث سينتج عن ذلك مثال حمولة لما يلي:

{
  "example1": null,
  "example2": "value"
}

جنبًا إلى جنب مع مخطط JSON التالي:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "example1": {
      "type": [
        "string",
        "null"
      ],
      "description": "An example optional nullable string"
    },
    "example2": {
      "type": [
        "string",
        "null"
      ],
      "description": "An example optional nullable string with a sample value"
    }
  }
}

لم يذكر جدول السمات في Apiary بعد أن القيمة لاغية ، لكن هذا قادم.

screen shot 2016-06-20 at 17 46 45

هذا مرئي الآن في ApiaryUI :
image

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