MuleSoft Connector for GraphQL

Build 21.0.7940

Customizing Schemas

Custom schemas are defined in configuration files. In this chapter we outline the structure of these files.

Editing Schema Files

Tables and views are defined by authoring schema files in APIScript. APIScript is a simple configuration language that allows you to define the columns and the behavior of the table. It also has built-in Operations that enable you to process GraphQL. In addition to these data processing primitives, APIScript is a full-featured language with constructs for conditionals, looping, etc. However, as shown by the example schema, for most table definitions you will not need to use these features.

Example Schema

Below is a fully functional table schema that models the Labels table and contains all the components you will need to execute SQL to GraphQL data sources.

You can find more information on each of the components of a schema in Column Definitions, SELECT Execution.

 <rsb:script xmlns:rsb="http://apiscript.com/ns?v1" xmlns:xs="http://www.cdata.com/ns/rsbscript/2" xmlns:other="http://apiscript.com/ns?v1">  
   <rsb:info title="Labels" desc="Lists information about the different labels you can apply on an issue." other:possiblePaths="{'path':'/repository/labels/edges/node','Name':{'path':'/repository/label'}}" other:paginationType="Cursor">  
     <attr   name="Id"               xs:type="string"     key="true"   other:relativePath="id"             desc="The ID of the label."                                                                                                                                                                                                                           /> 
     <attr   name="RepositoryName"   xs:type="string"                            other:relativePath="name"           desc="The name of the repository."                                     other:filter="name:="    other:depth="1"   references="Repositories.Name"                                                                        /> 
     <attr   name="UserLogin"        xs:type="string"                                                                          desc="The login name of the user."                                     other:filter="owner:="   other:depth="1"   references="Users.Login"         other:mirror="true"   other:canBeSliced="true"   />  
     <attr   name="Color"            xs:type="string"                            other:relativePath="color"          desc="Identifies the label color."                                                                                                                                                                                                                    /> 
     <attr   name="CreatedAt"        xs:type="datetime"                          other:relativePath="createdAt"      desc="Identifies the date and time when the label was created."                                                                                                                                                                                       /> 
     <attr   name="Description"      xs:type="string"                            other:relativePath="description"    desc="A brief description of this label."                                                                                                                                                                                                             /> 
     <attr   name="IsDefault"        xs:type="boolean"                           other:relativePath="isDefault"      desc="Indicates whether or not this is a default label."                                                                                                                                                                                              /> 
     <attr   name="Name"             xs:type="string"                            other:relativePath="name"           desc="Identifies the label name."                                      other:filter="name:="                                                                                                           other:isPathFilter="true"  /> 
     <attr   name="ResourcePath"     xs:type="string"                            other:relativePath="resourcePath"   desc="The HTTP path for this label."                                                                                                                                                                                                                  /> 
     <attr   name="UpdatedAt"        xs:type="datetime"                          other:relativePath="updatedAt"      desc="Identifies the date and time when the label was last updated."                                                                                                                                                                                  /> 
     <attr   name="Url"              xs:type="string"                            other:relativePath="url"            desc="The HTTP URL for this label."                                                                                                                                                                                                                   /> 
   </rsb:info>  

   <rsb:script method="GET">  
     <rsb:push op="graphqladoSelect" />  
   </rsb:script>  

 </rsb:script> 

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 21.0.7940