Skip to content

Commit

Permalink
Prepare for v0.38.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hlship committed Jan 22, 2021
1 parent 8b36e0f commit 97f9ed0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
20 changes: 20 additions & 0 deletions docs/_examples/tutorial/schema-0.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(ns clojure-game-geek.schema
"Contains custom resolvers and a function to provide the full schema."
(:require
[clojure.java.io :as io]
[com.walmartlabs.lacinia.util :as util]
[com.walmartlabs.lacinia.schema :as schema]
[clojure.edn :as edn]))

(defn resolver-map
[]
{:query/game-by-id (fn [context args value]
nil)})

(defn load-schema
[]
(-> (io/resource "cgg-schema.edn")
slurp
edn/read-string
(util/attach-resolvers (resolver-map))
schema/compile))
10 changes: 5 additions & 5 deletions docs/tutorial/init-schema.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ schema namespace

With the schema defined, the next step is to write code to load the schema into memory, and make it operational for queries:

.. literalinclude:: /_examples/tutorial/cgg-schema-2.edn
:caption: resources/cgg-schema.edn
.. literalinclude:: /_examples/tutorial/schema-0.clj
:caption: src/clojure_game_geek/schema.clj

This code loads the schema EDN file, :doc:`attaches field resolvers </resolve/attach>` to the schema,
then `compiles` the schema.
Expand Down Expand Up @@ -128,7 +128,7 @@ our needs in this project.
When you launch a REPL, it always starts in this namespace.

We can define the user namespace in the ``dev-resources`` folder; this ensures
that it is not packaged up with the rest of our application when we eventually package
that it is not included with the rest of our application when we eventually package
and deploy the application.

.. literalinclude:: /_examples/tutorial/user-1.clj
Expand Down Expand Up @@ -169,7 +169,7 @@ This is not an error ... remember that we defined the type of the
``game_by_id`` operation to allow nulls, just for this specific situation.

However, Lacinia still returns a map with the operation name and operation selection.
Failure to return a result with a ``:data`` key would signify an error executing
Failure to return a result with a top-level ``:data`` key would signify an error executing
the query, such as a parse error.
That's not the case here at all.

Expand All @@ -189,7 +189,7 @@ In the next chapter, we'll build on this modest start, introducing more schema t
to use symbols everywhere, nothing will break. This is part of the schema compilation
process.
.. [#spec] Because the input schema format is so complex, it `always` validated
.. [#spec] Because the input schema format is so complex, it is `always` validated
using clojure.spec. This helps to ensure that minor typos or other gaffes
are caught early rather than causing you great confusion later.
Expand Down
7 changes: 3 additions & 4 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
(defproject com.walmartlabs/lacinia "0.38.0-alpha-9"
(defproject com.walmartlabs/lacinia "0.38.0"
:description "A GraphQL server implementation in Clojure"
:url "https://github.com/walmartlabs/lacinia"
:license {:name "Apache, Version 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0"}
:plugins [[lein-codox "0.10.7"]
[test2junit "1.2.5"]]
:dependencies [[org.clojure/clojure "1.10.1"]
;; NOTE: 0.2.8 doesn't appear to be compatible with JDK 1.8
[clj-antlr "0.2.7"]
[clj-antlr "0.2.9"]
[org.flatland/ordered "1.5.9"]
[org.clojure/data.json "1.0.0"]]
:source-paths ["src"]
Expand All @@ -16,7 +15,7 @@
[joda-time "2.10.9"]
[com.walmartlabs/test-reporting "1.0.0"]
[io.aviso/logging "0.3.2"]
[io.pedestal/pedestal.log "0.5.5"]
[io.pedestal/pedestal.log "0.5.8"]
[org.clojure/test.check "1.1.0"]
[org.clojure/data.csv "1.0.0"]
[org.clojure/tools.cli "1.0.194"]]}}
Expand Down

0 comments on commit 97f9ed0

Please sign in to comment.