ADO.NET Provider for GraphQL

Build 21.0.7940

Column Definitions

The basic attributes of a column are the name of the column, the data type, whether the column is a primary key, the relative path and the depth. The provider uses the depth attribute to extract nodes from hierarchical data.

Mark up column attributes in the block of the schema file. You can also provide a description of each attribute using the desc property.

<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"                                                                                                             />
    <attr   name="UserLogin"        xs:type="string"                                                                          desc="The login name of the user."                                     other:filter="owner:="   other:depth="1"   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> 
The following sections provide more detail on using paths to extract columns and rows. To see the column definitions in a complete schema, refer to Customizing Schemas.

Mapping SELECT projection to GraphQL fields

We can control the building process of a GraphQL field path with the properties listed below:

  1. The other:possiblePaths property is used to specify the base paths that selects the column's value.

    Base paths start with a '/' and contain the full path to the last GraphQL nested object.

      <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"> 
    Based on the above script example we will build the following GraphQL query:
    { # base path=/repository/labels/edges/node
      repository {
        labels {
          edges {
            node {
              ...
            }
          }
        }
      }
    }

  2. The other:relativePath property must be specified for each column. This property is used in conjuction with the other:possiblePaths property to build the GraphQL field path.

      <attr   name="Name"  xs:type="string"  other:relativePath="name"  desc="Identifies the label name."    />
    Based on the above script example we will build the following GraphQL query:
    { # base path=/repository/labels/edges/node
      repository { # depth=1 
        labels { # depth=2
          edges {
            node {
              name # path=base path + relative path.
            }
          }
        }
      }
    }

  3. You can use the other:depth property to specify an element inside a specific GraphQL object. The indexes are 1-based. It this attribute is not specified then the default value will be equal to the last nested GraphQL object.

      <attr   name="RepositoryName"   xs:type="string"  other:relativePath="name"   desc="The name of the repository."  other:depth="1" />
    Based on the above script example we will build the following GraphQL query:
    { # base path=/repository/labels/edges/node
      repository { # depth=1 
        name # This is mapped to the RepositoryName column
        labels { # depth=2
          edges {
            node {
              ...
            }
          }
        }
      }
    }

Notes:

  • Paths and column names (when used to generate the path) are case sensitive.
  • At least one possible path should be specified.
  • The other:relativePath property must be specified for every column otherwise we can not map the SELECT column to a GraphQL field.

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