metadata.json

This file is used by Obsrv while registering and running your connector. Here are the details of the file

Name
Description

type

Type: string Allowed Values: "connector" Specifies the type of the configuration. Must always be "connector".

metadata

Type: object Contains detailed metadata for the connector, including attributes such as id, version, tenant, and others.

id

Type: string A unique identifier for the connector.

name

Type: string The name of the connector.

version

Type: string The version of the connector.

tenant

Type: string Allowed Values: "single", "multiple" Indicates whether the connector is for a single or multiple tenants.

type

Type: string Allowed Values: "source" Specifies the type of connector, currently restricted to "source".

category

Type: string Allowed Values: "batch", "stream" The processing category of the connector.

description

Type: string A textual description of the connector.

technology

Type: string Allowed Values: "java", "scala", "python" The primary technology used by the connector.

runtime

Type: string Allowed Values: "spark", "flink" The runtime environment for the connector. If category is batch, runtime should be spark; if stream it should be flink

licence

Type: string Specifies the licence type of the connector.

owner

Type: string The owner or maintainer of the connector.

main_class

Type: string Specifies the main class of the program. Required for java or scala technologies, optional for python.

main_program

Type: string Path to the main program of the connector.

icon

Type: string or null Path or URL for the icon representing the connector. Can be null if no icon is provided.

connectors

Type: array A list of connectors associated with the configuration. Each item includes attributes like id, name, description, and icon.

Here is a sample metadata.json file for your reference

{
  "type": "connector",
  "metadata": {
    "id": "example-connector",
    "name": "Example Connector",
    "description": "Pull data from a Source",
    "type": "source",
    "tenant": "single",
    "version": "1.0.0",
    "category": "stream",
    "technology": "scala",
    "runtime": "flink",
    "licence": "MIT",
    "owner": "Sunbird",
    "main_class": "org.sunbird.obsrv.connector.ExampleConnector",
    "main_program": "example-connector-1.0.0.jar",
    "icon": "icon.svg"
  }
}

Here is the JSON Schema to validate your metadata.json

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "enum": ["connector"]
    },
    "metadata": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "tenant": {
          "type": "string",
          "enum": ["single", "multiple"]
        },
        "type": {
          "type": "string",
          "enum": ["source"]
        },
        "category": {
          "type": "string",
          "enum": ["batch", "stream"]
        },
        "description": {
          "type": "string"
        },
        "technology": {
          "type": "string",
          "enum": ["java", "scala", "python"]
        },
        "runtime": {
          "type": "string",
          "enum": ["spark", "flink"]
        },
        "licence": {
          "type": "string"
        },
        "owner": {
          "type": "string"
        },
        "main_class": {
          "type": "string"
        },
        "main_program": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "version",
        "tenant",
        "type",
        "category",
        "technology",
        "runtime",
        "licence",
        "owner",
        "main_program"
      ]
    },
    "connectors": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "icon": {
            "type": ["null", "string"]
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "icon"
        ]
      }
    }
  },
  "required": [
    "type",
    "metadata"
  ],
  "dependentSchemas": {
    "metadata": {
      "allOf": [
        {
          "anyOf": [
            {
              "properties": {
                "metadata": {
                  "properties": {
                    "tenant": {
                      "enum": ["single"]
                    }
                  },
                  "required": [
                    "id",
                    "description",
                    "version",
                    "tenant",
                    "type",
                    "category",
                    "technology",
                    "runtime",
                    "licence",
                    "owner",
                    "icon",
                    "main_program"
                  ]
                }
              },
              "not": {
                "required": ["connectors"]
              }
            },
            {
              "properties": {
                "metadata": {
                  "properties": {
                    "tenant": {
                      "enum": ["multiple"]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "version",
                    "tenant",
                    "type",
                    "category",
                    "technology",
                    "runtime",
                    "licence",
                    "owner",
                    "main_program"
                  ],
                  "not": {
                    "required": ["description"]
                  }
                },
                "connectors": {
                  "type": "array"
                }
              },
              "required": ["connectors"]
            }    
          ]
        },
        {
          "anyOf": [
            {
              "properties": {
                "metadata": {
                  "properties": {
                    "technology": {
                      "enum": ["python"]
                    }
                  },
                  "not": {
                     "required": ["main_class"]
                  }
                }
              }
            },
            {
              "properties": {
                "metadata": {
                  "properties": {
                    "technology": {
                      "enum": ["java", "scala"]
                    }
                  },
                  "required": ["main_class"]
                }
              }
            }
          ]
        },
        {
          "oneOf": [
            {
              "properties": {
                "metadata": {
                  "properties": {
                    "runtime": {
                      "enum": ["flink"]
                    },
                    "technology": {
                      "not": {
                        "enum": ["python"]
                      }
                    }
                  }
                }
              }
            },
            {
              "properties": {
                "metadata": {
                  "properties": {
                    "runtime": {
                      "enum": ["spark"]
                    },
                    "technology": {
                      "enum": ["python", "java", "scala"]
                    }
                  }
                }
              }
            }
          ]
        }
      ]
    }
  }
}

Last updated