{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$comment": "DEPRECATED: The canonical schema is now maintained at https://github.com/scanoss/schema/blob/main/scanoss-settings-schema.json",
  "title": "Scanoss Settings",
  "type": "object",
  "properties": {
    "self": {
      "type": "object",
      "description": "Description of the project under analysis",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the project"
        },
        "license": {
          "type": "string",
          "description": "License of the project"
        },
        "description": {
          "type": "string",
          "description": "Description of the project"
        }
      }
    },
    "settings": {
      "type": "object",
      "description": "Scan settings and other configurations",
      "properties": {
        "skip": {
          "type": "object",
          "description": "Set of rules to skip files from fingerprinting and scanning",
          "properties": {
            "patterns": {
              "type": "object",
              "properties": {
                "scanning": {
                  "type": "array",
                  "description": "List of glob patterns to skip files from scanning",
                  "items": {
                    "type": "string",
                    "examples": [
                      "path/to/folder",
                      "path/to/folder/**",
                      "path/to/folder/**/*",
                      "path/to/file.c",
                      "path/to/another/file.py",
                      "**/*.ts",
                      "**/*.json"
                    ]
                  },
                  "uniqueItems": true
                },
                "fingerprinting": {
                  "type": "array",
                  "description": "List of glob patterns to skip files from fingerprinting",
                  "items": {
                    "type": "string",
                    "examples": [
                      "path/to/folder",
                      "path/to/folder/**",
                      "path/to/folder/**/*",
                      "path/to/file.c",
                      "path/to/another/file.py",
                      "**/*.ts",
                      "**/*.json"
                    ]
                  },
                  "uniqueItems": true
                }
              }
            },
            "sizes": {
              "type": "object",
              "description": "Set of rules to skip files based on their size.",
              "properties": {
                "scanning": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "patterns": {
                        "type": "array",
                        "description": "List of glob patterns to apply the min/max size rule",
                        "items": {
                          "type": "string",
                          "examples": [
                            "path/to/folder",
                            "path/to/folder/**",
                            "path/to/folder/**/*",
                            "path/to/file.c",
                            "path/to/another/file.py",
                            "**/*.ts",
                            "**/*.json"
                          ]
                        }
                      },
                      "min": {
                        "type": "integer",
                        "description": "Minimum size of the file in bytes"
                      },
                      "max": {
                        "type": "integer",
                        "description": "Maximum size of the file in bytes"
                      }
                    }
                  }
                },
                "fingerprinting": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "patterns": {
                        "type": "array",
                        "description": "List of glob patterns to apply the min/max size rule",
                        "items": {
                          "type": "string"
                        },
                        "examples": [
                          "path/to/folder",
                          "path/to/folder/**",
                          "path/to/folder/**/*",
                          "path/to/file.c",
                          "path/to/another/file.py",
                          "**/*.ts",
                          "**/*.json"
                        ]
                      },
                      "min": {
                        "type": "integer",
                        "description": "Minimum size of the file in bytes"
                      },
                      "max": {
                        "type": "integer",
                        "description": "Maximum size of the file in bytes"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "proxy": {
          "type": "object",
          "description": "Proxy configuration for API requests",
          "properties": {
            "host": {
              "type": "string",
              "description": "Proxy host URL"
            }
          }
        },
        "http_config": {
          "type": "object",
          "description": "HTTP configuration for API requests",
          "properties": {
            "base_uri": {
              "type": "string",
              "description": "Base URI for API requests"
            },
            "ignore_cert_errors": {
              "type": "boolean",
              "description": "Whether to ignore certificate errors"
            }
          }
        },
        "file_snippet": {
          "type": "object",
          "description": "File snippet scanning configuration",
          "properties": {
            "proxy": {
              "type": "object",
              "description": "Proxy configuration for file snippet requests",
              "properties": {
                "host": {
                  "type": "string",
                  "description": "Proxy host URL"
                }
              }
            },
            "http_config": {
              "type": "object",
              "description": "HTTP configuration for file snippet requests",
              "properties": {
                "base_uri": {
                  "type": "string",
                  "description": "Base URI for file snippet API requests"
                },
                "ignore_cert_errors": {
                  "type": "boolean",
                  "description": "Whether to ignore certificate errors"
                }
              }
            },
            "ranking_enabled": {
              "type": ["boolean", "null"],
              "description": "Enable/disable ranking",
              "default": null
            },
            "ranking_threshold": {
              "type": ["integer", "null"],
              "description": "Ranking threshold value. A value of -1 defers to server configuration",
              "minimum": -1,
              "maximum": 10,
              "default": -1
            },
            "min_snippet_hits": {
              "type": "integer",
              "description": "Minimum snippet hits required",
              "minimum": 0,
              "default": 0
            },
            "min_snippet_lines": {
              "type": "integer",
              "description": "Minimum snippet lines required",
              "minimum": 0,
              "default": 0
            },
            "honour_file_exts": {
              "type": ["boolean", "null"],
              "description": "Ignores file extensions. When not set, defers to server configuration.",
              "default": true
            },
            "dependency_analysis": {
              "type": "boolean",
              "description": "Enable dependency analysis"
            },
            "skip_headers": {
              "type": "boolean",
              "description": "Skip license headers, comments and imports at the beginning of files",
              "default": false
            },
            "skip_headers_limit": {
              "type": "integer",
              "description": "Maximum number of lines to skip when filtering headers",
              "default": 0
            }
          }
        }
      }
    },
    "bom": {
      "type": "object",
      "description": "BOM Rules: Set of rules that will be used to modify the BOM before and after the scan is completed",
      "properties": {
        "include": {
          "type": "array",
          "description": "Set of rules to be added as context when scanning. This list will be sent as payload to the API.",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string",
                "description": "File path",
                "examples": ["/path/to/file", "/path/to/another/file"],
                "items": {
                  "type": "string"
                },
                "uniqueItems": true
              },
              "purl": {
                "type": "string",
                "description": "Package URL to be used to match the component",
                "examples": [
                  "pkg:npm/vue@2.6.12",
                  "pkg:golang/github.com/golang/go@1.17.3"
                ]
              },
              "comment": {
                "type": "string",
                "description": "Additional notes or comments"
              }
            },
            "uniqueItems": true,
            "required": ["purl"]
          }
        },
        "remove": {
          "type": "array",
          "description": "Set of rules that will remove files from the results file after the scan is completed.",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string",
                "description": "File path",
                "examples": ["/path/to/file", "/path/to/another/file"]
              },
              "purl": {
                "type": "string",
                "description": "Package URL",
                "examples": [
                  "pkg:npm/vue@2.6.12",
                  "pkg:golang/github.com/golang/go@1.17.3"
                ]
              },
              "comment": {
                "type": "string",
                "description": "Additional notes or comments"
              }
            },
            "uniqueItems": true,
            "required": ["purl"]
          }
        },
        "replace": {
          "type": "array",
          "description": "Set of rules that will replace components with the specified one after the scan is completed.",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string",
                "description": "File path",
                "examples": ["/path/to/file", "/path/to/another/file"]
              },
              "purl": {
                "type": "string",
                "description": "Package URL to replace",
                "examples": [
                  "pkg:npm/vue@2.6.12",
                  "pkg:golang/github.com/golang/go@1.17.3"
                ]
              },
              "comment": {
                "type": "string",
                "description": "Additional notes or comments"
              },
              "license": {
                "type": "string",
                "description": "License of the component. Should be a valid SPDX license expression",
                "examples": ["MIT", "Apache-2.0"]
              },
              "replace_with": {
                "type": "string",
                "description": "Package URL to replace with",
                "examples": [
                  "pkg:npm/vue@2.6.12",
                  "pkg:golang/github.com/golang/go@1.17.3"
                ]
              }
            },
            "uniqueItems": true,
            "required": ["purl", "replace_with"]
          }
        }
      }
    }
  }
}

