Skip to content

Comments

Update service design meta info#422

Merged
NipunaRanasinghe merged 22 commits intoballerina-platform:1.3.xfrom
samithkavishke:metadata
Oct 27, 2025
Merged

Update service design meta info#422
NipunaRanasinghe merged 22 commits intoballerina-platform:1.3.xfrom
samithkavishke:metadata

Conversation

@samithkavishke
Copy link
Contributor

@samithkavishke samithkavishke commented Oct 24, 2025

Purpose

wso2/product-ballerina-integrator#1447

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

@samithkavishke samithkavishke marked this pull request as ready for review October 27, 2025 04:57
@samithkavishke samithkavishke changed the base branch from main to 1.3.x October 27, 2025 06:18
@samithkavishke
Copy link
Contributor Author

@RadCod3 Can you review this

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a new read-only metadata system for service design, enabling services to display configuration information extracted from various sources (annotations, listener parameters, service descriptions).

  • Adds database schema and JSON configuration for read-only metadata definitions
  • Implements an extractor architecture for retrieving metadata from different sources
  • Integrates metadata extraction into service builders and updates test fixtures
  • Updates HTTP version references in test files from 2.14.6 to 2.14.7

Reviewed Changes

Copilot reviewed 37 out of 38 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
service_artifacts.json Defines read-only metadata configuration for multiple service types
service-index.sql Creates database table for storing metadata definitions
ServiceIndexGenerator.java Adds metadata insertion logic during index generation
DatabaseManager.java Implements database insertion method for metadata
ReadOnlyMetaData.java Defines record structure for metadata items
ServiceDatabaseManager.java Implements query method for retrieving metadata
*Extractor.java files Implements extraction strategy pattern for different metadata sources
AbstractServiceBuilder.java Integrates metadata extraction into service building
Various test JSON files Updates expected test outputs with metadata and version changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

The import java.nio.file.Files is unused and should be removed to keep the imports clean.

Suggested change
import java.nio.file.Files;

Copilot uses AI. Check for mistakes.
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

The import java.nio.file.Paths is unused and should be removed to keep the imports clean.

Suggested change
import java.nio.file.Paths;

Copilot uses AI. Check for mistakes.
Map<String, List<String>> result = new HashMap<>();

// Handle ASB-specific nested parameter extraction
if (("queueName".equals(metadataItem.metadataKey())|| "topicName".equals(metadataItem.metadataKey()))) {
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

Missing space after || operator. Should be || for consistency with standard Java formatting conventions.

Suggested change
if (("queueName".equals(metadataItem.metadataKey())|| "topicName".equals(metadataItem.metadataKey()))) {
if (("queueName".equals(metadataItem.metadataKey()) || "topicName".equals(metadataItem.metadataKey()))) {

Copilot uses AI. Check for mistakes.
import io.ballerina.servicemodelgenerator.extension.model.Value;

import java.util.ArrayList;
import java.util.HashMap;
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

[nitpick] The import statement for HashMap should be placed after the existing import for ArrayList to maintain alphabetical ordering of imports.

Copilot uses AI. Check for mistakes.
rs.getString("kind")
));
}
conn.close();
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

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

The connection is already being closed by the try-with-resources statement. This explicit conn.close() call is redundant and should be removed.

Copilot uses AI. Check for mistakes.
@RadCod3
Copy link
Contributor

RadCod3 commented Oct 27, 2025

LGTM

builder.append(String.join(TWO_NEW_LINES, functions)).append(NEW_LINE).append(CLOSE_BRACE);
}

public static void extractServicePathInfo(ServiceDeclarationNode serviceNode, Service serviceModel) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the method in the this util.

return List.of();
}

} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
}

Copy link
Contributor

@pasindufernando1 pasindufernando1 left a comment

Choose a reason for hiding this comment

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

Shall we update the @SInCE 1.0.0 to @1.3.0 in newly created files? Also its better to add the empty line at EOF in these files

* @param displayName The display name for the metadata field
* @param kind The kind/category of the metadata field (e.g., ANNOTATION, SERVICE_DESCRIPTION, LISTENER_PARAM)
*
* @since 1.0.0
Copy link
Contributor

@pasindufernando1 pasindufernando1 Oct 27, 2025

Choose a reason for hiding this comment

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

Suggested change
* @since 1.0.0
* @since 1.3.0

* Extractor for ANNOTATION kind readOnly metadata.
* Extracts parameter values from service annotations.
*
* @since 1.0.0
Copy link
Contributor

@pasindufernando1 pasindufernando1 Oct 27, 2025

Choose a reason for hiding this comment

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

Suggested change
* @since 1.0.0
* @since 1.3.0

* Interface for concrete service builders to implement custom readOnly metadata extraction.
* This allows each service builder to define its own extraction logic for CUSTOM kind metadata.
*
* @since 1.0.0
Copy link
Contributor

@pasindufernando1 pasindufernando1 Oct 27, 2025

Choose a reason for hiding this comment

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

Suggested change
* @since 1.0.0
* @since 1.3.0

default boolean canExtractCustom(ReadOnlyMetaData metadataItem, ModelFromSourceContext context) {
return "CUSTOM".equals(metadataItem.kind());
}
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
}

@NipunaRanasinghe NipunaRanasinghe merged commit b4152dc into ballerina-platform:1.3.x Oct 27, 2025
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

Development

Successfully merging this pull request may close these issues.

5 participants