-
Notifications
You must be signed in to change notification settings - Fork 55
Implementation calculations fields #83
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #83 +/- ##
============================================
+ Coverage 60.4% 61.52% +1.11%
- Complexity 283 313 +30
============================================
Files 31 32 +1
Lines 1816 1879 +63
Branches 282 287 +5
============================================
+ Hits 1097 1156 +59
- Misses 593 597 +4
Partials 126 126
Continue to review full report at Codecov.
|
...ations/src/main/java/com/introproventures/graphql/jpa/query/annotation/GraphQLCalcField.java
Outdated
Show resolved
Hide resolved
...chema/src/test/java/com/introproventures/graphql/jpa/query/schema/model/calc/CalcEntity.java
Show resolved
Hide resolved
@@ -146,7 +137,7 @@ public Object get(DataFetchingEnvironment environment) { | |||
Field selectedField = (Field) selection; | |||
|
|||
// "__typename" is part of the graphql introspection spec and has to be ignored by jpa | |||
if(!TYPENAME.equals(selectedField.getName())) { | |||
if(!TYPENAME.equals(selectedField.getName()) && !CashGraphQLCalcFields.isCalcField(from.getJavaType(), selectedField.getName())) { |
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.
You could use JPA @Transient
annotation to ignore calculated fields in queries.
@miklemv Thank you for contribution! The library is definitely missing transient calculated fields support. Aside from suggestions to improve class names, I wonder why not use JPA's |
I thought that specifying GraphQLCalculatedField would be more understandable. But this solution contains more code. I think we can use @transient while the logic of the work will remain the same. If @transient is more preferable - I can modify the code. |
@miklemv Less code sounds good! 👍 I think it makes sense to use existing JPA |
I changed the logic, now we look at @transient. |
@miklemv Can you rebase your PR on top of master to resolve merge conflicts and trigger Travis CI? Thank you! |
I recreate branch. |
Good day.
Our team needs to make computable fields in graphQL queries: calculations that are not implemented with the Formula instruction. I propose a revision to implement this functionality:
Also our team is working on the implementation of mutations for jpa, but it is still in testing.