{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rivery/json-schema/rivery-add-connection-input-schema.json",
  "title": "AddConnectionInput",
  "description": "The request body for creating a connection.\n\nProvide either a ``source_name`` (the name of a data source or target - call the\n``get_connection_source_names`` endpoint to list them) or an explicit ``connection_type``;\nthe connection type is resolved from whichever is given. The connection-type-specific\nproperties (host, password, warehouse, etc.) are passed as extra top-level fields. To\ndiscover exactly which properties a connection type needs, call the ``get_connection_type``\nendpoint (GET /connections_types/{connection_type}).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rivery-connections-api-openapi.yml#/components/schemas/AddConnectionInput",
  "properties": {
    "source_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Source Name",
      "description": "Optional. The source_name of the data source or target the connection is created for; the connection type is resolved from it. Provide this or 'connection_type'. Do not guess this value: call the 'get_connection_source_names' endpoint first and use one of the returned source_names verbatim."
    },
    "connection_name": {
      "type": "string",
      "title": "Connection Name",
      "description": "The name of the connection"
    },
    "segment": {
      "anyOf": [
        {
          "$ref": "#/$defs/ConnectionSegmentEnum"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional. Disambiguates a source_name that is available as both a source and a target (e.g. 'snowflake'). One of 'source' or 'target'."
    },
    "connection_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Connection Type",
      "description": "Optional. The connection type. When omitted it is resolved from 'source_name'. When provided it is validated to exist and takes precedence. Do not guess this value: resolve it from 'source_name' by calling 'get_connection_source_names' and using the 'connection_type' on the matching entry."
    }
  },
  "additionalProperties": true,
  "type": "object",
  "required": [
    "connection_name"
  ],
  "$defs": {
    "ConnectionSegmentEnum": {
      "type": "string",
      "enum": [
        "source",
        "target"
      ],
      "title": "ConnectionSegmentEnum",
      "description": "The segment a connection is created for, used to disambiguate a source_name that is\navailable as both a source and a target (e.g. \"snowflake\")."
    }
  }
}