{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://travel.example/schemas/flight-itinerary-1.json",
  "title": "Flight itinerary attributes",
  "description": "Service-defined attributes for one scheduled passenger flight itinerary.",
  "type": "object",
  "required": [
    "operating_carrier",
    "flight_number",
    "departure",
    "arrival",
    "cabin"
  ],
  "additionalProperties": false,
  "properties": {
    "operating_carrier": {
      "type": "string",
      "title": "Operating carrier",
      "description": "IATA airline designator for the carrier operating the flight.",
      "pattern": "^[A-Z0-9]{2}$",
      "x-odp-comparison": "exact"
    },
    "flight_number": {
      "type": "string",
      "title": "Flight number",
      "description": "Carrier-assigned flight number without the carrier designator.",
      "pattern": "^[0-9]{1,4}[A-Z]?$",
      "x-odp-comparison": "exact"
    },
    "departure": {
      "$ref": "#/$defs/flight_point",
      "title": "Departure"
    },
    "arrival": {
      "$ref": "#/$defs/flight_point",
      "title": "Arrival"
    },
    "cabin": {
      "type": "string",
      "title": "Cabin",
      "description": "Cabin marketed for this itinerary.",
      "enum": [
        "economy",
        "premium-economy",
        "business",
        "first"
      ],
      "x-odp-comparison": "exact"
    },
    "included_checked_bags": {
      "type": "integer",
      "title": "Included checked bags",
      "description": "Number of checked bags included before traveler-specific exceptions.",
      "minimum": 0,
      "x-odp-unit": {
        "code": "bag"
      },
      "x-odp-comparison": "numeric"
    },
    "refundable": {
      "type": "boolean",
      "title": "Refundable",
      "description": "Whether the advertised fare class permits a refund under its referenced fare rules.",
      "x-odp-comparison": "exact"
    }
  },
  "$defs": {
    "flight_point": {
      "type": "object",
      "required": [
        "airport",
        "scheduled_at"
      ],
      "additionalProperties": false,
      "properties": {
        "airport": {
          "type": "string",
          "title": "Airport",
          "description": "IATA location code for the airport.",
          "pattern": "^[A-Z]{3}$",
          "x-odp-comparison": "exact"
        },
        "scheduled_at": {
          "type": "string",
          "format": "date-time",
          "title": "Scheduled time",
          "description": "Scheduled event time including its UTC offset.",
          "x-odp-comparison": "temporal"
        },
        "terminal": {
          "type": "string",
          "title": "Terminal",
          "description": "Terminal label supplied by the airport or carrier.",
          "x-odp-comparison": "exact"
        }
      }
    }
  }
}
