-
Notifications
You must be signed in to change notification settings - Fork 527
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
Support open ended scalars #1069
Support open ended scalars #1069
Conversation
Example implementations of the Federation
All of them appear to just forward the input object type through and don't really do any coercion so I would expect absinthe to also do something similar |
73bb113
to
e489948
Compare
As a note for others reading the PR: Much as Absinthe has resisted this feature over the years, it isn't a fight we're gonna win. I think it's time to try to support this. |
We have an implementation of this in our API with an allow-list for scalars... So one question is how we want this to be enabled - will it be on by default? opt-in per scalar? something else? |
We needed to modify:
|
|
Which approach do we want to take on this?
|
I think maybe an option 3, where you pattern match for |
e489948
to
b26a756
Compare
@benwilson512 The |
6c96487
to
9e6646a
Compare
Alright I am to a place where I am feeling pretty good about the implementation now and would love some more thorough reviews |
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'm mostly happy with this, but we need to review spec behavior for scalars that don't accept struct literals, and we need a number of additional test cases to more comprehensively cover the new functionality.
Agreed, I think this needs to be opt-in only, and per-scalar. An API will want both Scalars that are open-ended and some that aren't. Out of the box, the addition of this feature should not change any existing behavior. |
Any ideas on what we want the opt-in API to look like? scalar :any do
meta :dynamic, true
...
end |
I think we may need a new syntax / field, since we should probably leave I tend to like calling these "open ended", what do you think @benwilson512 |
@binaryseed agreed, I'd be fine with like:
|
9e6646a
to
2c0d7e8
Compare
test/absinthe/integration/execution/aliases/with_errors_test.exs
Outdated
Show resolved
Hide resolved
I am happy to make more changes but I think I have addressed the feedback so far |
Is this something that would make sense to live in absinthe? Or would it be better as some sort of plugin to absinthe? I need this feature for my use case of federation but I may be able to put this behavior into the absinthe_federation library itself if we dont want this to be a core feature of absinthe. Would love some direction on this so I can move forward with whatever the team thinks is best for the absinthe ecosystem |
2c0d7e8
to
1f10800
Compare
1f10800
to
4ac05dc
Compare
The test cases look largely correct to me now, I'll review in more detail later this week. I think supporting it this way in Absinthe is important since it needed changes to key files. |
Once this merges can we release it as an RC? I would like to get the |
These changes look good! Will look at doing a release shortly. |
Thanks so much for this PR @kdawgwilk ! @benwilson512 At Solve, we were looking at using this feature for a long time. I've got an open PR to use this new feature, but I just wanted to double check if this is a feature that will continue to be supported |
Yes, this will be supported. |
Was there a specific reason for not supporting open ended scalars that are lists? I have data about fixed-sized arrays (like Vec3). Having |
This adds support for defining
open_ended
scalars that can recieve arbitrary GQL data. We opted to put this behavior behind a flag so that it is an opt-in feature. This was a necessary feature to support the Federation spec's_Any
scalar