Skip to content

Add support for list parameter types#7

Open
r0man wants to merge 1 commit intoJannis:masterfrom
r0man:list-param-type
Open

Add support for list parameter types#7
r0man wants to merge 1 commit intoJannis:masterfrom
r0man:list-param-type

Conversation

@r0man
Copy link
Copy Markdown

@r0man r0man commented Apr 10, 2018

No description provided.

;; (s/fdef graphql-query-params
;; :args (s/cat :params (s/spec ::v1/params))
;; :ret string?)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disabled the specs for graphql-query-params and graphql-bound-query-params for now, because they take now the conformed spec params (a vector with the spec tags). See my comments at the TODOs.

#_(is (= (q/graphql-query '(nodes {?ids [ID!!]} [:id :__typename]))
"query nodes ($ids: [ID!]!) { nodes (ids: $ids) { id __typename } }"))
#_(is (= (q/graphql-query '(nodes {?ids (ID!)} [:id :__typename]))
"query nodes ($ids: [ID!]!) { nodes (ids: $ids) { id __typename } }")))
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GraphQL has also the notion of not nullable lists, like [Int!]! for example. Not sure what's the best syntax to use here. I had those 2 ideas, either a double !! in the inner type. We could use a list instead of a vector meaning not nullable, or maybe a set? I don't like any of those too much. Do you have another idea?


(s/fdef graphql-bound-mutation-params
:args (s/cat :params (s/spec ::groom.specs.v1/mutation-call-params))
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the queries and mutations namespaces are perfect candidates for cljc. When converting them to cljc I noticed that the double colon in front of ::groom.specs.v1/mutation-call-params fails in clojure, but not in clojurescript. I choose to use the alias instead of the fully qualified keywords, because I think the we will use the v1 namespace quite often here and in the queries namespace.

Comment thread project.clj
[org.clojure/test.check "0.10.0-alpha2"]
[sablono "0.8.3"]]
:source-paths ["src/main"]
:test-paths ["src/test"])
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the project.clj if you want, I just wanted to get a REPL going and wasn't sure what the plan was regarding boot or deps.edn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant