Api-blueprint: Nullable-Typ funktioniert nicht innerhalb der Methodendeklaration

Erstellt am 13. Apr. 2016  ·  3Kommentare  ·  Quelle: apiaryio/api-blueprint

Ich versuche, in meinem mson folgenden Beispiel in der Dokumentation einen nullbaren Typ zu verwenden, aber es schlägt mit einem semantischen Fehler fehl.

Bitte helfen Sie mir herauszufinden, was mit meinem mson nicht stimmt und wie ich die richtige Dokumentation für meinen Anwendungsfall erstellen kann.

Vielen Dank!

Apiary.io Question

Hilfreichster Kommentar

Ich möchte nur darauf hinweisen, dass dies jetzt für Apiary bereitgestellt wurde (ohne Beta).

Als Beispiel können Sie nullable wie folgt verwenden:

+ 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

Wobei dies zu einer Beispielnutzlast der folgenden führen würde:

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

Zusammen mit dem folgenden JSON-Schema:

{
  "$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"
    }
  }
}

Die Attributtabelle in Apiary erwähnt noch nicht, dass der Wert nullable ist , aber das kommt noch.

screen shot 2016-06-20 at 17 46 45

Alle 3 Kommentare

Hallo @danilvalov , Apiary verwendet nicht die neueste Version des API Blueprint

Apiary verfügt über eine Betaversion zur Verbesserung des Rendering von Attributen, die die Unterstützung für NULL-Zulässigkeit umfasst. Weitere Informationen zur Beta finden Sie unter https://github.com/apiaryio/api-blueprint/issues/191#issuecomment -178044764 und wie Sie daran teilnehmen können.

Grüße,

Kyle

Ich möchte nur darauf hinweisen, dass dies jetzt für Apiary bereitgestellt wurde (ohne Beta).

Als Beispiel können Sie nullable wie folgt verwenden:

+ 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

Wobei dies zu einer Beispielnutzlast der folgenden führen würde:

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

Zusammen mit dem folgenden JSON-Schema:

{
  "$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"
    }
  }
}

Die Attributtabelle in Apiary erwähnt noch nicht, dass der Wert nullable ist , aber das kommt noch.

screen shot 2016-06-20 at 17 46 45

Dies ist jetzt in ApiaryUI sichtbar:
image

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen

Verwandte Themen

zatziky picture zatziky  ·  4Kommentare

basickarl picture basickarl  ·  7Kommentare

robbinjanssen picture robbinjanssen  ·  6Kommentare

rodriguise picture rodriguise  ·  11Kommentare

agougousis picture agougousis  ·  8Kommentare