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

SLING-12014 - GraphQL Core needs to support additional fields from GraphQL Java #37

Merged
merged 7 commits into from
Sep 11, 2023

Conversation

schaefa
Copy link
Contributor

@schaefa schaefa commented Aug 30, 2023

graphql-java’s Selected Field

graphql-java’s Selected Field
@raducotescu raducotescu changed the title SLING-12014 - Add additional fields based on the SLING-12014 - GraphQL Core needs to support additional fields from GraphQL Java Aug 31, 2023
Comment on lines 57 to 69

/**
* @return the alias of the selected field or null if not alias was used
*/
String getAlias();

/**
* The result key is either the field query alias OR the field name in that preference order
*
* @return the result key of the selected field
*/
String getResultKey();

Copy link
Member

Choose a reason for hiding this comment

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

Can you please add the JSR-305 annotations to all the methods? (return values and parameters)

Copy link
Member

Choose a reason for hiding this comment

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

It is Jetbrains null annotations nowadays (https://sling.apache.org/documentation/development/null-analysis.html) :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I cannot because the source of the values does not provide any annotations or any other indication of the expectation. I will mark the all Nullable for now

Comment on lines 112 to 124
public int getLevel() {
return 0;
}

@Override
public String getAlias() {
return null;
}

@Override
public String getResultKey() {
return null;
}
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you return the actual values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I missed that - DONE

@schaefa
Copy link
Contributor Author

schaefa commented Aug 31, 2023

I added the JCR-305 to all fields, methods and parameters. Right now all of them are Nullable that come from Graphql-java because they do not provide any indication there.

with duplicate sub fields by simple name. There is still the expectation that fields are unique by FQN.
Also added a test for the Selected Field for better coverage.
@sonarcloud
Copy link

sonarcloud bot commented Sep 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

97.3% 97.3% Coverage
0.0% 0.0% Duplication

@schaefa
Copy link
Contributor Author

schaefa commented Sep 6, 2023

I replaced the HashMap for fields by their simple name with a multi value map to avoid loosing fields when we have multiple fields with the same simple name.

@schaefa schaefa merged commit bc5a151 into master Sep 11, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants