diff --git a/ballerina-tests/Dependencies.toml b/ballerina-tests/Dependencies.toml index 0c1349ec9..8103fe219 100644 --- a/ballerina-tests/Dependencies.toml +++ b/ballerina-tests/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.9.0-20240405-165800-4b163f78" +distribution-version = "2201.9.0-20240410-095500-2653a74d" [[package]] org = "ballerina" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index d4de0b147..a399dc7ef 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.9.0-20240405-165800-4b163f78" +distribution-version = "2201.9.0-20240410-095500-2653a74d" [[package]] org = "ballerina" diff --git a/ballerina/modules/dataloader/dataloader.bal b/ballerina/modules/dataloader/dataloader.bal index 6d0b0e70e..ef41424cc 100644 --- a/ballerina/modules/dataloader/dataloader.bal +++ b/ballerina/modules/dataloader/dataloader.bal @@ -49,14 +49,14 @@ public isolated class DefaultDataLoader { private final BatchLoadFunction batchFunction; # Initializes the DataLoader with the given batch function. - # + # # + loadFunction - The batch function to be used public isolated function init(BatchLoadFunction loadFunction) { self.batchFunction = loadFunction; } # Collects a key to perform a batch operation at a later time. - # + # # + key - The key to load later public isolated function add(anydata key) { readonly & anydata clonedKey = key.cloneReadOnly(); @@ -70,7 +70,7 @@ public isolated class DefaultDataLoader { } # Retrieves the result for a particular key. - # + # # + key - The key to retrieve the result # + 'type - The type of the result # + return - The result for the key on success, error on failure diff --git a/changelog.md b/changelog.md index acfe2d931..30d1f28d3 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Fixed - [[#4848] Fix Resolvers not Able to Return Error Reference Types](https://github.com/ballerina-platform/ballerina-library/issues/4848) - [[#4859] Fix Service Crashing when Intersection Types are Used as Input Objects](https://github.com/ballerina-platform/ballerina-library/issues/4859) +- [[#6418] Fix Code Coverage Showing Invalid Entries with GraphQL](https://github.com/ballerina-platform/ballerina-library/issues/6418) +- [[#6310] Fix Incorrect Error Message in Compiler Plugin](https://github.com/ballerina-platform/ballerina-library/issues/6310) ## [1.11.0] - 2023-02-21 diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/graphql/compiler/diagnostics/DiagnosticMessage.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/graphql/compiler/diagnostics/DiagnosticMessage.java index ae9fdfa11..0796d28a3 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/graphql/compiler/diagnostics/DiagnosticMessage.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/graphql/compiler/diagnostics/DiagnosticMessage.java @@ -46,10 +46,10 @@ public enum DiagnosticMessage { ERROR_113("a GraphQL service must include at least one resource method with the accessor '''" + RESOURCE_FUNCTION_GET + "''' that does not have the @dataloader:Loader annotation attached" + " to it"), - ERROR_114("the GraphQL field ''{0}'' use input type ''{1}'' as an output type. A GraphQL field cannot use an input " - + "type as an output type"), - ERROR_115("the GraphQL field ''{0}'' use output type ''{1}'' as an input type. A GraphQL field cannot use an output" - + " type as an input type"), + ERROR_114("the GraphQL field ''{0}'' uses input type ''{1}'' as an output type. A GraphQL field cannot use an " + + "input type as an output type"), + ERROR_115("the GraphQL field ''{0}'' uses output type ''{1}'' as an input type. A GraphQL field cannot use an " + + "output type as an input type"), ERROR_116("non-distinct service class ''{0}'' is used as a GraphQL interface"), ERROR_117("found path parameters ''{0}'' in GraphQL resource. Path parameters are not allowed in GraphQL " + "resources"), diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/graphql/compiler/schema/generator/GraphqlSourceModifier.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/graphql/compiler/schema/generator/GraphqlSourceModifier.java index cdc0861ea..95ba9e963 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/graphql/compiler/schema/generator/GraphqlSourceModifier.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/graphql/compiler/schema/generator/GraphqlSourceModifier.java @@ -431,9 +431,7 @@ private AnnotationNode updateAnnotationNode(AnnotationNode annotationNode, Strin SeparatedNodeList updatedFields = getUpdatedFields(annotationNode.annotValue().get(), schemaString, cacheConfigContext); MappingConstructorExpressionNode node = - NodeFactory.createMappingConstructorExpressionNode( - NodeFactory.createToken(SyntaxKind.OPEN_BRACE_TOKEN), updatedFields, - NodeFactory.createToken(SyntaxKind.CLOSE_BRACE_TOKEN)); + annotationNode.annotValue().get().modify().withFields(updatedFields).apply(); return annotationNode.modify().withAnnotValue(node).apply(); } return getServiceAnnotation(schemaString, cacheConfigContext, prefix); @@ -445,8 +443,14 @@ private SeparatedNodeList getUpdatedFields(MappingConstructorE List fields = new ArrayList<>(); SeparatedNodeList existingFields = annotationValue.fields(); Token separator = NodeFactory.createToken(SyntaxKind.COMMA_TOKEN); - for (MappingFieldNode field : existingFields) { - fields.add(field); + int fieldCount = existingFields.size(); + for (int i = 0; i < fieldCount; i++) { + fields.add(existingFields.get(i)); + if (fieldCount > 1 && i < fieldCount - 1) { + fields.add(existingFields.getSeparator(i)); + } + } + if (fieldCount > 0) { fields.add(separator); } fields.add(getSchemaStringFieldNode(schemaString));