graphql-elixir / graphql

GraphQL Elixir
Other
859 stars 47 forks source link

AST reducer for validations #57

Closed freshtonic closed 8 years ago

freshtonic commented 8 years ago

This is essentially a functional-style implementation of the OO "visitor" pattern.

freshtonic commented 8 years ago

@joshprice @plasticine seeking feedback.

I'm happy with the small number of lines this is implemented in. I hope it's fairly easy to follow.

The idea is that you can call ASTReducer.reduce(..., visitor, ...) and have it return a an arbitrary data structure depending on the visitor you pass in.

I want to implement an Elixir version of the TypeInfo visitor from graphql-js using this, next.

joshprice commented 8 years ago

:+1: looks good, formatting changes then :ship:

joshprice commented 8 years ago

:+1: