{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://reqview.com/schemas/2.22/common.json",
  "title": "ReqView Common Data Definitions",

  "definitions": {

    "nonEmptyString": {
      "description": "Non empty string",
      "type": "string",
      "minLength": 1
    },

    "nonWhiteSpaceString": {
      "description": "Non empty and non white space only string",
      "type": "string",
      "pattern": "\\S+"
    },

    "numberString": {
        "description": "Non-empty string containing digits",
        "type": "string",
        "pattern": "^\\d+$"
    },

    "guid": {
      "description": "Globally unique ID",
      "$ref": "#/definitions/nonEmptyString",
      "examples": ["e5c6889e-97da-4252-a849-1e62a1f9445d"]
    },

    "timeStamp": {
      "description": "Date and time in ISO 8601 format",
      "type": "string",
      "format": "date-time",
      "examples": ["2019-03-15T13:37:45.791Z"]
    },

    "fileName": {
      "description": "File name",
      "type": "string",
      "pattern": "^[^<>:\"/\\\\|?*]+$"
    },

    "filePath": {
      "description": "Relative or absolute file path",
      "type": "string",
      "pattern": "^[^<>\"\\\\|?*]+$"
    },

    "projDocId": {
      "description": "Document ID (including linked document ID)",
      "$comment": "See also document.json#/definitions/projDocObjId.",
      "type": "string",
      "pattern": "^([^<>:\"/\\\\|?*]+/)?[^<>:\"/\\\\|?*]+$",
      "examples": ["SRS", "Project2/NEEDS"]
    },

    "user": {
      "description": "ReqView user",
      "type": "object",
      "properties": {
        "name": { "$ref": "#/definitions/nonEmptyString" },
        "email": {
          "type": "string",
          "format": "email"
        },
        "company": { "type": "string" }
      },
      "required": ["name", "email"],
      "examples": [{
        "name": "John Doe",
        "email": "john.doe@reqview.com",
        "company": "ReqView"
      }]
    },

    "integrationsBase": {
      "type": "object",
      "patternProperties": {
        "^[\\w-]+$": {
          "description": "Allow any other property matching key regexp for possible backward compatibility."
        }
      },
      "additionalProperties": false
    }

  }
}
