TDV Adapter for GraphQL

Build 22.0.8462

Customizing Schemas

Custom schemas are defined in configuration files. This chapter outlines the structure of these files.
Note: The GenerateSchemaFiles property enables you to persist table metadata in static schema files that are easy to customize (to persist your changes to column data types, for example). Set this property to "OnStart" to generate schema files for all tables in your database at connection. Alternatively, set this property to "OnUse" to generate schemas as you execute SELECT queries to tables. It is also possible to create a specific schema file for a table using the CreateSchema stored procedure.

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:paginationObjects="{'labels':{'cursorName':'after','cursorType':'String','pageSizeArgumentName':'first','pageSizeArgumentType':'Int','depth':'1','paginationType':'Cursor','isConnection':'True','pageInfo':['endCursor','hasNextPage','hasPreviousPage','startCursor']}}"> 
     <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:argumenttype="String!"    other:depth="1"                                           references="Repositories.Name"                                                                                /> 
     <attr   name="UserLogin"        xs:type="string"                                                                          desc="The login name of the user."                                     other:filter="owner:="   other:argumenttype="String!"    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."                                                                                                                  other:orderby="CREATED_AT"                                                                                                                           /> 
     <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:argumenttype="String!"                                 other:orderby="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) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462