GraphQL implementation in Lua
#lua #graphql #server #library

bjorn 5bde5d085c Start validation; 9 years ago
README.md 4a1237aae0 Update README; 9 years ago
parse.lua 072164661e Variables; Types; Directives; 9 years ago
schema.lua 7629d50681 Start on types and schema; 9 years ago
types.lua 7629d50681 Start on types and schema; 9 years ago
validate.lua 5bde5d085c Start validation; 9 years ago

README.md

GraphQL Lua

Lua implementation of GraphQL parser using LPeg. Experimental.

Example

require 'parse' [[{
  me {
    firstName
    lastName
  }
}]]

Gives you this scary table:

{
  kind = "document",
  definitions = {
    {
      kind = "operation",
      operation = "query",
      selectionSet = {
        kind = "selectionSet",
        selections = {
          {
            kind = "field",
            name = {
              kind = "name",
              value = "me"
            },
            selectionSet = {
              kind = "selectionSet",
              selections = {
                {
                  kind = "field",
                  name = {
                    kind = "name",
                    value = "firstName"
                  }
                },
                {
                  kind = "field",
                  name = {
                    kind = "name",
                    value = "lastName"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Status

Right now it can parse pretty much all of the query syntax:

  • Documents
  • Definitions
    • OperationDefinition
    • FragmentDefinition
  • Selections
  • Fields
  • Aliases
  • Arguments
  • FragmentSpreads and InlineFragments
  • All value types (scalars, enums, lists, objects, variables).
  • VariableDefinitions (typed)
  • Directives

Missing features:

  • Validation, error handling
  • Comments
  • Type definitions, interfaces, etc.
  • Introspection
  • Execution
  • Unicode stuff

License

MIT