Implicit Field Aliasing Support for GraphQL in Oracle

When using GraphQL with Oracle, implicit field aliasing enables a streamlined mapping of SQL column names to JSON document fields.

Typically, in standard GraphQL, field names are case-sensitive, and developers must use precise naming or explicit aliases when they want a field in the output to differ in case or format from the underlying database.

With Oracle’s implementation, however, if a field name is specified in the GraphQL definition without an explicit alias, Oracle matches it to the actual SQL column name in a case-insensitive manner. The JSON output, however, retains the exact casing as specified in the GraphQL definition. In effect, Oracle automatically treats the unaliased field as if it had been written using an alias, matching the field name as it appears in the view definition.

Suppose the underlying database table, DRIVER, includes a column named driver_id. If you prefer the resulting JSON document to use the alias field driverId, you can simply use driverId as an alias for driver_id column in your GraphQL definition.:
driver {
  driverId : driver_id          
  name
  points
}

The output JSON document will then be:


{                                                                              
  "driverId": 101,                                                                  
  "name" : "Lando Norris",                                                     
  "points" : 282                                                                                                                                          
}

This mechanism removes the need for explicit aliases, while preserving the exact field names used in your SQL definitions for JSON output.