fsprojects / FSharp.Data.GraphQL

FSharp implementation of Facebook GraphQL query language.
http://fsprojects.github.io/FSharp.Data.GraphQL/
MIT License
395 stars 72 forks source link

Added `FieldDef<'Val, 'Res>` to support resolver changing middlewares #446

Open xperiandri opened 8 months ago

xperiandri commented 8 months ago

In order to call Define.Field<'Val>(....).WithAuthorizationPolicy("policy") I need to know not only 'Res which is an object on which FieldDef<'Res> is defined but also a 'Val which is a field type. However when I introduced FieldDef<'Val, 'Res> F# cannot determine the override between Define.Object that gets a list of field and a labmda that return a list of fields. So I had to rename Define.Object overrie to Define.ObjectRec and Define.Interface override to Define.ObjectRec. I have not renamed Define.InputObject as it accepts a parameter of list of another interface

GBirkel commented 8 months ago

I'm afraid this one may be beyond my skill to review. I'm not sure what the long-term consequences of changing Object to ObjectRec would be.

xperiandri commented 8 months ago

Anyway we do breaking changes in v2.0 So the main difference is that you need to call Define.ObjectRec to define recursive GraphQL type definitions. Also there is a question if need to rename Define.InputObject override to Define.InputObjectRec to be consistent or leave it as is to be simple?