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

support placeholder at apiReturnListType and apiReturnType #1200

Merged
merged 8 commits into from
May 15, 2023
Merged

support placeholder at apiReturnListType and apiReturnType #1200

merged 8 commits into from
May 15, 2023

Conversation

matsudamper
Copy link
Contributor


Description

Related to #1167

Added placeholder support for apiReturnListType and apiReturnType.
The following syntax is supported.

apiReturnType = "java.util.concurrent.CompletionStage<graphql.execution.DataFetcherResult<{{TYPE}}>>"

Changes were made to:

  • Codegen library - Java
  • Codegen library - Kotlin
  • Codegen library - Scala
  • Maven plugin
  • Gradle plugin
  • SBT plugin

Copy link
Owner

@kobylynskyi kobylynskyi left a comment

Choose a reason for hiding this comment

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

@matsudamper the approach looks good to me. Can you please fix a minor comment I have in Java/Kotlin/Scala mappers and we should be good to merge this. Thanks

return computedTypeName.replace(JAVA_UTIL_LIST, mappingContext.getApiReturnListType());
if (mappingContext.getApiReturnListType().contains(MappingConfigConstants.API_RETURN_NAME_PLACEHOLDER)) {
Matcher matcher = JAVA_UTIL_LIST_ELEMENT_REGEX.matcher(computedTypeName);
matcher.find();
Copy link
Owner

Choose a reason for hiding this comment

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

@matsudamper I think it's better if you do if (matcher.find()) { ... }

boolean isNullable = computedTypeName.endsWith(KOTLIN_UTIL_NULLABLE);

Matcher matcher = KOTLIN_UTIL_LIST_ELEMENT_REGEX.matcher(computedTypeName);
matcher.find();
Copy link
Owner

Choose a reason for hiding this comment

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

@matsudamper I think it's better if you do if (matcher.find()) { ... }

return computedTypeName.replace(SCALA_UTIL_LIST, mappingContext.getApiReturnListType());
if (mappingContext.getApiReturnListType().contains(MappingConfigConstants.API_RETURN_NAME_PLACEHOLDER)) {
Matcher matcher = SCALA_UTIL_LIST_ELEMENT_REGEX.matcher(computedTypeName);
matcher.find();
Copy link
Owner

Choose a reason for hiding this comment

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

@matsudamper I think it's better if you do if (matcher.find()) { ... }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented.
2542b8f

@kobylynskyi kobylynskyi added this to the 5.8.0 milestone May 11, 2023
Copy link
Owner

@kobylynskyi kobylynskyi left a comment

Choose a reason for hiding this comment

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

LGTM! Will include this feature in the next release. Thank you for the contribution!

@kobylynskyi kobylynskyi merged commit 8d9d0de into kobylynskyi:main May 15, 2023
@matsudamper matsudamper deleted the feature/damper/api-return-type-and-list-placeholder branch May 18, 2023 10:10
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.

2 participants