def __init__(self, type_, **kwargs): self.query_args = {} for key, value in type_._meta.fields.items(): if isinstance(value, graphene.Field): # Test field_type = value.type if isinstance(field_type, graphene.NonNull): field_type = field_type.of_type self.query_args[key] = field_type() args = kwargs.pop('args', dict()) args.update(self.query_args) args['sort_by'] = graphene.List(graphene.String, required=False) SQLAlchemyConnectionField.__init__(self, type_, args=args, **kwargs)
def __init__(self, type_, **kwargs): """InstrumentedQuery constructor""" self.query_args = {} for key, value in type_._meta.fields.items(): if isinstance(value, graphene.Field): # Test field_type = value.type if isinstance(field_type, graphene.NonNull): field_type = field_type.of_type self.query_args[key] = field_type() # Retrieving field keys and names args = kwargs.pop('args', dict()) args.update(self.query_args) args['sort_by'] = graphene.List(graphene.String, required=False) # Required token field args['token'] = graphene.String(required=True) SQLAlchemyConnectionField.__init__(self, type_, args=args, **kwargs)