When it comes to data structure for storing or transferring a set of rules that should be defined from the client, jsonLogic its a great choice.

Build complex rules, serialize them as JSON, share them between front-end and back-end” is how the home page for JsonLogic starts describing the library.

The client can define rules in Json format that can be used in many systems to perform validations.

The Problem:

When you want to save the jsonLogic rules (as JSON) using GraphQL the jsonLogic’s operators ==, ===, !=, !==, >, >=, <, <=, !!, !,

Abstract: This article is about Rails API, Graphql and Search Object Connection Helpers like: filter_by, order_by, total_count and search.

For each project you will probably need something like order_by, filter_by, total_count maybe search for your listing scopes. Any client will require this functionality so it becomes a core part of your API.

Search Object is a great gem when it comes to Graphql Relay Connections. You can use an inherited resolver from Resolvers::BaseSearchResolver and resolve your connections using filters, order or any other complicated queries. This is the place where we are able to manipulate our scope.

For each model…

Yannis Kolovos

Backend Engineer at Humid Research

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store