Sitelet https://github.com/apiaryio/mson/blob/master/rendering/nullable.md
Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Latest commit

 

History

History
96 lines (60 loc) · 1.08 KB

File metadata and controls

96 lines (60 loc) · 1.08 KB

Rendering recommendation

These are the recommendation for rendering an instance of a nullable type without any other sample value provided.

JavaScript, JSON, YAML

null value

JSON Schema

{ "type": [ "string", "null" ] }

(instance of a nullable string type)

XML

xsi:nil="true" attribute

Swift, GO

nil value

C++, C, PHP, SQL

NULL value

Python

None value

Ruby

nil value

PERL

undef value

Rendering with other type attributes

optional

- key (string, optional)

The instance of key will be omitted in the rendered JSON:

{}

optional, nullable

- key (string, optional, nullable)

The value of the instance will be unset in the rendered JSON:

{
  "key": null
}

required

- key (string, required)

The value of instance will be empty in the rendered JSON:

{
  "key": ""
}

required, nullable

- key (string, required, nullable)

The value of instance of key will be unset in the rendered JSON:

{
  "key": null
}