Docs
include

include

The include generator includes another schema file and uses it as a generator. This is useful for reusing common schema definitions across multiple files.

The generator takes the following arguments:

  • path: The path to the schema file to include. This can be either absolute or relative to the current working directory.

Example

schema.json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "include",
      "path": "common/name.json"
    },
    "age": {
      "type": "include",
      "path": "common/age.json"
    }
  }
}
common/name.json
{
  "type": "string",
  "generator": {
    "type": "fullName"
  }
}
common/age.json
{
  "type": "number",
  "generator": {
    "type": "number",
    "min": 18,
    "max": 100
  }
}