Search code examples
html-emailjson-ldgoogle-schemas

Google email markup tester fails to validate JSON-LD for FlightReservation


Google Email Markup fails to validate JSON-LD that I took from schema.org for FlightReservation.

Markup tools says that type of "boardingPolicy" is wrong and "airline" field is missing, it's easy to test yourself: just copy the code below and paste it there.

Does anyone know what I can fix this?

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "FlightReservation",
  "reservationId": "RXJ34P",
  "reservationStatus": "ReservationConfirmed",
  "passengerPriorityStatus": "Fast Track",
  "passengerSequenceNumber": "ABC123",
  "securityScreening": "TSA PreCheck",
  "underName": {
    "@type": "Person",
    "name": "Eva Green"
  },
  "reservationFor": {
    "@type": "Flight",
    "flightNumber": "UA110",
    "provider": {
      "@type": "Airline",
      "name": "Continental",
      "iataCode": "CO",
      "boardingPolicy": "ZoneBoardingPolicy"
    },
    "seller": {
      "@type": "Airline",
      "name": "United",
      "iataCode": "UA"
    },
    "departureAirport": {
      "@type": "Airport",
      "name": "San Francisco Airport",
      "iataCode": "SFO"
    },
    "departureTime": "2017-03-04T20:15:00-08:00",
    "arrivalAirport": {
      "@type": "Airport",
      "name": "John F. Kennedy International Airport",
      "iataCode": "JFK"
    },
    "arrivalTime": "2017-03-05T06:30:00-05:00"
  }
}
</script>

Solution

  • You need to replace reservationD with reservationNumber.

    I don't think boardingPolicy is a supported. In the documentation it states "Note: Some of the schemas used by Google are still going through the standardization process of schema.org, and therefore, may change in the future."

    Instead of seller, you should input airline.

    I've copied your script and modified a few attributes and received no errors with this example (if you're trying to trigger Google Now cards, I recommend to use a date/time that's a few hours away):

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "FlightReservation",
      "reservationNumber": "RXJ34P",
      "reservationStatus": "ReservationConfirmed",
      "passengerPriorityStatus": "Fast Track",
      "passengerSequenceNumber": "ABC123",
      "securityScreening": "TSA PreCheck",
      "underName": {
    	"@type": "Person",
    	"name": "Eva Green"
      },
      "reservationFor": {
    	"@type": "Flight",
    	"flightNumber": "UA110",
    	"provider": {
    	  "@type": "Airline",
    	  "name": "Continental",
    	  "iataCode": "CO"
    	},
    	"airline": {
    	  "@type": "Airline",
    	  "name": "United",
    	  "iataCode": "UA"
    	},
    	"departureAirport": {
    	  "@type": "Airport",
    	  "name": "San Francisco Airport",
    	  "iataCode": "SFO"
    	},
    	"departureTime": "2016-03-04T20:15:00-08:00",
    	"arrivalAirport": {
    	  "@type": "Airport",
    	  "name": "John F. Kennedy International Airport",
    	  "iataCode": "JFK"
    	},
    	"arrivalTime": "2016-03-05T06:30:00-05:00"
      }
    }
    </script>