exAspArk / graphql-guard

Simple authorization gem for GraphQL :lock:
MIT License
472 stars 36 forks source link

Add support for arguments #44

Closed 23tux closed 4 years ago

23tux commented 4 years ago

I'd like to mask certain arguments so they are hidden in the schema. I'm currently playing around with this

# in an initializer
GraphQL::Argument.accepts_definitions(mask: GraphQL::Define.assign_metadata_key(:mask))
GraphQL::Schema::Argument.accepts_definition(:mask)

and then use it like this

argument :foo, String, required: false, mask: ->(ctx) { false }

Is this the right way to do it? And can someone explain why I need to define the mask on GraphQL::Argument AND GraphQL::Schema::Argument?

ghost commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

23tux commented 4 years ago

I have the code above working in production, so it seems like the right way. But I'd still like to know, if this is the intended way to support arguments.

asgeo1 commented 2 years ago

Sad that this got auto-closed. I was looking to do this myself, would be good to get the PR merged