github.com/dgraph-io/dgraph@v1.2.8/graphql/schema/schemagen_test.yml (about)

     1  schemas:
     2    -
     3      name: "Object data type"
     4      input: |
     5        type A {
     6          id: ID!
     7          p: P
     8        }
     9        type P {
    10          id: ID!
    11        }
    12      output: |
    13        type A {
    14          A.p: uid
    15        }
    16        A.p: uid .
    17        type P {
    18        }
    19  
    20    -
    21      name: "Scalar list"
    22      input: |
    23        type X {
    24          id: ID!
    25          names: [String!]
    26        }
    27      output: |
    28        type X {
    29          X.names: [string]
    30        }
    31        X.names: [string] .
    32  
    33    -
    34      name: "Object list"
    35      input: |
    36        type X {
    37          p: [P!]!
    38        }
    39        type P {
    40          id: ID!
    41        }
    42      output: |
    43        type X {
    44          X.p: [uid]
    45        }
    46        X.p: [uid] .
    47        type P {
    48        }
    49  
    50    -
    51      name: "Scalar types"
    52      input: |
    53        type X {
    54          p: Int
    55          pList: [Int]
    56          q: Boolean
    57          r: String
    58          rList: [String]
    59          s: DateTime
    60          sList: [DateTime]
    61          t: Float
    62          tList: [Float]
    63          u: ID
    64        }
    65      output: |
    66        type X {
    67          X.p: int
    68          X.pList: [int]
    69          X.q: bool
    70          X.r: string
    71          X.rList: [string]
    72          X.s: dateTime
    73          X.sList: [dateTime]
    74          X.t: float
    75          X.tList: [float]
    76        }
    77        X.p: int .
    78        X.pList: [int] .
    79        X.q: bool .
    80        X.r: string .
    81        X.rList: [string] .
    82        X.s: dateTime .
    83        X.sList: [dateTime] .
    84        X.t: float .
    85        X.tList: [float] .
    86  
    87    -
    88      name: "enum - always gets an index"
    89      input: |
    90        type X {
    91          e: E
    92          f: [E]
    93        }
    94        enum E { A }
    95      output: |
    96        type X {
    97          X.e: string
    98          X.f: [string]
    99        }
   100        X.e: string @index(hash) .
   101        X.f: [string] @index(hash) .
   102  
   103  
   104    -
   105      name: "Search indexes are correct"
   106      input: |
   107        type X {
   108          i1: Int @search
   109          i2: Int @search(by: [int])
   110          f1: Float @search
   111          f2: Float @search(by: [float])
   112          b1: Boolean @search
   113          b2: Boolean @search(by: [bool])
   114          s1: String @search
   115          s2: String @search(by: [hash])
   116          s3: String @search(by: [exact])
   117          s4: String @search(by: [term])
   118          s5: String @search(by: [fulltext])
   119          s6: String @search(by: [trigram])
   120          s7: String @search(by: [regexp])
   121          s8: String @search(by: [exact, fulltext, term, trigram])
   122          dt1: DateTime @search
   123          dt2: DateTime @search(by: [year])
   124          dt3: DateTime @search(by: [month])
   125          dt4: DateTime @search(by: [day])
   126          dt5: DateTime @search(by: [hour])
   127          e: E @search
   128          e1: E @search(by: [hash])
   129          e2: E @search(by: [exact])
   130          e3: E @search(by: [trigram])
   131          e4: E @search(by: [regexp])
   132          e5: E @search(by: [hash, regexp])
   133          e6: E @search(by: [hash, trigram])
   134          e7: E @search(by: [exact, regexp])
   135        }
   136        enum E { A }
   137      output: |
   138        type X {
   139          X.i1: int
   140          X.i2: int
   141          X.f1: float
   142          X.f2: float
   143          X.b1: bool
   144          X.b2: bool
   145          X.s1: string
   146          X.s2: string
   147          X.s3: string
   148          X.s4: string
   149          X.s5: string
   150          X.s6: string
   151          X.s7: string
   152          X.s8: string
   153          X.dt1: dateTime
   154          X.dt2: dateTime
   155          X.dt3: dateTime
   156          X.dt4: dateTime
   157          X.dt5: dateTime
   158          X.e: string
   159          X.e1: string
   160          X.e2: string
   161          X.e3: string
   162          X.e4: string
   163          X.e5: string
   164          X.e6: string
   165          X.e7: string
   166        }
   167        X.i1: int @index(int) .
   168        X.i2: int @index(int) .
   169        X.f1: float @index(float) .
   170        X.f2: float @index(float) .
   171        X.b1: bool @index(bool) .
   172        X.b2: bool @index(bool) .
   173        X.s1: string @index(term) .
   174        X.s2: string @index(hash) .
   175        X.s3: string @index(exact) .
   176        X.s4: string @index(term) .
   177        X.s5: string @index(fulltext) .
   178        X.s6: string @index(trigram) .
   179        X.s7: string @index(trigram) .
   180        X.s8: string @index(exact, fulltext, term, trigram) .
   181        X.dt1: dateTime @index(year) .
   182        X.dt2: dateTime @index(year) .
   183        X.dt3: dateTime @index(month) .
   184        X.dt4: dateTime @index(day) .
   185        X.dt5: dateTime @index(hour) .
   186        X.e: string @index(hash) .
   187        X.e1: string @index(hash) .
   188        X.e2: string @index(exact) .
   189        X.e3: string @index(trigram) .
   190        X.e4: string @index(trigram) .
   191        X.e5: string @index(hash, trigram) .
   192        X.e6: string @index(hash, trigram) .
   193        X.e7: string @index(exact, trigram) .
   194  
   195    -
   196      name: "interface and types interact properly"
   197      input: |
   198        interface A {
   199          id: ID!
   200          name: String! @search(by: [exact])
   201        }
   202        type B implements A {
   203          correct: Boolean @search
   204        }
   205        type C implements A {
   206          dob: DateTime!
   207        }
   208      output: |
   209        type A {
   210          A.name: string
   211        }
   212        A.name: string @index(exact) .
   213        type B {
   214          A.name: string
   215          B.correct: bool
   216        }
   217        B.correct: bool @index(bool) .
   218        type C {
   219          A.name: string
   220          C.dob: dateTime
   221        }
   222        C.dob: dateTime .
   223  
   224    -
   225      name: "Schema with @dgraph directive."
   226      input: |
   227        type A @dgraph(type: "dgraph.type.A") {
   228          id: ID!
   229          p: Int
   230          pList: [Int] @dgraph(pred: "pList")
   231          q: Boolean
   232          r: String @dgraph(pred: "dgraph.r")
   233          rList: [String]
   234          s: DateTime @dgraph(pred: "s")
   235          t: Float
   236          tList: [Float] @dgraph(pred: "dgraph.tList")
   237        }
   238  
   239        interface B @dgraph(type: "dgraph.interface.B") {
   240          id: ID!
   241          name: String! @search(by: [exact]) @dgraph(pred: "dgraph.abc.name")
   242          age: Int
   243        }
   244  
   245        type C implements B @dgraph(type: "type.C") {
   246          correct: Boolean @search @dgraph(pred: "dgraph.correct")
   247          incorrect: Boolean
   248        }
   249  
   250        type X @dgraph(type: "dgraph.type.X") {
   251          e: E @dgraph(pred: "dgraph.x.e")
   252          f: [E] @dgraph(pred: "dgraph.x.eList")
   253        }
   254        enum E { A }
   255  
   256        type Y {
   257          p: Int
   258          q: String
   259          pList: [Int] @dgraph(pred: "dgraph.pList")
   260          f: Float @dgraph(pred: "f")
   261        }
   262      output: |
   263        type dgraph.type.A {
   264          dgraph.type.A.p: int
   265          pList: [int]
   266          dgraph.type.A.q: bool
   267          dgraph.r: string
   268          dgraph.type.A.rList: [string]
   269          s: dateTime
   270          dgraph.type.A.t: float
   271          dgraph.tList: [float]
   272        }
   273        dgraph.type.A.p: int .
   274        pList: [int] .
   275        dgraph.type.A.q: bool .
   276        dgraph.r: string .
   277        dgraph.type.A.rList: [string] .
   278        s: dateTime .
   279        dgraph.type.A.t: float .
   280        dgraph.tList: [float] .
   281        type dgraph.interface.B {
   282          dgraph.abc.name: string
   283          dgraph.interface.B.age: int
   284        }
   285        dgraph.abc.name: string @index(exact) .
   286        dgraph.interface.B.age: int .
   287        type type.C {
   288          dgraph.abc.name: string
   289          dgraph.interface.B.age: int
   290          dgraph.correct: bool
   291          type.C.incorrect: bool
   292        }
   293        dgraph.correct: bool @index(bool) .
   294        type.C.incorrect: bool .
   295        type dgraph.type.X {
   296          dgraph.x.e: string
   297          dgraph.x.eList: [string]
   298        }
   299        dgraph.x.e: string @index(hash) .
   300        dgraph.x.eList: [string] @index(hash) .
   301        type Y {
   302          Y.p: int
   303          Y.q: string
   304          dgraph.pList: [int]
   305          f: float
   306        }
   307        Y.p: int .
   308        Y.q: string .
   309        dgraph.pList: [int] .
   310        f: float .
   311  
   312    -
   313      name: "Field with @id directive but no search directive gets hash index."
   314      input: |
   315        interface A {
   316          id: String! @id
   317        }
   318        type B implements A {
   319          correct: Boolean @search
   320        }
   321      output: |
   322        type A {
   323          A.id: string
   324        }
   325        A.id: string @index(hash) @upsert .
   326        type B {
   327          A.id: string
   328          B.correct: bool
   329        }
   330        B.correct: bool @index(bool) .
   331  
   332    -
   333      name: "Field with @id directive gets hash index."
   334      input: |
   335        interface A {
   336          id: String! @id @search(by: [trigram])
   337        }
   338        type B implements A {
   339          correct: Boolean @search
   340        }
   341      output: |
   342        type A {
   343          A.id: string
   344        }
   345        A.id: string @index(trigram, hash) @upsert .
   346        type B {
   347          A.id: string
   348          B.correct: bool
   349        }
   350        B.correct: bool @index(bool) .
   351  
   352    -
   353      name: "Field with @id directive and a hash arg in search directive generates correct schema."
   354      input: |
   355        interface A {
   356          id: String! @id @search(by: [hash, term])
   357        }
   358        type B implements A {
   359          correct: Boolean @search
   360        }
   361      output: |
   362        type A {
   363          A.id: string
   364        }
   365        A.id: string @index(hash, term) @upsert .
   366        type B {
   367          A.id: string
   368          B.correct: bool
   369        }
   370        B.correct: bool @index(bool) .