github.com/dgraph-io/dgraph@v1.2.8/graphql/e2e/directives/schema.graphql (about)

     1  # **Don't delete** Comments at top of schemas should work
     2  # See: https://github.com/dgraph-io/dgraph/issues/4227
     3  
     4  type Country {
     5          # **Don't delete** Comments in types should work
     6          id: ID! # **Don't delete** Comments in lines should work
     7          name: String! @search(by: [trigram, hash])
     8          states: [State] @hasInverse(field: country) @dgraph(pred: "hasStates")
     9  }
    10  
    11  type State {
    12          id: ID!
    13          xcode: String! @id @search(by: [regexp])
    14          name: String!
    15          country: Country @dgraph(pred: "inCountry")
    16  }
    17  
    18  # **Don't delete** Comments in the middle of schemas should work
    19  # Comments in input schemas should _not_ make it through to the
    20  # generated schema.
    21  
    22  """
    23  GraphQL descriptions look like this.  They should work in the input
    24  schema and should make their way into the generated schema.
    25  """
    26  type Author @dgraph(type: "dgraph.author") {
    27          id: ID!
    28  
    29          """
    30          GraphQL descriptions can be on fields.  They should work in the input
    31          schema and should make their way into the generated schema.
    32          """
    33          name: String! @search(by: [hash, trigram])
    34  
    35          dob: DateTime @search
    36          reputation: Float @search
    37          country: Country
    38          posts: [Post!] @hasInverse(field: author)
    39  }
    40  
    41  type Post @dgraph(type: "myPost") {
    42          postID: ID!
    43          title: String! @search(by: [term, fulltext])
    44          text: String @search(by: [fulltext]) @dgraph(pred: "text")
    45          tags: [String] @search(by: [exact])
    46          topic: String @search(by: [exact]) @dgraph(pred: "dgraph.topic")
    47          numLikes: Int @search
    48          isPublished: Boolean @search @dgraph(pred: "is_published")
    49          postType: PostType @search(by: [hash, trigram])
    50          author: Author! @hasInverse(field: posts) @dgraph(pred: "post.author")
    51          category: Category @hasInverse(field: posts)
    52  }
    53  
    54  type Category {
    55          id: ID
    56          name: String
    57          posts: [Post]
    58  }
    59  
    60  """
    61  GraphQL descriptions can be on enums.  They should work in the input
    62  schema and should make their way into the generated schema.
    63  """
    64  enum PostType {
    65          Fact
    66  
    67          """
    68          GraphQL descriptions can be on enum values.  They should work in the input
    69          schema and should make their way into the generated schema.
    70          """
    71          Question
    72          Opinion
    73  }
    74  
    75  """
    76  GraphQL descriptions can be on interfaces.  They should work in the input
    77  schema and should make their way into the generated schema.
    78  """
    79  interface Employee @dgraph(type: "dgraph.employee.en") {
    80          ename: String!
    81  }
    82  
    83  interface Character @dgraph(type: "performance.character") {
    84          id: ID!
    85          name: String! @search(by: [exact])
    86          appearsIn: [Episode!] @search @dgraph(pred: "appears_in")
    87  }
    88  
    89  type Human implements Character & Employee {
    90          starships: [Starship]
    91          totalCredits: Float @dgraph(pred: "credits")
    92  }
    93  
    94  type Droid implements Character @dgraph(type: "roboDroid") {
    95          primaryFunction: String
    96  }
    97  
    98  enum Episode {
    99          NEWHOPE
   100          EMPIRE
   101          JEDI
   102  }
   103  
   104  type Starship @dgraph(type: "star.ship") {
   105          id: ID!
   106          name: String! @search(by: [term]) @dgraph(pred: "star.ship.name")
   107          length: Float
   108  }