Liking cljdoc? Tell your friends :D

com.walmartlabs.lacinia.util

Useful utility functions.

Useful utility functions.
raw docstring

as-error-mapclj

(as-error-map t)
(as-error-map t more-data)

Converts an exception into an error map, including a :message key, plus any additional keys and values via ex-data.

In the second arity, a further map of values to be merged into the error map can be provided.

Converts an exception into an error map, including a :message key, plus
any additional keys and values via `ex-data`.

In the second arity, a further map of values to be merged into the error
map can be provided.
raw docstring

attach-resolversclj

(attach-resolvers schema resolver-m)

Given a GraphQL schema and a map of keywords to resolver fns, replace each placeholder keyword in the schema with the actual resolver fn.

resolver-m is a map from keyword to resolver function or resolver factory.

When the value in the :resolve key is a keyword, it is simply replaced with the corresponding resolver function from resolver-m.

Alternately, the :resolve value may be a seq, indicating a resolver factory.

The first value in the seq is used to select the resolver factory function, which applied with the remaining values in the seq.

Given a GraphQL schema and a map of keywords to resolver fns, replace
each placeholder keyword in the schema with the actual resolver fn.

resolver-m is a map from keyword to resolver function or resolver factory.

When the value in the :resolve key is a keyword, it is simply replaced
with the corresponding resolver function from resolver-m.

Alternately, the :resolve value may be a seq, indicating a resolver factory.

The first value in the seq is used to select the resolver factory function, which applied
with the remaining values in the seq.
raw docstring

attach-scalar-transformersclj

(attach-scalar-transformers schema transform-m)

Given a GraphQL schema, attaches functions in the transform-m map to the schema.

Inside each scalar definition, the :parse and :serialize keys are replaced with values from the transform-m map.

In the initial schema, use a keyword for the :parse and :serialize keys, then provide a corresponding value in transform-m.

Given a GraphQL schema, attaches functions in the transform-m map to the schema.

Inside each scalar definition, the :parse and :serialize keys are replaced with
values from the transform-m map.

In the initial schema, use a keyword for the :parse and :serialize keys, then
provide a corresponding value in transform-m.
raw docstring

attach-streamersclj

(attach-streamers schema streamer-map)

Attaches stream handler functions to subscriptions.

Replaces the :stream key inside subscription operations using the same logic as attach-resolvers.

Attaches stream handler functions to subscriptions.

Replaces the :stream key inside subscription operations using the same logic as
[[attach-resolvers]].
raw docstring

inject-descriptionsclj

(inject-descriptions schema documentation)

Injects documentation into a schema, as :description keys on various elements within the schema.

The documentation map keys are keywords with a particular structure, and the values are formatted Markdown strings.

The keys are one of the following forms:

  • :Type
  • :Type/name
  • :Type/name.argument

A simple Type will document an object, input object, interface, union, or enum.

The second form is used to document a field of an object, input object, or interface, or to document a specific value of an enum (e.g., :Episode/NEW_HOPE).

The final form is used to document an argument to a field (it does not make sense for enums).

Additionally, the Type can be queries, mutations, or subscriptions, in which case the name will be the name of the operation (e.g., :queries/episode).

See [[parse-docs]].

Injects documentation into a schema, as `:description` keys on various elements
within the schema.

The documentation map keys are keywords with a particular structure,
and the values are formatted Markdown strings.

The keys are one of the following forms:

- `:Type`
- `:Type/name`
- `:Type/name.argument`

A simple `Type` will document an object, input object, interface, union, or enum.

The second form is used to document a field of an object, input object, or interface, or
to document a specific value of an enum (e.g., `:Episode/NEW_HOPE`).

The final form is used to document an argument to a field (it does not make sense for enums).

Additionally, the `Type` can be `queries`, `mutations`, or `subscriptions`, in which case
the `name` will be the name of the operation (e.g., `:queries/episode`).

See [[parse-docs]].
raw docstring

inject-resolversclj

(inject-resolvers schema resolvers)

Adds resolvers to the schema. The resolvers map is a map of keywords to field resolvers (as functions, or [[FieldResolver]] instances).

The key identifies where the resolver should be added, in the form :Type/field.

Alternately, the key may be of the format :queries/name (or :mutations/name or subscriptions/name).

Throws an exception if the target of the resolver can't be found.

In many cases, this is a full replacement for attach-resolvers, but the two functions can also be used in conjunction with each other.

Adds resolvers to the schema.  The resolvers map is a map of keywords to
field resolvers (as functions, or [[FieldResolver]] instances).

The key identifies where the resolver should be added, in the form `:Type/field`.

Alternately, the key may be of the format `:queries/name` (or `:mutations/name` or
`subscriptions/name`).

Throws an exception if the target of the resolver can't be found.

In many cases, this is a full replacement for [[attach-resolvers]], but the two functions
can also be used in conjunction with each other.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close