{"id":14975988,"url":"https://github.com/oliyh/locksmith","last_synced_at":"2025-10-16T14:23:07.000Z","repository":{"id":62433421,"uuid":"108010789","full_name":"oliyh/locksmith","owner":"oliyh","description":"Want to use GraphQL with Clojure/script but don't want keBab or snake_keys everywhere? Use locksmith to change all the keys!","archived":false,"fork":false,"pushed_at":"2019-03-29T14:53:27.000Z","size":13,"stargazers_count":61,"open_issues_count":3,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-09-28T21:22:19.200Z","etag":null,"topics":["clj","cljs","clojure","clojurescript","graphql","graphql-client","graphql-server","idiomatic"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oliyh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-23T16:46:54.000Z","updated_at":"2024-05-31T07:51:49.000Z","dependencies_parsed_at":"2022-11-01T21:01:54.038Z","dependency_job_id":null,"html_url":"https://github.com/oliyh/locksmith","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliyh%2Flocksmith","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliyh%2Flocksmith/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliyh%2Flocksmith/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliyh%2Flocksmith/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oliyh","download_url":"https://codeload.github.com/oliyh/locksmith/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219860932,"owners_count":16556009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clj","cljs","clojure","clojurescript","graphql","graphql-client","graphql-server","idiomatic"],"created_at":"2024-09-24T13:53:05.814Z","updated_at":"2025-10-16T14:23:01.947Z","avatar_url":"https://github.com/oliyh.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# locksmith\n\nWant to use GraphQL with Clojure/script but don't want snake_keys or camelKeys everywhere? Use locksmith to change all the keys!\n\nlocksmith creates efficient functions to transform GraphQL keys (e.g. `snake_key`, `camelKey`, `boolean_key`) into Clojure keys (`snake-key`, `camel-key`, `boolean-key?`) and vice versa.\nIt does this by inspecting your [lacinia](https://github.com/walmartlabs/lacinia) GraphQL schema, deciding which keys need renaming and composing functions to do the renames as fast as possible.\n\nThis helps you satisfy GraphQL queries on your server and work with idiomatic Clojure data on your client.\nIt uses [camel-snake-kebab](https://github.com/clj-commons/camel-snake-kebab) under the hood, with the addition of adding `?` as a suffix for boolean types.\n\n[![Clojars Project](https://img.shields.io/clojars/v/locksmith.svg)](https://clojars.org/locksmith)\n\n## Usage\n\nImagine you have a schema for a car race, as follows:\n\n```clj\n(def lacinia-schema\n  '{:enums {:team_name {:description \"Some enumerated teams\"\n                        :values [:ferrari_scuderia :red_bull :mercedes_gp]}}\n\n    :objects {:car_race {:fields {:winning_driver {:type :car_driver}\n                                  :competing_drivers {:type (list :car_driver)}\n                                  :country_name {:type String}}}\n              :car_driver {:fields {:first_name {:type String}\n                                    :team_name {:type :team_name}\n                                    :champion {:type Boolean}}}}})\n```\n\nOn your server you have lots of lovely Clojure data, but you have to put loads of underscores or camels in it to satisfy any GraphQL queries that come in.\nlocksmith's `clj-\u003egql` does this for you!\n\n```clj\n(let [car-race-converter (clj-\u003egql lacinia-schema :car_race)]\n  (car-race-converter {:country-name \"GB\"\n                       :winning-driver {:first-name \"Lewis\"\n                                        :team-name :mercedes-gp\n                                        :champion? true}\n                       :competing-drivers [{:first-name \"Lewis\"\n                                            :team-name :mercedes-gp\n                                            :champion? true}\n                                           {:first-name \"Sebastian\"\n                                            :team-name :ferrari-scuderia\n                                            :champion? true}\n                                           {:first-name \"Max\"\n                                            :team-name :red-bull\n                                            :champion? false}]}))\n\n;; {:country_name \"GB\",\n;;  :competing_drivers\n;;  ({:champion true, :team_name \"mercedes_gp\", :first_name \"Lewis\"}\n;;   {:champion true,\n;;    :team_name \"ferrari_scuderia\",\n;;    :first_name \"Sebastian\"}\n;;   {:champion false, :team_name \"red_bull\", :first_name \"Max\"}),\n;;  :winning_driver\n;;  {:champion true, :team_name \"mercedes_gp\", :first_name \"Lewis\"}}\n```\n\nOn your client you crave Clojure data, but the GraphQL server is trying to force feed you underscores or camels.\nlocksmith's `gql-\u003eclj` sorts it out!\n\n```clj\n(let [car-race-converter (gql-\u003eclj lacinia-schema :car_race)]\n  (car-race-converter {:country_name \"GB\"\n                       :winning_driver {:first_name \"Lewis\"\n                                        :team_name \"mercedes_gp\"\n                                        :champion true}\n                       :competing_drivers [{:first_name \"Lewis\"\n                                            :team_name \"mercedes_gp\"\n                                            :champion true}\n                                           {:first_name \"Sebastian\"\n                                            :team_name \"ferrari_scuderia\"\n                                            :champion true}\n                                           {:first_name \"Max\"\n                                            :team_name \"red_bull\"\n                                            :champion false}]}))\n\n;; {:country-name \"GB\",\n;;  :competing-drivers\n;;  ({:champion? true, :team-name :mercedes-gp, :first-name \"Lewis\"}\n;;   {:champion? true,\n;;    :team-name :ferrari-scuderia,\n;;    :first-name \"Sebastian\"}\n;;   {:champion? false, :team-name :red-bull, :first-name \"Max\"}),\n;;  :winning-driver\n;;  {:champion? true, :team-name :mercedes-gp, :first-name \"Lewis\"}}\n\n```\n\n## Development\n\n[![CircleCI](https://circleci.com/gh/oliyh/locksmith.svg?style=svg)](https://circleci.com/gh/oliyh/locksmith)\n\n## License\n\nCopyright © 2017 oliyh\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliyh%2Flocksmith","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foliyh%2Flocksmith","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliyh%2Flocksmith/lists"}