andreas / ocaml-graphql-server

GraphQL servers in OCaml
MIT License
622 stars 60 forks source link

Show defaultValue in introspection query #194

Closed dwwoelfel closed 4 years ago

dwwoelfel commented 4 years ago

Per https://github.com/andreas/ocaml-graphql-server/issues/31#issuecomment-674311844, changes the type of the ~default argument in arg' to Graphql_parser.const_value to make it possible to populate the defaultValue field in the introspection query.

andreas commented 4 years ago

Thanks for writing up #31 and implementing this change 🙏

From a conceptual point of view, I would prefer an approach where defining an input scalar (i.e. calling Arg.scalar) would require a providing function 'a -> Graphql_parser.const_value. However, as you note in #31, there are some difficulties with this for input object types that I haven't worked out yet. What you propose seems quite pragmatic until that's sorted out.