How GraphQL Extensions is a good fit for Hotel+ Solutions
Posted by Héctor Escalante
At Travelgate, we constantly look to enhance the hotel shopping experience by adding features and services around our Hotel-X API. Although there are a lot of advantages to having a well-defined schema, it also has some constraints that make it hard to make constant changes to it.
The GraphQL specification provides a Response Extensions Section that allows us to include information without schema restrictions: “The response map may also contain an entry with key extensions. This entry, if set, must have a map as its value. This entry is reserved for implementers to extend the protocol however they see fit, and hence there are no additional restrictions on its contents.”
So we decided to try it out and have the best of both worlds, a response with Schema Defined Data and Schema-less Extensions.
Hotel+ Solutions is our way of adding products and services to our Hotel-X API, such as activities, transfers, tickets, coupons, statistics, notifications, etc., to name a few ideas. Due to its dynamic nature, we want to be able to share their information without extending the hotel specification to cover all scenarios, and this is how we saw that GraphQL Extensions should be a good fit for this purpose.
Our first opportunity to test this workflow is with the addition of Airport Transfers, which includes multiple vendor options to add transportation to your hotel booking. These options are included in the extensions, so the consumer can display the information to their customers and allow them to book the best transfer.
We are excited to explore new ways to improve the hotel shopping experience and hope that all of our partners can benefit from this. We are working to include more services and would love to hear your ideas on this.
Although GraphQL Extensions doesn’t restrict you to a specific schema, we enforce our schema to be consistent through custom controls.
We believe that the use of GraphQL extensions follows the principles of Lean Software Development, where rapid delivery is sought, waste is eliminated, and learning is extended. Through this mechanism, we can develop any ideas and generate business value with minimum effort and without impacting the specific purpose of Hotel-X.
We are working on a platform to open up the development of ideas together with our partners and enable an ecosystem of travel applications, so stay tuned.