{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/oss-review-toolkit-repository-configuration/_shared/latest--package-configuration-schema.json",
  "title": "ORT package configuration",
  "description": "The OSS-Review-Toolkit (ORT) provides a possibility to define path excludes and license finding curations for a specific package (dependency) and provenance in a package configuration file. A full list of all available options can be found at <https://oss-review-toolkit.org/ort/docs/configuration/package-configurations>.",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/oss-review-toolkit/ort/main/integrations/schemas/package-configuration-schema.json",
    "sourceSha256": "ee7ca0dbc248e53c78b273a12848efc1a2829b0dad47a1e80b12f29fe97d27bc"
  },
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "license_finding_curations": {
      "items": {
        "$ref": "#/$defs/licenseFindingCurations"
      },
      "type": "array"
    },
    "path_excludes": {
      "items": {
        "properties": {
          "comment": {
            "type": "string"
          },
          "pattern": {
            "type": "string"
          },
          "reason": {
            "$ref": "#/$defs/pathExcludeReason"
          }
        },
        "required": [
          "pattern",
          "reason"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "vcs": {
      "$ref": "#/$defs/vcsMatcher"
    },
    "source_artifact_url": {
      "type": "string"
    },
    "source_code_origin": {
      "enum": [
        "VCS",
        "ARTIFACT"
      ]
    }
  },
  "not": {
    "description": "A package configuration must contain at most one of 'vcs', 'source_artifact_url', or 'source_code_origin'.",
    "anyOf": [
      {
        "allOf": [
          {
            "required": [
              "vcs"
            ]
          },
          {
            "required": [
              "source_artifact_url"
            ]
          }
        ]
      },
      {
        "allOf": [
          {
            "required": [
              "vcs"
            ]
          },
          {
            "required": [
              "source_code_origin"
            ]
          }
        ]
      },
      {
        "allOf": [
          {
            "required": [
              "source_artifact_url"
            ]
          },
          {
            "required": [
              "source_code_origin"
            ]
          }
        ]
      }
    ]
  },
  "$defs": {
    "licenseFindingCurationReason": {
      "enum": [
        "CODE",
        "DATA_OF",
        "DOCUMENTATION_OF",
        "INCORRECT",
        "NOT_DETECTED",
        "REFERENCE"
      ]
    },
    "licenseFindingCurations": {
      "properties": {
        "comment": {
          "type": "string"
        },
        "concluded_license": {
          "type": "string"
        },
        "detected_license": {
          "type": "string"
        },
        "line_count": {
          "type": "integer"
        },
        "path": {
          "type": "string"
        },
        "reason": {
          "$ref": "#/$defs/licenseFindingCurationReason"
        },
        "start_lines": {
          "type": [
            "integer",
            "string"
          ]
        }
      },
      "required": [
        "path",
        "concluded_license",
        "reason"
      ],
      "type": "object"
    },
    "pathExcludeReason": {
      "enum": [
        "BUILD_TOOL_OF",
        "DATA_FILE_OF",
        "DOCUMENTATION_OF",
        "EXAMPLE_OF",
        "OPTIONAL_COMPONENT_OF",
        "OTHER",
        "PROVIDED_BY",
        "TEST_OF",
        "TEST_TOOL_OF"
      ]
    },
    "vcsMatcher": {
      "anyOf": [
        {
          "required": [
            "type"
          ]
        },
        {
          "required": [
            "url"
          ]
        },
        {
          "required": [
            "revision"
          ]
        },
        {
          "required": [
            "path"
          ]
        }
      ],
      "properties": {
        "path": {
          "type": "string"
        },
        "revision": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "id"
  ]
}
