GithubHelp home page GithubHelp logo

luagraphqlparser's Introduction

Luagraphqlparser

Lua-binding of libgraphqlparser compatible with graphql-lua.

Differences from graphql-lua parser:

  • Improved error messages
  • Null support

Usage:

parse = require('luagraphqlparser').parse
parse([[
    query HeroComparison($first: Int = 3) {
      leftComparison: hero(episode: EMPIRE) {
        ...comparisonFields
      }
      rightComparison: hero(episode: JEDI) {
        ...comparisonFields
      }
    }
    
    fragment comparisonFields on Character {
      name
      friendsConnection(first: $first) {
        totalCount
        edges {
          node {
            name
          }
        }
      }
    }
]])
---
- definitions:
  - operation: query
    kind: operation
    variableDefinitions:
    - type:
        name:
          kind: name
          value: Int
        kind: namedType
      kind: variableDefinition
      variable:
        name:
          kind: name
          value: first
        kind: variable
      defaultValue:
        kind: int
        value: '3'
    name:
      kind: name
      value: HeroComparison
    selectionSet:
      selections:
      - selectionSet:
          selections:
          - name:
              kind: name
              value: comparisonFields
            kind: fragmentSpread
          kind: selectionSet
        kind: field
        alias:
          name:
            kind: name
            value: leftComparison
          kind: alias
        name:
          kind: name
          value: hero
        arguments:
        - kind: argument
          name:
            kind: name
            value: episode
          value:
            kind: enum
            value: EMPIRE
      - selectionSet:
          selections:
          - name:
              kind: name
              value: comparisonFields
            kind: fragmentSpread
          kind: selectionSet
        kind: field
        alias:
          name:
            kind: name
            value: rightComparison
          kind: alias
        name:
          kind: name
          value: hero
        arguments:
        - kind: argument
          name:
            kind: name
            value: episode
          value:
            kind: enum
            value: JEDI
      kind: selectionSet
  - typeCondition:
      name:
        kind: name
        value: Character
      kind: namedType
    selectionSet:
      selections:
      - name:
          kind: name
          value: name
        kind: field
      - selectionSet:
          selections:
          - name:
              kind: name
              value: totalCount
            kind: field
          - selectionSet:
              selections:
              - selectionSet:
                  selections:
                  - name:
                      kind: name
                      value: name
                    kind: field
                  kind: selectionSet
                name:
                  kind: name
                  value: node
                kind: field
              kind: selectionSet
            name:
              kind: name
              value: edges
            kind: field
          kind: selectionSet
        arguments:
        - kind: argument
          name:
            kind: name
            value: first
          value:
            name:
              kind: name
              value: first
            kind: variable
        name:
          kind: name
          value: friendsConnection
        kind: field
      kind: selectionSet
    name:
      kind: name
      value: comparisonFields
    kind: fragmentDefinition
  kind: document
...

luagraphqlparser's People

Contributors

olegrok avatar totktonada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luagraphqlparser's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.