Open Presentation

Search docs

Loading documentation…
    OpenPresentation/opf
    Browse docs
    On this page
    View source

    Data Source Choice

    Where the data came from: the id of an entry in the top-level datasources map (a string, always an id), or a data source written inline, { "src": "./revenue.csv" }. An unknown id is a 'datasource-unknown' error. Engines never read, fetch or refresh it.

    Metadata

    Definition
    #/$defs/DataSourceChoice
    Form
    2 alternative forms (oneOf)
    Source
    spec/schemas/opf.schema.json

    Field index

    This definition uses the forms or value constraints below.

    oneOf 1 · ref:DataSourceId

    Referenced DataSourceId · string

    Id of an entry in the top-level datasources map (the datasets id pattern). A string 'datasource' is only ever such an id; a file or a URL is written as an inline data source object, { "src": "./revenue.csv" }.

    Exact constraints for Referenced DataSourceId
    Referenced DataSourceId schema
    {
      "type": "string",
      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]*$",
      "description": "Id of an entry in the top-level datasources map (the datasets id pattern). A string 'datasource' is only ever such an id; a file or a URL is written as an inline data source object, { \"src\": \"./revenue.csv\" }.",
      "examples": [
        "warehouse",
        "finance-workbook"
      ]
    }
    Exact constraints for oneOf 1
    oneOf 1 schema
    {
      "$ref": "#/$defs/DataSourceId"
    }

    oneOf 2 · ref:DataSource

    Referenced DataSource · object

    A place data comes from: what it is and on what terms, not what was taken from it or when (that is the dataset's). Engines never read, fetch or refresh it; they keep it through editing, export and re-import. It never holds credentials: no password, token or key in 'src' or anywhere else (opf/datasource-credentials warns about a user and password in 'src' and a key or token in its query string); a host keeps secrets in its own store and names the connection in 'connector' or 'extensions'.

    FieldTypeReq.DefaultDescription
    titlestring——Human name of the data source, shown by editors.
    descriptionstring——Free-form note about the data source.
    connectorstring——The kind of data source, in the host's or the author's words: a name a tool recognizes, such as 'csv', 'xlsx', 'postgres', 'bigquery' or 'rest'. Engines do not interpret it. It also says what language a dataset's 'query' is written in.
    srcstring——Where the data is: an 'asset:<id>' reference, a URL, or a relative or local path. A URL carries no credentials.
    licensestring——The terms the data is under: an SPDX license identifier or a short statement. It travels with the data.
    refreshEverystring——How often the data is meant to be taken again, as an ISO 8601 duration. No engine acts on it. A validator given a date warns when a dataset's 'retrieved' is older than this (opf/dataset-stale).
    extensionsobject——Custom data passthrough, for example the connection settings a host owns; ignored by the engine but preserved across read/write round-trips. Never credentials.

    title

    typestringrequirednodefault—

    Human name of the data source, shown by editors.

    title.json
    {
      "title": "Finance warehouse"
    }

    description

    typestringrequirednodefault—

    Free-form note about the data source.

    description.json
    {
      "description": "Finance export, unaudited"
    }

    connector

    typestringrequirednodefault—

    The kind of data source, in the host's or the author's words: a name a tool recognizes, such as 'csv', 'xlsx', 'postgres', 'bigquery' or 'rest'. Engines do not interpret it. It also says what language a dataset's 'query' is written in.

    connector.json
    {
      "connector": "xlsx"
    }

    src

    typestringrequirednodefault—

    Where the data is: an 'asset:<id>' reference, a URL, or a relative or local path. A URL carries no credentials.

    src.json
    {
      "src": "./data/revenue.csv"
    }

    license

    typestringrequirednodefault—

    The terms the data is under: an SPDX license identifier or a short statement. It travels with the data.

    license.json
    {
      "license": "CC-BY-4.0"
    }

    refreshEvery

    typestringrequirednodefault—pattern^P(?=\d|T\d)(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+(?:\.\d+)?S)?)?$

    How often the data is meant to be taken again, as an ISO 8601 duration. No engine acts on it. A validator given a date warns when a dataset's 'retrieved' is older than this (opf/dataset-stale).

    refreshEvery.json
    {
      "refreshEvery": "P1D"
    }

    extensions

    typeobjectrequirednodefault—

    Custom data passthrough, for example the connection settings a host owns; ignored by the engine but preserved across read/write round-trips. Never credentials.

    Exact constraints for Referenced DataSource
    Referenced DataSource schema
    {
      "type": "object",
      "additionalProperties": false,
      "description": "A place data comes from: what it is and on what terms, not what was taken from it or when (that is the dataset's). Engines never read, fetch or refresh it; they keep it through editing, export and re-import. It never holds credentials: no password, token or key in 'src' or anywhere else (opf/datasource-credentials warns about a user and password in 'src' and a key or token in its query string); a host keeps secrets in its own store and names the connection in 'connector' or 'extensions'.",
      "properties": {
        "title": {
          "type": "string",
          "description": "Human name of the data source, shown by editors.",
          "examples": [
            "Finance warehouse"
          ]
        },
        "description": {
          "type": "string",
          "description": "Free-form note about the data source.",
          "examples": [
            "Finance export, unaudited"
          ]
        },
        "connector": {
          "type": "string",
          "description": "The kind of data source, in the host's or the author's words: a name a tool recognizes, such as 'csv', 'xlsx', 'postgres', 'bigquery' or 'rest'. Engines do not interpret it. It also says what language a dataset's 'query' is written in.",
          "examples": [
            "xlsx",
            "postgres",
            "rest"
          ]
        },
        "src": {
          "type": "string",
          "description": "Where the data is: an 'asset:<id>' reference, a URL, or a relative or local path. A URL carries no credentials.",
          "examples": [
            "./data/revenue.csv",
            "asset:revenue",
            "https://cdn.acme.com/data/revenue.csv"
          ]
        },
        "license": {
          "type": "string",
          "description": "The terms the data is under: an SPDX license identifier or a short statement. It travels with the data.",
          "examples": [
            "CC-BY-4.0",
            "Internal use only"
          ]
        },
        "refreshEvery": {
          "type": "string",
          "pattern": "^P(?=\\d|T\\d)(?:\\d+Y)?(?:\\d+M)?(?:\\d+W)?(?:\\d+D)?(?:T(?=\\d)(?:\\d+H)?(?:\\d+M)?(?:\\d+(?:\\.\\d+)?S)?)?$",
          "description": "How often the data is meant to be taken again, as an ISO 8601 duration. No engine acts on it. A validator given a date warns when a dataset's 'retrieved' is older than this (opf/dataset-stale).",
          "examples": [
            "P1D",
            "P1W",
            "P3M",
            "PT6H"
          ]
        },
        "extensions": {
          "type": "object",
          "description": "Custom data passthrough, for example the connection settings a host owns; ignored by the engine but preserved across read/write round-trips. Never credentials."
        }
      },
      "examples": [
        {
          "title": "Finance warehouse",
          "connector": "postgres",
          "src": "postgres://warehouse.acme.com/finance",
          "license": "Internal use only",
          "refreshEvery": "P1D"
        }
      ]
    }
    Exact constraints for oneOf 2
    oneOf 2 schema
    {
      "$ref": "#/$defs/DataSource"
    }
    Complete definition constraints
    Schema constraints
    {
      "description": "Where the data came from: the id of an entry in the top-level datasources map (a string, always an id), or a data source written inline, { \"src\": \"./revenue.csv\" }. An unknown id is a 'datasource-unknown' error. Engines never read, fetch or refresh it.",
      "oneOf": [
        {
          "$ref": "#/$defs/DataSourceId"
        },
        {
          "$ref": "#/$defs/DataSource"
        }
      ],
      "examples": [
        "warehouse",
        {
          "src": "./data/revenue.csv"
        }
      ]
    }