{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/theusedcarindex-com/json-schema/theusedcarindex-com-comparison-schema.json",
  "title": "Comparison",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/theusedcarindex-com-openapi.json#/components/schemas/Comparison",
  "type": "object",
  "properties": {
    "vehicles": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "vehicle": {
            "type": "object"
          },
          "not_found": {
            "type": "boolean"
          },
          "suggestions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "complaints": {
            "type": [
              "object",
              "null"
            ]
          },
          "recalls": {
            "type": [
              "object",
              "null"
            ]
          },
          "investigations": {
            "type": [
              "object",
              "null"
            ]
          },
          "manufacturer_communications": {
            "type": [
              "object",
              "null"
            ]
          },
          "rate": {
            "oneOf": [
              {
                "$ref": "#/$defs/Rate"
              },
              {
                "type": "null"
              }
            ]
          },
          "top_systems": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "system": {
                  "type": "string"
                },
                "count": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "required": [
                "system",
                "count"
              ]
            }
          }
        },
        "required": [
          "key",
          "vehicle",
          "not_found",
          "complaints",
          "recalls",
          "investigations",
          "manufacturer_communications",
          "rate",
          "top_systems"
        ]
      }
    },
    "comparison": {
      "type": "object",
      "properties": {
        "fewest_complaints_per_100k": {
          "type": "object",
          "properties": {
            "ordered": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "unrated": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "ordered",
            "unrated"
          ]
        },
        "most_recalls": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "most_complaints": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "fewest_complaints_per_100k",
        "most_recalls",
        "most_complaints"
      ]
    }
  },
  "required": [
    "vehicles",
    "comparison"
  ],
  "$defs": {
    "Rate": {
      "type": "object",
      "properties": {
        "complaints_per_100k_sold": {
          "type": [
            "number",
            "null"
          ]
        },
        "units_sold": {
          "type": [
            "number",
            "null"
          ]
        },
        "sales_year": {
          "type": [
            "number",
            "null"
          ]
        },
        "basis": {
          "type": [
            "string",
            "null"
          ]
        },
        "source": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "null_reason": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "complaints_per_100k_sold",
        "units_sold",
        "sales_year",
        "basis",
        "source",
        "source_url",
        "null_reason"
      ]
    }
  }
}