Including self-referential fields in InputObjectType subclass
See original GitHub issueI am trying to create an InputObjectType that has dynamic fields that is meant for complex filtering of fields but that also contains a couple of self-referencing fields to allow boolean operations (AND, OR). Here is a concrete example of what I am trying to do, taken from here:
input FriendlyUserFilter {
sys: SysFilter
name: String
name_not: String
name_exists: Boolean
name_contains: String
# ... more name filters
age: Number
age_gt: Number
age_lt: Number
# ... more age filters
AND: [FriendlyUserFilter]
OR: [FriendlyUserFilter]
}
I am using the technique described here to do so. I’m curious how to implement the AND
and OR
functionality that includes a reference to the class itself.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Source code for graphene.types.inputobjecttype
_meta.fields: setattr(self, key, self.get(key, ... (class): A class reference for a value object that allows for attribute initialization and access.
Read more >Generate Graphene Mutation Inputs from SQLAlchemy Class ...
I solved creating this class: from graphene.types.utils import yank_fields_from_attrs from graphene.utils.subclass_with_meta import ...
Read more >Graphene Documentation - Read the Docs
A GraphQL Schema describes each Field in the data model provided by the server using scalar types like String, Int and Enum and...
Read more >Class: GraphQL::Schema::Directive
Subclasses of this can influence how Execution::Interpreter runs queries. Directive.include?: if it returns false , the field or fragment will be skipped ...
Read more >Object Type Definition - graphql-php
Conceptually Object Type is a collection of Fields. Each field, in ... (or one of its subclasses) which accepts a configuration array in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hmm… Maybe like this?
Same result as https://github.com/graphql-python/graphene/issues/1063#issuecomment-527537653 (+NonNull)
Hi, do you need something like that?
Result (graphiql):