graphql

fabrao 2021-02-16T09:15:28.032400Z

Hello all, can I use field names with "-" instead of "_"?

fabrao 2021-02-16T09:15:48.032600Z

in lacinia?

vlaaad 2021-02-16T09:17:57.033Z

I don’t think so, IIRC it’s prohibited by GraphQL spec

vlaaad 2021-02-16T09:18:09.033700Z

Name
/[_A-Za-z][_0-9A-Za-z]*/

fabrao 2021-02-16T09:23:12.034600Z

(defn hyphenating-default-field-resolver
  "An alternative to [[default-field-resolver]], this converts underscores in the field name
  into hyphens.  At one time, this was the default behavior."
  {:added "0.17.0"}
  [field-name]
  (-> field-name
      name
      (str/replace "_" "-")
      keyword
      default-field-resolver))
what is it means? Can I use with '-' and it change after?

2021-02-16T09:26:34.036Z

You can customise the default resolver in your compile call: https://walmartlabs.github.io/apidocs/lacinia/com.walmartlabs.lacinia.schema.html#var-compile . Meaning that you can automatically convert between underscores and hyphens. That said, the convention I see most in GraphQL endpoints is actually camelCase, not snake_case.

gklijs 2021-02-16T10:13:01.039700Z

I tried upgrading lacinia-pedestal to 0.15.0 from 0.12.0, making use of the 'new' pedestal2/default-service. But to no success. Does the compiled-schema also need to look different? Does someone maybe know of an example project using 0.15.0?

gklijs 2021-02-16T17:09:43.039800Z

Specifically it goes wrong when trying to run aot compiled from docker. When run locally with lein run it does work.

gklijs 2021-02-16T18:49:12.040Z

So now I've found a way to create a uberjar without aot all. And when running the jar loccaly it works. But when running the jar in docker it seems like it's not doing anything. Maybe I need to set the hostname?