Skip to content

Commit

Permalink
Restrict fragment-spread map to be required (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmoraunio authored Jun 6, 2024
1 parent 130d9d5 commit 9c91edc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/oksa/parse.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@
[:fn #(not (@reserved-keywords %))]]
::FragmentSpread [:cat
[:enum :oksa/fragment-spread :...]
[:? [:map
[:name {:optional false}
[:ref ::FragmentName]]
[:directives {:optional true}
[:ref ::Directives]]]]]
[:map
[:name {:optional false}
[:ref ::FragmentName]]
[:directives {:optional true}
[:ref ::Directives]]]]
::InlineFragment [:cat
[:enum :oksa/inline-fragment :...]
[:? [:map
Expand Down
3 changes: 2 additions & 1 deletion test/oksa/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@
(t/testing "fragment spread"
(t/is (= "{foo ...bar}"
(unparse-and-validate [:foo [:... {:name :bar}]])
(unparse-and-validate [:foo [:oksa/fragment-spread {:name :bar}]]))))
(unparse-and-validate [:foo [:oksa/fragment-spread {:name :bar}]])))
(t/is (thrown? #?(:clj Exception :cljs js/Error) (unparse-and-validate [[:oksa/fragment-spread]]))))
(t/testing "inline fragment"
(t/is (= "{foo ...{bar}}"
(unparse-and-validate [:foo [:... [:bar]]])
Expand Down

0 comments on commit 9c91edc

Please sign in to comment.