-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added FieldDef<'Val, 'Res>
to support resolver changing middlewares
#446
Conversation
I'm afraid this one may be beyond my skill to review. I'm not sure what the long-term consequences of changing |
Anyway we do breaking changes in v2.0 |
d150563
to
020046c
Compare
1f20932
to
210fddb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it.
In any case, I find it a good idea to generally avoid method overloads as F# doesn't support function overloads (although class members may have overloads, just like in our current situation -- which is causing the problem that you're trying to fix), and therefore not having overloads feels more like "the F# way", so I welcome this change already on this level, even if the offending overload were not causing any problems yet.
However, I'm not sure if I agree with the new name. ObjectRec
is effectively not by definition recursive, but it can be used for a recursive definition.
That, which ObjectRec
actually is, is an Object
which takes a function for defining the fields instead of a concrete list of fields.
So, following the nomenclature of the F# core lib, I'd prefer for it to be named something like the defaultWith
function of the Option
module.
In that case, that could be ObjectHavingFieldsWith
(instead of ObjectRec
).
What do you think?
020046c
to
e50b324
Compare
889f71d
to
be3c173
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have the changes requested by valbers been addressed?
be3c173
to
76e9d81
Compare
c8b3525
to
0810527
Compare
14aa27a
to
3ba4016
Compare
1737829
to
246d6c0
Compare
0dd4372
to
81bc85e
Compare
76e9d81
to
c73ab43
Compare
@njlr give your opinion, please |
c73ab43
to
86ac430
Compare
c590728
to
e0841dc
Compare
@xperiandri could you please do less force-pushes with commit amendments? It makes it hard to follow what you actually changed with each commit amendment. I mean: once in a while it's ok, but I see this now very often. |
@@ -800,15 +801,14 @@ module SchemaDefinitions = | |||
/// <param name="description">Optional field description. Usefull for generating documentation.</param> | |||
/// <param name="args">Optional list of arguments used to parametrize field resolution.</param> | |||
/// <param name="deprecationReason">If set, marks current field as deprecated.</param> | |||
static member AutoField(name : string, typedef : #OutputDef<'Res>, ?description: string, ?args: InputFieldDef list, ?deprecationReason: string) : FieldDef<'Val> = | |||
static member AutoField(name : string, typedef : OutputDef<'Res>, ?description: string, ?args: InputFieldDef list, ?deprecationReason: string) : FieldDef<'Val, 'Res> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the # removed on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I either got a warning or error because of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave you my two cents with regard to the naming of ObjectRec
, but it seems like you don't agree with it. I don't want to die on that hill, so I'm approving this PR.
I just want to check again if it still the issue. |
e0841dc
to
eed947a
Compare
In order to call
Define.Field<'Val>(....).WithAuthorizationPolicy("policy")
I need to know not only'Res
which is an object on whichFieldDef<'Res>
is defined but also a'Val
which is a field type.However when I introduced
FieldDef<'Val, 'Res>
F# cannot determine the override betweenDefine.Object
that gets a list of field and a labmda that return a list of fields. So I had to renameDefine.Object
overrie toDefine.ObjectRec
andDefine.Interface
override toDefine.ObjectRec
.I have not renamed
Define.InputObject
as it accepts a parameter of list of another interface