schemars 0.6.0-alpha

Generate JSON Schemas from Rust code
Documentation
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "This is the enum's title",
  "description": "This is the enum's description.",
  "anyOf": [
    {
      "enum": [
        "UndocumentedUnit",
        "DocumentedUnit"
      ]
    },
    {
      "title": "Complex variant",
      "description": "This is a struct-like variant.",
      "type": "object",
      "required": [
        "Complex"
      ],
      "properties": {
        "Complex": {
          "type": "object",
          "required": [
            "my_nullable_string"
          ],
          "properties": {
            "my_nullable_string": {
              "title": "A nullable string",
              "description": "This field is a nullable string.\n\nThis is the second line!\n\nAnd this is the third!",
              "type": [
                "string",
                "null"
              ]
            }
          }
        }
      }
    }
  ]
}