This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-01
Channels
- # aws (2)
- # aws-lambda (18)
- # beginners (68)
- # boot (6)
- # cider (2)
- # clara (2)
- # clojars (27)
- # clojure (68)
- # clojure-austin (5)
- # clojure-berlin (6)
- # clojure-dev (28)
- # clojure-greece (7)
- # clojure-italy (46)
- # clojure-japan (3)
- # clojure-nl (1)
- # clojure-russia (8)
- # clojure-sg (1)
- # clojure-spec (17)
- # clojure-uk (86)
- # clojurescript (82)
- # community-development (2)
- # cursive (18)
- # datomic (11)
- # duct (5)
- # fulcro (254)
- # garden (2)
- # graphql (6)
- # hoplon (19)
- # instaparse (4)
- # kekkonen (2)
- # leiningen (4)
- # luminus (3)
- # lumo (9)
- # off-topic (28)
- # om (7)
- # onyx (38)
- # other-languages (27)
- # portkey (7)
- # protorepl (1)
- # re-frame (56)
- # reagent (64)
- # ring (14)
- # ring-swagger (7)
- # shadow-cljs (255)
- # sql (2)
- # vim (11)
- # yada (10)
Hi guys, first of all good job for the great work and thx for all the contributions you did in the opensource community 🎉. I was wondering, is there a way to enforce the client to respect a schema and deny the request server side if the client doesn’t respect the schema. I would like to define only in one place what a client should be able to do. This request will be resolve server side even if the id parameter is null and the input object doesn’t accept null parameter.
mutation ($users: [user]) {
createUsers(users: $users) {
id
name
}
}
{"users":
[{"name": "Bob", "id": 42},
{"name": "Rob"}] ;missing property id
}
{:input-objects
{:userInput
{:fields {:name {:type (non-null String)}
:id {:type (non-null Int)}}}}
:objects
{:user
{:fields {:name {:type (non-null String)}
:id {:type (non-null Int)}}}}
:mutations
{:createUsers {:type (list :user)
:args {:users {:type (list :userInput)}}
:resolve :create-users}}}
This would result into an error like this
{
"data": {
"generateLicenses": [
{
"id": "42",
"name": "bob",
},
{
"id": nil,
"name": "rob"
}
]
},
"errors": [
{
"message": "Non-nullable field was null.",
"locations": [
{
"line": 2,
"column": 40
}
],
"query-path": [
"createUsers",
"id"
]
}
]
}
Thx 🙂This looks like it worked to me ... you submitted an invalid user (missing the not-null id property) and got an error back ... ah, I see, you also got some execution going on.
That's part of Lacinia and GraphQL I think: accept and report errors, continue as well as possible.