Can I add my own custom schema if Wappler is not fetching it correctly

I have certain situation where the schema information fetched in Wappler is missing some parts.

I normally try use a fetch first, and if that works or not, I check the schema it has pulled through and if parts are missing, i then paste the data attribute and run it to try correct it, however sometimes even that method seems to not get all the schema needed. In those instances can I manually add arrays and objects to the list, and is that advisable.

Here is an example from the Amadeus API I have worked with many many times for quite a few clients.
This is the JSON inside the data attribute.

{
  "meta": {
    "count": 1,
    "links": {
      "self": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=SYD&destinationLocationCode=DXB&departureDate=2020-08-01&returnDate=2020-08-20&adults=1&max=1"
    }
  },
  "data": [
    {
      "type": "flight-offer",
      "id": "1",
      "source": "GDS",
      "instantTicketingRequired": false,
      "nonHomogeneous": false,
      "oneWay": false,
      "lastTicketingDate": "2020-08-01",
      "numberOfBookableSeats": 2,
      "itineraries": [
        {
          "duration": "PT39H15M",
          "segments": [
            {
              "departure": {
                "iataCode": "SYD",
                "terminal": "1",
                "at": "2020-08-01T09:45:00"
              },
              "arrival": {
                "iataCode": "DEL",
                "terminal": "3",
                "at": "2020-08-01T18:35:00"
              },
              "carrierCode": "AI",
              "number": "301",
              "aircraft": {
                "code": "788"
              },
              "operating": {
                "carrierCode": "AI"
              },
              "duration": "PT13H20M",
              "id": "1",
              "numberOfStops": 0,
              "blacklistedInEU": false
            },
            {
              "departure": {
                "iataCode": "DEL",
                "terminal": "3",
                "at": "2020-08-02T16:50:00"
              },
              "arrival": {
                "iataCode": "DXB",
                "terminal": "1",
                "at": "2020-08-02T19:00:00"
              },
              "carrierCode": "AI",
              "number": "915",
              "aircraft": {
                "code": "788"
              },
              "operating": {
                "carrierCode": "AI"
              },
              "duration": "PT3H40M",
              "id": "2",
              "numberOfStops": 0,
              "blacklistedInEU": false
            }
          ]
        },
        {
          "duration": "PT27H20M",
          "segments": [
            {
              "departure": {
                "iataCode": "DXB",
                "terminal": "1",
                "at": "2020-08-20T20:50:00"
              },
              "arrival": {
                "iataCode": "DEL",
                "terminal": "3",
                "at": "2020-08-21T02:00:00"
              },
              "carrierCode": "AI",
              "number": "916",
              "aircraft": {
                "code": "788"
              },
              "operating": {
                "carrierCode": "AI"
              },
              "duration": "PT3H40M",
              "id": "3",
              "numberOfStops": 0,
              "blacklistedInEU": false
            },
            {
              "departure": {
                "iataCode": "DEL",
                "terminal": "3",
                "at": "2020-08-21T13:15:00"
              },
              "arrival": {
                "iataCode": "SYD",
                "terminal": "1",
                "at": "2020-08-22T06:10:00"
              },
              "carrierCode": "AI",
              "number": "302",
              "aircraft": {
                "code": "788"
              },
              "operating": {
                "carrierCode": "AI"
              },
              "duration": "PT12H25M",
              "id": "4",
              "numberOfStops": 0,
              "blacklistedInEU": false
            }
          ]
        }
      ],
      "price": {
        "currency": "EUR",
        "total": "994.27",
        "base": "868.00",
        "fees": [
          {
            "amount": "0.00",
            "type": "SUPPLIER"
          },
          {
            "amount": "0.00",
            "type": "TICKETING"
          }
        ],
        "grandTotal": "994.27"
      },
      "pricingOptions": {
        "fareType": [
          "PUBLISHED"
        ],
        "includedCheckedBagsOnly": true
      },
      "validatingAirlineCodes": [
        "AI"
      ],
      "travelerPricings": [
        {
          "travelerId": "1",
          "fareOption": "STANDARD",
          "travelerType": "ADULT",
          "price": {
            "currency": "EUR",
            "total": "994.27",
            "base": "868.00"
          },
          "fareDetailsBySegment": [
            {
              "segmentId": "1",
              "cabin": "ECONOMY",
              "fareBasis": "UE6MAU6F",
              "class": "U",
              "includedCheckedBags": {
                "weight": 30,
                "weightUnit": "KG"
              }
            },
            {
              "segmentId": "2",
              "cabin": "ECONOMY",
              "fareBasis": "UE6MAU6F",
              "class": "U",
              "includedCheckedBags": {
                "weight": 30,
                "weightUnit": "KG"
              }
            },
            {
              "segmentId": "3",
              "cabin": "ECONOMY",
              "fareBasis": "TE3MAU6F",
              "class": "T",
              "includedCheckedBags": {
                "weight": 30,
                "weightUnit": "KG"
              }
            },
            {
              "segmentId": "4",
              "cabin": "ECONOMY",
              "fareBasis": "TE3MAU6F",
              "class": "T",
              "includedCheckedBags": {
                "weight": 30,
                "weightUnit": "KG"
              }
            }
          ]
        }
      ]
    }
  ],
  "dictionaries": {
    "locations": {
      "DEL": {
        "cityCode": "DEL",
        "countryCode": "IN"
      },
      "DXB": {
        "cityCode": "DXB",
        "countryCode": "AE"
      },
      "SYD": {
        "cityCode": "SYD",
        "countryCode": "AU"
      }
    },
    "aircraft": {
      "788": "BOEING 787-8"
    },
    "currencies": {
      "EUR": "EURO"
    },
    "carriers": {
      "AI": "AIR INDIA"
    }
  }
}

And here is the schema produced when i copy and paste the above JSON into the server connect API Schema Editor

The Segments section is my main concern as the arrival, departure etc are all missing, so can i just add them back in there manually?

Hi Paul. Yes, you can paste the JSON into the schema box and Wappler will use that to create the structure.

Thats what I am saying though, when i paste the above JSON into that source area and hit run, it produces the incorrect result as per my screenshot, so now I am wondering if i can click on the elements themselves in the right hand area and add more arrays manually without breaking things?

Aah, I see what you mean. Possibly a bug in Wappler?

I reckon you can manually change it, though, as you suggested. The pasting of JSON just speeds up the process. My understanding is that this is just used so that the variables are available in App Connect to write the correct code.

Yeah, I think its just for app connect too, makes it easier to do my bindings if the schema is there, because I am having to manually write the bindings in while these are missing.
Off to research array or keyed array, i have no clue what to add to get this back, haha

1 Like

I raised a schema related bug last week mate, probably its the same…

I also had a schema reading bug last week, but i think that one was fixed, that one was something to do with the API provider using the same key “length” as Wappler uses for its internal stuff, I assume this is a similar issue maybe with the key being “at” this time.
Seems like there are no rules that the schema providers have to adhere to when coming up with their names and keys which means Wappler will probably always have instances where their internal name is the same as something the API provider is using.

1 Like

I f you found another bug in the schema parser please file it as separate bug report