-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graphql sorting #572
Graphql sorting #572
Conversation
d94fb7f
to
094265d
Compare
65eb458
to
ac28ae7
Compare
- Renamed source and target Relationship fields to source_entity and target_entity. source was in conflict with an existing entity field. - Removed the specification sort field for Indicators. It's an union of several schemas (ThreatBrainSpecification, SnortSpecification, ...), there is no common field to sort on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I would add some "manual" tests that would require to be rewritten in case of schema/sort-keys changes, just to prevent an "invisible bug".
@@ -17,7 +18,7 @@ | |||
:startCursor {:type Scalars/GraphQLString} | |||
:endCursor {:type Scalars/GraphQLString}})) | |||
|
|||
(def connection-arguments | |||
(def connection-arguments ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think leaving the ;
here is just a typo
test/ctia/test_helpers/graphql.clj
Outdated
(str "Nodes are correctly sorted by " sort-field)) | ||
(is (not-empty (:edges connection-data))) | ||
(is (= edges-ref edges) | ||
(str "Edges are correctly sorted by " sort-field)))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps replace the "are" by "should be" in the test messages.
test/ctia/test_helpers/graphql.clj
Outdated
operation-name) | ||
connection-data (get-in data connection-path) | ||
nodes (->> (:nodes connection-data) | ||
(map sort-field-fn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as sort-field-fn is used by the the graphql query. I think it would be nice to have one manual test which compare datas directly to check that sort is doing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not see any glaring issues after a quick review.
I do think we will need a special sort field/keyword for the "UI ordering" of judgements. Please coordinate with @polygloton on that since he is working on implementing an ES sort fragement that handles the sorting.
ac28ae7
to
5639934
Compare
Connected to #571