Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ public JsonElement getGraphqlType(SemanticModel semanticModel, Document document
if (SyntaxKind.SERVICE_DECLARATION == parentNode.kind()) {
optSymbol = semanticModel.symbol(parentNode);
}
} else if (SyntaxKind.MARKDOWN_DOCUMENTATION_LINE == node.kind()) {
NonTerminalNode docNode = node.parent();
if (docNode.kind() == SyntaxKind.MARKDOWN_DOCUMENTATION &&
docNode.parent().kind() == SyntaxKind.METADATA) {
MetadataNode metadata = (MetadataNode) docNode.parent();
NonTerminalNode parentNode = metadata.parent();
if (SyntaxKind.SERVICE_DECLARATION == parentNode.kind()) {
optSymbol = semanticModel.symbol(parentNode);
}
}
} else {
optSymbol = semanticModel.symbol(document, linePosition);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"filePath": "test_pack1/service.bal",
"position": {
"line": 14,
"offset": 0
},
"description": "Get service data",
"type": {
"name": "/graphql2",
"editable": true,
"metadata": {
"label": "/graphql2",
"description": "This is a simple GraphQL service that\nincludes a query field."
},
"codedata": {
"node": "SERVICE_DECLARATION",
"lineRange": {
"fileName": "service.bal",
"startLine": {
"line": 17,
"offset": 0
},
"endLine": {
"line": 26,
"offset": 1
}
}
},
"properties": {
"name": {
"metadata": {
"label": "Type name",
"description": "Unique name to identify the type"
},
"valueType": "IDENTIFIER",
"value": "/graphql2",
"optional": false,
"editable": false,
"advanced": false,
"hidden": false
},
"qualifiers": {
"metadata": {
"label": "Type Qualifiers",
"description": "Qualifiers of the type"
},
"valueType": "MULTIPLE_SELECT",
"value": [],
"optional": true,
"editable": true,
"advanced": true,
"hidden": false
},
"isReadOnly": {
"metadata": {
"label": "readonly",
"description": "Is this readonly"
},
"valueType": "FLAG",
"value": "false",
"optional": true,
"editable": true,
"advanced": false,
"hidden": false
},
"isArray": {
"metadata": {
"label": "Is array type",
"description": "Is this type an array or list value"
},
"valueType": "FLAG",
"value": "false",
"optional": true,
"editable": true,
"advanced": true,
"hidden": false
},
"arraySize": {
"metadata": {
"label": "Size of the array",
"description": "Array dimensions"
},
"valueType": "STRING",
"value": "",
"optional": false,
"editable": false,
"advanced": false,
"hidden": false
}
},
"members": [],
"functions": [
{
"accessor": "get",
"qualifiers": [
"ISOLATED",
"RESOURCE"
],
"parameters": [
{
"kind": "FIELD",
"refs": [],
"type": "string",
"name": "name",
"optional": false,
"readonly": false
}
],
"kind": "RESOURCE",
"name": "hello",
"description": "Returns a greeting message that includes provided name.",
"returnType": "string",
"refs": [],
"properties": {
"isPrivate": {
"metadata": {
"label": "private",
"description": "Is this private"
},
"valueType": "FLAG",
"value": "false",
"optional": true,
"editable": true,
"advanced": false,
"hidden": false
},
"isPublic": {
"metadata": {
"label": "public",
"description": "Is this public"
},
"valueType": "FLAG",
"value": "false",
"optional": true,
"editable": true,
"advanced": false,
"hidden": false
},
"isIsolated": {
"metadata": {
"label": "isolated",
"description": "Is this isolated"
},
"valueType": "FLAG",
"value": "true",
"optional": true,
"editable": true,
"advanced": false,
"hidden": false
}
}
}
],
"allowAdditionalFields": false
},
"refs": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"filePath": "test_pack1/service.bal",
"position": {
"line": 2,
"offset": 0
},
"description": "Get service data",
"type": {
"name": "/graphql",
"editable": true,
"metadata": {
"label": "/graphql",
"description": "This is a simple GraphQL service that\nincludes a query field."
},
"codedata": {
"node": "SERVICE_DECLARATION",
"lineRange": {
"fileName": "service.bal",
"startLine": {
"line": 4,
"offset": 0
},
"endLine": {
"line": 12,
"offset": 1
}
}
},
"properties": {
"name": {
"metadata": {
"label": "Type name",
"description": "Unique name to identify the type"
},
"valueType": "IDENTIFIER",
"value": "/graphql",
"optional": false,
"editable": false,
"advanced": false,
"hidden": false
},
"qualifiers": {
"metadata": {
"label": "Type Qualifiers",
"description": "Qualifiers of the type"
},
"valueType": "MULTIPLE_SELECT",
"value": [],
"optional": true,
"editable": true,
"advanced": true,
"hidden": false
},
"isReadOnly": {
"metadata": {
"label": "readonly",
"description": "Is this readonly"
},
"valueType": "FLAG",
"value": "false",
"optional": true,
"editable": true,
"advanced": false,
"hidden": false
},
"isArray": {
"metadata": {
"label": "Is array type",
"description": "Is this type an array or list value"
},
"valueType": "FLAG",
"value": "false",
"optional": true,
"editable": true,
"advanced": true,
"hidden": false
},
"arraySize": {
"metadata": {
"label": "Size of the array",
"description": "Array dimensions"
},
"valueType": "STRING",
"value": "",
"optional": false,
"editable": false,
"advanced": false,
"hidden": false
}
},
"members": [],
"functions": [
{
"accessor": "get",
"qualifiers": [
"ISOLATED",
"RESOURCE"
],
"parameters": [
{
"kind": "FIELD",
"refs": [],
"type": "string",
"name": "name",
"optional": false,
"readonly": false
}
],
"kind": "RESOURCE",
"name": "hello",
"description": "Returns a greeting message that includes provided name.",
"returnType": "string",
"refs": [],
"properties": {
"isPrivate": {
"metadata": {
"label": "private",
"description": "Is this private"
},
"valueType": "FLAG",
"value": "false",
"optional": true,
"editable": true,
"advanced": false,
"hidden": false
},
"isPublic": {
"metadata": {
"label": "public",
"description": "Is this public"
},
"valueType": "FLAG",
"value": "false",
"optional": true,
"editable": true,
"advanced": false,
"hidden": false
},
"isIsolated": {
"metadata": {
"label": "isolated",
"description": "Is this isolated"
},
"valueType": "FLAG",
"value": "true",
"optional": true,
"editable": true,
"advanced": false,
"hidden": false
}
}
}
],
"allowAdditionalFields": false
},
"refs": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
org = "testorg"
name = "test_pack1"
version = "0.1.0"
distribution = "2201.12.7"

[build-options]
observabilityIncluded = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import ballerina/graphql;

# This is a simple GraphQL service that
# includes a query field.
service /graphql on new graphql:Listener(9090) {

# Returns a greeting message that includes provided name.
# + name - Name to be included in the message
# + return - Greeting message with the name
resource function get hello(string name) returns string {
return string `Hello ${name}`;
}
}

# This is a simple GraphQL service that
# includes a query field.
@graphql:ServiceConfig {maxQueryDepth: 334, auth: []}
service /graphql2 on new graphql:Listener(9091) {

# Returns a greeting message that includes provided name.
# + name - Name to be included in the message
# + return - Greeting message with the name
@graphql:ResourceConfig {complexity: 5}
resource function get hello(string name) returns string {
return string `Hello ${name}`;
}
}
Loading