EveryMundo / emDataStandards

EveryMundo's Data Standards
7 stars 20 forks source link

Create automatic object reference for arrays #30

Open BigDataKatha opened 5 years ago

BigDataKatha commented 5 years ago

Issue: the legs object is supposed to be an array. Objective: Looking for a way to create an automatic object reference that shows legs as an array in the journey object and avoids adding an extra field, i.e. "fields" under the additionalInfo object to accomplish that.

Current legs object:

"legs": {
      "flightNumber": "EM110",
      "route": "SFO>MIA",
      "departureAirport": {
        "name": "Miami International Airport",
        "iataCode": "MIA"
      },
      "departureTime": "2027-03-04T06:35:00-08:00",
      "arrivalAirport": {
        "name": "Miami International Airport",
        "iataCode": "MIA"
      },
      "arrivalTime": "2027-03-04T13:35:00-08:00",
      "estimatedDuration": "PT6H30M",
      "departureCity": {
        "name": "San Francisco",
        "cityCode": "SFO"
      },
      "departureCountry": {
        "name": "United States",
        "isoCode": "US"
      },
      "arrivalCity": {
        "name": "Miami",
        "cityCode": "MIA"
      },
      "arrivalCountry": {
        "name": "United States",
        "isoCode": "US"
      },
      "flightType": "DOMESTIC",
      "operatingAirline": {
        "name": "EveryMundo",
        "iataCode": "EM"
      },
      "aircraft": "Boeing 747"
    },
    "departureCity": {
      "name": "San Francisco",
      "cityCode": "SFO"
    },
    "departureCountry": {
      "name": "United States",
      "isoCode": "US"
    },
    "arrivalCity": {
      "name": "New York",
      "cityCode": "NYC"
    },
    "arrivalCountry": {
      "name": "United States",
      "isoCode": "US"
    },
    "flightType": "DOMESTIC",
    "routeType": "CONNECTING",
    "discount": {
      "isDiscount": true,
      "code": "AFFBFAN",
      "amount": 500,
      "percentage": 0.5,
      "expiration": "2017-12-31"
    },
    "additionalInfo": {
      "fields": [
        {
          "name": "classOfService",
          "value": "COACH_EC"
        }
      ]
    },

Expected legs object:

"legs": [
     {
      "flightNumber": "EM110",
      "route": "SFO>MIA",
      "departureAirport": {
        "name": "Miami International Airport",
        "iataCode": "MIA"
      },
      "departureTime": "2027-03-04T06:35:00-08:00",
      "arrivalAirport": {
        "name": "Miami International Airport",
        "iataCode": "MIA"
      },
      "arrivalTime": "2027-03-04T13:35:00-08:00",
      "estimatedDuration": "PT6H30M",
      "departureCity": {
        "name": "San Francisco",
        "cityCode": "SFO"
      },
      "departureCountry": {
        "name": "United States",
        "isoCode": "US"
      },
      "arrivalCity": {
        "name": "Miami",
        "cityCode": "MIA"
      },
      "arrivalCountry": {
        "name": "United States",
        "isoCode": "US"
      },
      "flightType": "DOMESTIC",
      "operatingAirline": {
        "name": "EveryMundo",
        "iataCode": "EM"
      },
      "aircraft": "Boeing 747"
    },
    "departureCity": {
      "name": "San Francisco",
      "cityCode": "SFO"
    },
    "departureCountry": {
      "name": "United States",
      "isoCode": "US"
    },
    "arrivalCity": {
      "name": "New York",
      "cityCode": "NYC"
    },
    "arrivalCountry": {
      "name": "United States",
      "isoCode": "US"
    },
    "flightType": "DOMESTIC",
    "routeType": "CONNECTING",
    "discount": {
      "isDiscount": true,
      "code": "AFFBFAN",
      "amount": 500,
      "percentage": 0.5,
      "expiration": "2017-12-31"
    },
    "additionalInfo": [
        {
          "name": "classOfService",
          "value": "COACH_EC"
        }
      ]
   }
],

@neilgoldman , do you have an idea on how to achieve this?