{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/specflow/main/json-schema/specflow-feature-schema.json",
  "title": "SpecFlow Feature",
  "description": "Represents a Gherkin feature file containing related BDD scenarios",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The feature name in natural language"
    },
    "description": {
      "type": "string",
      "description": "Multi-line description of the feature providing business context"
    },
    "tags": {
      "type": "array",
      "items": {"type": "string"},
      "description": "Tags applied to all scenarios in this feature"
    },
    "background": {
      "type": "object",
      "description": "Optional Background block with steps that run before each scenario",
      "properties": {
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "keyword": {"type": "string", "enum": ["Given", "When", "Then", "And", "But"]},
              "text": {"type": "string"}
            },
            "required": ["keyword", "text"]
          }
        }
      }
    },
    "scenarios": {
      "type": "array",
      "description": "List of scenarios defined in this feature",
      "items": {
        "$ref": "#/definitions/ScenarioRef"
      }
    },
    "language": {
      "type": "string",
      "default": "en",
      "description": "The language of the Gherkin keywords (ISO 639-1 code)"
    }
  },
  "required": ["name", "scenarios"],
  "definitions": {
    "ScenarioRef": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["Scenario", "ScenarioOutline"],
          "description": "Whether this is a regular scenario or a scenario outline with examples"
        },
        "title": {"type": "string"},
        "tags": {"type": "array", "items": {"type": "string"}},
        "steps": {"type": "array"},
        "examples": {"type": "array"}
      },
      "required": ["type", "title", "steps"]
    }
  }
}
