Skip to content
GraphQL to Venia Clojure syntax query generation
Clojure HTML Dockerfile CSS Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
dev
resources/public
src/reverse_venia
test/reverse_venia
.gitignore
.travis.yml
Dockerfile
README.md
package.json
project.clj
yarn.lock

README.md

reverse-venia

GraphQL to Venia Clojure syntax query generation https://reverse-venia.herokuapp.com

Overview

Writing GraphQL queries using GraphiQL is nice. Auto suggestion works well, code is nicely highlighted and can be reformatted with a single click of a button.

However, while write GraphQL in pure Clojure we don't have such a luxury. We can use Venia library to write queries using Clojure data structures but this won't be good for prototyping. GraphiQL with its features will be much faster.

Therefore you open your browser with GraphiQL connected to the latest GraphQL schema and start typing. After you are done with your complicated nested query or mutation you can end up with something like this.

mutation {
  property_create(external_id: "test-property", name: "test-property", email: "jesse@emaıl.com", options: {deposit: {business_name: "6 Nottingham", external_account: {object: "bank_account", country: "US", currency: "usd", account_number: "000123456789", routing_number: "110000000", account_holder_type: "individual", account_holder_name: "Holder of Account"}, payout_schedule: {interval: "daily"}, tos_acceptance: {date: 1558351184, ip: "45.33.63.187"}}, ops: {business_name: "6 Nottingham", external_account: {object: "bank_account", country: "US", currency: "usd", account_number: "000123456789", routing_number: "110000000", account_holder_type: "individual", account_holder_name: "Holder of Account"}, payout_schedule: {interval: "daily"}, tos_acceptance: {date: 1558351184, ip: "45.33.63.187"}}}) {
    id
    payment {
      is_active
      is_canceled
      billing_start
      canceled_on
      fee_percent
      payment_type
      customer {
        id
        name
        plan {
          id
          amount
          date
          source {
            id
            type
          }
        }
      }
    }
  }
}

Ok, what now?

You are lazy and you don't want to just blindly rewrite it into Venia Clojure syntax. You can image the final result. Lots of typos, wrongly nested vectors and maps. It will be just too much work.

Do you really thing you can produce this code easily and without any errors?

[[:property_create
  {:external_id "test-property",
   :name        "test-property",
   :email       "jesse@emaıl.com",
   :options
                {:deposit
                 {:business_name   "6 Nottingham",
                  :external_account
                                   {:object              "bank_account",
                                    :country             "US",
                                    :currency            "usd",
                                    :account_number      "000123456789",
                                    :routing_number      "110000000",
                                    :account_holder_type "individual",
                                    :account_holder_name "Holder of Account"},
                  :payout_schedule {:interval "daily"},
                  :tos_acceptance  {:date 1558351184, :ip "45.33.63.187"}},
                 :ops
                 {:business_name   "6 Nottingham",
                  :external_account
                                   {:object              "bank_account",
                                    :country             "US",
                                    :currency            "usd",
                                    :account_number      "000123456789",
                                    :routing_number      "110000000",
                                    :account_holder_type "individual",
                                    :account_holder_name "Holder of Account"},
                  :payout_schedule {:interval "daily"},
                  :tos_acceptance  {:date 1558351184, :ip "45.33.63.187"}}}}
  [:id
   [:payment
    [:is_active
     :is_canceled
     :billing_start
     :canceled_on
     :fee_percent
     :payment_type
     [:customer
      [:id
       :name
       [:plan [:id :amount :date [:source [:id :type]]]]]]]]]]]

Luckily, there is a great tool for lazy Clojure developers!

Just go to https://reverse-venia.herokuapp.com, dump your code in, and copy & past it back.

Job done!

Docker

https://cloud.docker.com/repository/docker/ondrs/reverse-venia

docker run -p 80:80 ondrs/reverse-venia

Local development

Start your REPL. In dev/user.clj run

(go)

Web server runs at http://localhost:3448. Figwheel at http://localhost:3449

Deployment to Heroku

heroku container:push web
heroku container:release web
You can’t perform that action at this time.