Comments (2)
Hey, thanks for reporting this. Did you find this documented somewhere? I didn't find it in the documentation and I don't see it addressed in the relevant spec (https://github.com/rmosolgo/graphql-ruby/blob/master/spec/graphql/authorization_spec.rb), so I think it was just never dreamed of!
But we could definitely add it. My first thought on a place to add it would be to hook in here:
graphql-ruby/lib/graphql/execution/interpreter/runtime.rb
Lines 570 to 572 in 18f3ded
and here:
graphql-ruby/lib/graphql/schema/argument.rb
Lines 264 to 268 in 18f3ded
Which go here:
graphql-ruby/lib/graphql/schema/enum.rb
Lines 143 to 166 in 18f3ded
I think if those two methods (coerce_input
and coerce_result
) included enum_value.authorized?
checks, it would implement this feature.
Feel free to give it a try if you're interested, otherwise I'll keep this open and try to take a crack at it when I find time!
from graphql-ruby.
@rmosolgo thank you for looking into this.
Did you find this documented somewhere? I didn't find it in the documentation...
No, there is no documentation regarding this. I just looked around the source code and found that the enum value also has those methods (visible?
and authorized?
). So, I have such a case in my project where I would like to have such a feature, but tried to work with that and found out that visible?
is working correctly, but authorized?
does not. This is a short story about how I created this bug because, in the gem's source code, I've seen such a method and anticipated it should work then.
from graphql-ruby.
Related Issues (20)
- Complexity computations for fields on connections HOT 2
- JavaScript client should use strong typing for `onError` argument HOT 2
- `GraphQL::Schema::Interface#resolve_type` appears to resolve lazy results too early HOT 2
- Complexity calculation is not respecting the value in the resolver HOT 1
- Fields "missing" randomly HOT 15
- Better detection for when items were scoped?
- Help with GraphQL OTel Errors as of 2.2.10 HOT 1
- GraphQL 2.2.10 + GraphQL Pro operation store nil reference error HOT 11
- Refactor Language::Nodes::AbstractNode#initialize
- Previously-uninitialized trace modes don't include the default tracers HOT 2
- Validations on Fields HOT 3
- Validation for orphan types HOT 1
- Vulnerability in inflight HOT 2
- GraphQL::Analysis::AST::FieldUsage deprecated argument detections for mutations raises an error when the InputType value is prepared HOT 3
- Name start at end of numbers should fail to parse HOT 1
- Using urql with ActionCable HOT 2
- count_introspection_fields for max_complexity HOT 1
- `nil can't be coerced into Integer (TypeError)` when parsing invalid bare-name with hyphen HOT 1
- No file descriptors available - IO_Event_Selector_EPoll_initialize:epoll_create HOT 7
- Add timestamp to subscription updates HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-ruby.