Skip to content
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

Add Input Value List Support for GraphQL #497

Conversation

DimuthuMadushan
Copy link
Contributor

Purpose

Fixes: #1837
Fixes: #2133

Examples

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests

@codecov
Copy link

codecov bot commented Nov 19, 2021

Codecov Report

Merging #497 (1299c61) into master (ce620aa) will decrease coverage by 0.30%.
The diff coverage is 92.05%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #497      +/-   ##
============================================
- Coverage     94.90%   94.59%   -0.31%     
- Complexity      297      335      +38     
============================================
  Files            54       53       -1     
  Lines          2981     3368     +387     
  Branches       1537     1748     +211     
============================================
+ Hits           2829     3186     +357     
- Misses          128      153      +25     
- Partials         24       29       +5     
Impacted Files Coverage Δ
ballerina/modules/parser/types.bal 0.00% <ø> (ø)
...ina/stdlib/graphql/runtime/engine/EngineUtils.java 98.41% <ø> (ø)
...allerina/stdlib/graphql/runtime/engine/Engine.java 88.65% <86.20%> (-2.62%) ⬇️
ballerina/validator_visitor.bal 94.43% <89.09%> (-4.31%) ⬇️
...dlib/graphql/runtime/engine/ResponseGenerator.java 95.23% <91.66%> (-0.53%) ⬇️
...rina/stdlib/graphql/runtime/schema/TypeFinder.java 95.79% <92.85%> (-0.40%) ⬇️
ballerina/modules/parser/parser.bal 95.21% <97.14%> (+0.30%) ⬆️
ballerina/common_utils.bal 96.52% <97.61%> (+0.63%) ⬆️
ballerina/directive_visitor.bal 97.11% <100.00%> (ø)
ballerina/executor_visitor.bal 90.00% <100.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce620aa...1299c61. Read the comment docs.

ballerina/modules/parser/argument_node.bal Outdated Show resolved Hide resolved
ballerina/tests/29_list_type_inputs.bal Outdated Show resolved Hide resolved
ballerina/validator_visitor.bal Show resolved Hide resolved
changelog.md Outdated Show resolved Hide resolved
Comment on lines 70 to 72
if (type.getTag() == TypeTags.ARRAY_TAG) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have to specifically check for the array types here? Is this check needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When we get an array type input like float[][], type.Package value is not present. Due to that following if condition will cause to a NPE. if (type.getPackage().getOrg() == null || type.getPackage().getName() == null) {.

Copy link
Member

Choose a reason for hiding this comment

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

Then let's add a check like this:

if (type.getPackage() == null) {
    return false;
}

if (type.getPackage().getOrg() == null || type.getPackage().getName() == null) {
    return false;
}

spotbugs-exclude.xml Outdated Show resolved Hide resolved
@DimuthuMadushan DimuthuMadushan force-pushed the parser-validation-for-inputs branch from cc24be1 to e753748 Compare November 30, 2021 07:41
ballerina/modules/parser/argument_node.bal Show resolved Hide resolved
ballerina/validator_visitor.bal Show resolved Hide resolved
Comment on lines 70 to 72
if (type.getTag() == TypeTags.ARRAY_TAG) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

Then let's add a check like this:

if (type.getPackage() == null) {
    return false;
}

if (type.getPackage().getOrg() == null || type.getPackage().getName() == null) {
    return false;
}

@ThisaruGuruge ThisaruGuruge merged commit 010a641 into ballerina-platform:master Nov 30, 2021
@DimuthuMadushan DimuthuMadushan deleted the parser-validation-for-inputs branch January 3, 2022 10:42
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.

Add Parser Validation for GraphQL List Type Input Values Add Input Value List Support for GraphQL
2 participants