{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rivery/json-schema/rivery-create-connection-link-input-schema.json",
  "title": "CreateConnectionLinkInput",
  "description": "The request body for generating a connection link.\n\nThe link lets a third party work on a single connection without any access to the tenant, in\none of two modes:\n\n* **Create** a new connection - provide either a ``source_name`` (call the\n  ``get_connection_source_names`` endpoint to list them) or an explicit ``connection_type``,\n  exactly as when creating a connection.\n* **Edit an existing** connection - provide its ``connection_id``. The link then opens that\n  connection with its current values filled in, and the type is taken from the connection\n  itself.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rivery-connections-api-openapi.yml#/components/schemas/CreateConnectionLinkInput",
  "properties": {
    "connection_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Connection Id",
      "description": "Optional. The id of an existing connection to share for editing. When provided the link opens that connection with its current values filled in, and neither 'source_name' nor 'connection_type' is needed. The link can only be used on this connection - it cannot create or edit any other one."
    },
    "source_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Source Name",
      "description": "Optional. The source_name of the data source or target the link creates a connection 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 a returned source_name verbatim."
    },
    "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."
    }
  },
  "type": "object",
  "$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\")."
    }
  }
}