{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/the-trivia-api-com/json-schema/the-trivia-api-com-text-input-question-schema.json",
  "title": "TextInputQuestion",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/the-trivia-api-com-openapi.yml#/components/schemas/TextInputQuestion",
  "allOf": [
    {
      "$ref": "#/$defs/BaseQuestion"
    },
    {
      "type": "object",
      "properties": {
        "question": {
          "type": "object",
          "properties": {
            "text": {
              "type": "string",
              "description": "String formulation of the question"
            }
          },
          "required": [
            "text"
          ]
        },
        "correctAnswer": {
          "type": "string",
          "description": "The \"gold standard\" correct answer"
        },
        "acceptedAnswers": {
          "type": "array",
          "description": "Cached list of accepted answer variations (only returned if showAnswer=true)",
          "items": {
            "type": "string"
          }
        },
        "correctAnswerRatio": {
          "type": "object",
          "description": "How often this question has been answered correctly vs incorrectly",
          "properties": {
            "correct": {
              "type": "number",
              "description": "Number of correct answers recorded"
            },
            "incorrect": {
              "type": "number",
              "description": "Number of incorrect answers recorded"
            }
          },
          "required": [
            "correct",
            "incorrect"
          ]
        },
        "hint": {
          "type": "string",
          "description": "A one-sentence clue to show before the player answers, if they ask for one. It points towards the answer without giving it away. Optional: not every question has one yet, and it is currently only returned for English requests."
        },
        "explanation": {
          "type": "string",
          "description": "One or two sentences to show after the player answers, saying why the correct answer is right or adding a related fact. It names the correct answer, so it is not returned when showAnswer=false. Optional: not every question has one yet, and it is currently only returned for English requests."
        },
        "type": {
          "type": "string",
          "enum": [
            "text_input"
          ]
        }
      },
      "required": [
        "question",
        "correctAnswer",
        "correctAnswerRatio",
        "type"
      ]
    }
  ],
  "$defs": {
    "BaseQuestion": {
      "type": "object",
      "properties": {
        "category": {
          "type": "string",
          "$ref": "#/$defs/Category"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier for the question"
        },
        "tags": {
          "type": "array",
          "description": "Secondary categories for the question. More freeform than category (can take any value), and can have multiple tags per question.",
          "items": {
            "type": "string"
          }
        },
        "difficulty": {
          "type": "string",
          "enum": [
            "easy",
            "medium",
            "hard"
          ],
          "description": "How difficult the question is perceived to be by the moderators of the API."
        },
        "regions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "If the question is regional (i.e. only reasonable to ask people from a particular set of countries), then the ISO 3166-1 alpha-2 country codes for those countries are specified here.\n\nFor most questions, this will be an empty array, meaning that the question is suitable to ask to people from anywhere in the world."
        },
        "isNiche": {
          "type": "boolean",
          "description": "Will be true if the question is a niche question, i.e. if it is considered too difficult to return unless the tag is specifically requested."
        }
      },
      "required": [
        "category",
        "id",
        "tags",
        "isNiche",
        "difficulty"
      ]
    },
    "Category": {
      "type": "string",
      "enum": [
        "music",
        "sport_and_leisure",
        "film_and_tv",
        "arts_and_literature",
        "history",
        "society_and_culture",
        "science",
        "geography",
        "food_and_drink",
        "general_knowledge"
      ]
    }
  }
}