{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/mongodb/main/json-schema/mongodb-schema-advisor-response-schema.json",
  "title": "SchemaAdvisorResponse",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mongodb-performance-advisor-api-openapi.yml#/components/schemas/SchemaAdvisorResponse",
  "properties": {
    "recommendations": {
      "description": "List that contains the documents with information about the schema advice that Performance Advisor suggests.",
      "items": {
        "$ref": "#/$defs/SchemaAdvisorItemRecommendation"
      },
      "readOnly": true,
      "type": "array"
    }
  },
  "type": "object",
  "$defs": {
    "SchemaAdvisorItemRecommendation": {
      "properties": {
        "affectedNamespaces": {
          "description": "List that contains the namespaces and information on why those namespaces triggered the recommendation.",
          "items": {
            "$ref": "#/$defs/SchemaAdvisorNamespaceTriggers"
          },
          "readOnly": true,
          "type": "array"
        },
        "description": {
          "description": "Description of the specified recommendation.",
          "readOnly": true,
          "type": "string"
        },
        "recommendation": {
          "description": "Type of recommendation.",
          "enum": [
            "REDUCE_LOOKUP_OPS",
            "AVOID_UNBOUNDED_ARRAY",
            "REDUCE_DOCUMENT_SIZE",
            "REMOVE_UNNECESSARY_INDEXES",
            "REDUCE_NUMBER_OF_NAMESPACES",
            "OPTIMIZE_CASE_INSENSITIVE_REGEX_QUERIES",
            "OPTIMIZE_TEXT_QUERIES"
          ],
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "SchemaAdvisorNamespaceTriggers": {
      "properties": {
        "namespace": {
          "description": "Namespace of the affected collection. Will be null for `REDUCE_NUMBER_OF_NAMESPACE` recommendation.",
          "readOnly": true,
          "type": [
            "string",
            "null"
          ]
        },
        "triggers": {
          "description": "List of triggers that specify why the collection activated the recommendation.",
          "items": {
            "$ref": "#/$defs/SchemaAdvisorTriggerDetails"
          },
          "readOnly": true,
          "type": "array"
        }
      },
      "type": "object"
    },
    "SchemaAdvisorTriggerDetails": {
      "properties": {
        "description": {
          "description": "Description of the trigger type.",
          "readOnly": true,
          "type": "string"
        },
        "triggerType": {
          "description": "Type of trigger.",
          "enum": [
            "PERCENT_QUERIES_USE_LOOKUP",
            "NUMBER_OF_QUERIES_USE_LOOKUP",
            "DOCS_CONTAIN_UNBOUNDED_ARRAY",
            "NUMBER_OF_NAMESPACES",
            "DOC_SIZE_TOO_LARGE",
            "NUM_INDEXES",
            "QUERIES_CONTAIN_CASE_INSENSITIVE_REGEX"
          ],
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}