Closed ilmoraunio closed 5 months ago
During development, the API evolved a bit to support global transformer fns and local overrides. I also ended up introducing transformers not just for names, but also for fields, enums, directives, and types.
Tiny example:
(require '[camel-snake-kebab.core :as csk])
(oksa.core/gql*
{:oksa/name-fn csk/->camelCase}
[[:foo-bar {:alias :bar-foo
:directives [:foo-bar]
:arguments {:foo-arg :bar-value}}
[:foo-bar]]
:naked-foo-bar
[:...
[:foo-bar]]
[:... {:on :foo-bar-fragment
:directives [:foo-bar]}
[:foo-bar]]])
; => "{barFoo:fooBar(fooArg:barValue)@fooBar{fooBar} nakedFooBar ...{fooBar} ...on fooBarFragment@fooBar{fooBar}}"
See more examples in the README or tests.
We should consider supporting non-standard compliant representations for field names through name transformers. The name transformers should convert the field names either at parse time or during unparse time.
Use cases / rationale
Paraphrasing the example behind the link:
Example: