schemars 0.6.0-alpha

Generate JSON Schemas from Rust code
Documentation
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "External",
  "anyOf": [
    {
      "enum": [
        "unitOne",
        "unitTwo"
      ]
    },
    {
      "type": "object",
      "required": [
        "stringMap"
      ],
      "properties": {
        "stringMap": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    {
      "type": "object",
      "required": [
        "unitStructNewType"
      ],
      "properties": {
        "unitStructNewType": {
          "$ref": "#/definitions/UnitStruct"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "structNewType"
      ],
      "properties": {
        "structNewType": {
          "$ref": "#/definitions/Struct"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "struct"
      ],
      "properties": {
        "struct": {
          "type": "object",
          "required": [
            "bar",
            "foo"
          ],
          "properties": {
            "bar": {
              "type": "boolean"
            },
            "foo": {
              "type": "integer",
              "format": "int32"
            }
          }
        }
      }
    },
    {
      "type": "object",
      "required": [
        "tuple"
      ],
      "properties": {
        "tuple": {
          "type": "array",
          "items": [
            {
              "type": "integer",
              "format": "int32"
            },
            {
              "type": "boolean"
            }
          ],
          "maxItems": 2,
          "minItems": 2
        }
      }
    }
  ],
  "definitions": {
    "Struct": {
      "type": "object",
      "required": [
        "bar",
        "foo"
      ],
      "properties": {
        "bar": {
          "type": "boolean"
        },
        "foo": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "UnitStruct": {
      "type": "null"
    }
  }
}