{
    "description": "Defines the schema for Datasource.",
    "type": "object",
    "properties": {
        "libraryId": {
            "description": "The identifier of the Library that Datasource belongs to",
            "minLength": 3,
            "maxLength": 64,
            "type": "string"
        },
        "id": {
            "description": "The identifier of the Datasource",
            "minLength": 3,
            "maxLength": 64,
            "type": "string"
        },
        "name": {
            "description": "The name of the Datasource.",
            "minLength": 1,
            "maxLength": 128,
            "type": "string"
        },
        "description": {
            "description": "The description of the Datasource.",
            "minLength": 0,
            "maxLength": 128,
            "type": "string"
        },
        "sample": {
            "description": "A sample of the Datasource",
            "anyOf": [
                {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": true
                },
                {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {},
                        "additionalProperties": true
                    }
                }
            ]
        },
        "createdAt": {
            "description": "The timestamp the Datascource was created at",
            "type": "string",
            "format": "date-time"
        },
        "modifiedAt": {
            "description": "The timestamp when the Datascource was last modified at",
            "type": "string",
            "format": "date-time"
        },
        "sampledAt": {
            "anyOf": [
                {
                    "description": "The timestamp when the Datascource was last sampled at.",
                    "type": "string",
                    "format": "date-time"
                },
                {
                    "type": "null"
                }
            ]
        },
        "definition": {
            "description": "Definition is a data returned from external resource, that we use to extract sample data from. Having this data, we\ncan detect if upstream structure was updated.",
            "anyOf": [
                {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": true
                },
                {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {},
                        "additionalProperties": true
                    }
                },
                {
                    "type": "null"
                }
            ]
        },
        "conflictDefinition": {
            "description": "Definition of remote datasource for a conflicting datasource.",
            "anyOf": [
                {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": true
                },
                {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {},
                        "additionalProperties": true
                    }
                },
                {
                    "type": "null"
                }
            ]
        },
        "type": {
            "anyOf": [
                {
                    "description": "Datasource type (internal, xm template, etc.)",
                    "enum": [
                        "contentHubOne",
                        "internal",
                        "xmTemplate"
                    ],
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ]
        },
        "externalSourceId": {
            "description": "Id of external source. Eg: Tenant name for XM Cloud datasources, Project Id for internal datasources etc.",
            "type": [
                "string",
                "null"
            ]
        },
        "settings": {
            "type": "object",
            "properties": {
                "params": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "headers": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "jsonpath": {
                    "type": "string"
                },
                "method": {
                    "enum": [
                        "DELETE",
                        "GET",
                        "HEAD",
                        "OPTIONS",
                        "POST",
                        "PUT",
                        "UPDATE"
                    ],
                    "type": "string"
                },
                "body": {
                    "type": "object",
                    "additionalProperties": {}
                },
                "url": {
                    "type": "string"
                }
            },
            "additionalProperties": false,
            "required": [
                "body",
                "headers",
                "jsonpath",
                "method",
                "params",
                "url"
            ]
        }
    },
    "additionalProperties": false,
    "required": [
        "description",
        "id",
        "libraryId",
        "name",
        "sample",
        "settings"
    ],
    "$schema": "http://json-schema.org/draft-07/schema#"
}
