To be implemented as a stand-alone tool with an API that can be, eventually, consumed in the raml-module-builder and/or particular modules. Possibly a command-line interface if it simplifies testing/demoing.
Unless there is a reason not to, the tool should live in it's own git repo.
In short, given a JSON Schema for a particular object/document and the CQL-query, the tool generates a matching SELECT or WHERE clause that can be executed on the JSONB column in Postgres containing the objects.
The tool should be structured in a way that the JSON Schema traversal (to look up JSON object's key path(s) and type(s)) and Postgres query translation is as independent as possible to open up possibilities for implementation of translators to other query languages (e.g SOLR).
In the first iteration a general structure of the boolean query (AND/OR/NOT) should be translated, search indices should be mapped to equivalent (same name) JSON fields, and the '=' relation opertor should be mapped to a substring match (_LIKE '%s%').
We will also want to have the most basic suppor for specifying sort order using the sortBy keyword (which should be translated into ORDER BY): sortBy fieldName.