Api-blueprint: null許容型はメソッド宣言内では機能しません

作成日 2016年04月13日  ·  3コメント  ·  ソース: apiaryio/api-blueprint

ドキュメントのサンプルに続くmsonでnull許容型を使用しようとしていますが、セマンティックエラーで失敗します。

私の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には、null可能性のサポートを含む、属性レンダリングを改善するためのベータ版があります。 ベータ版の詳細については、 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 評価