Update service design meta info#422
Update service design meta info#422NipunaRanasinghe merged 22 commits intoballerina-platform:1.3.xfrom
Conversation
791d708 to
1eb564a
Compare
1eb564a to
4438eab
Compare
|
@RadCod3 Can you review this |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
The import java.nio.file.Files is unused and should be removed to keep the imports clean.
| import java.nio.file.Files; |
| import java.nio.charset.StandardCharsets; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.nio.file.Paths; |
There was a problem hiding this comment.
The import java.nio.file.Paths is unused and should be removed to keep the imports clean.
| import java.nio.file.Paths; |
| Map<String, List<String>> result = new HashMap<>(); | ||
|
|
||
| // Handle ASB-specific nested parameter extraction | ||
| if (("queueName".equals(metadataItem.metadataKey())|| "topicName".equals(metadataItem.metadataKey()))) { |
There was a problem hiding this comment.
Missing space after || operator. Should be || for consistency with standard Java formatting conventions.
| if (("queueName".equals(metadataItem.metadataKey())|| "topicName".equals(metadataItem.metadataKey()))) { | |
| if (("queueName".equals(metadataItem.metadataKey()) || "topicName".equals(metadataItem.metadataKey()))) { |
| import io.ballerina.servicemodelgenerator.extension.model.Value; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.HashMap; |
There was a problem hiding this comment.
[nitpick] The import statement for HashMap should be placed after the existing import for ArrayList to maintain alphabetical ordering of imports.
| rs.getString("kind") | ||
| )); | ||
| } | ||
| conn.close(); |
There was a problem hiding this comment.
The connection is already being closed by the try-with-resources statement. This explicit conn.close() call is redundant and should be removed.
|
LGTM |
model-generator-commons/src/main/java/io/ballerina/modelgenerator/commons/ReadOnlyMetaData.java
Outdated
Show resolved
Hide resolved
| builder.append(String.join(TWO_NEW_LINES, functions)).append(NEW_LINE).append(CLOSE_BRACE); | ||
| } | ||
|
|
||
| public static void extractServicePathInfo(ServiceDeclarationNode serviceNode, Service serviceModel) { |
| return List.of(); | ||
| } | ||
|
|
||
| } No newline at end of file |
There was a problem hiding this comment.
| } | |
| } | |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
| * @since 1.0.0 | |
| * @since 1.3.0 |
...ava/io/ballerina/servicemodelgenerator/extension/builder/service/AbstractServiceBuilder.java
Outdated
Show resolved
Hide resolved
| * Extractor for ANNOTATION kind readOnly metadata. | ||
| * Extracts parameter values from service annotations. | ||
| * | ||
| * @since 1.0.0 |
There was a problem hiding this comment.
| * @since 1.0.0 | |
| * @since 1.3.0 |
...rc/main/java/io/ballerina/servicemodelgenerator/extension/extractor/AnnotationExtractor.java
Outdated
Show resolved
Hide resolved
| * 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 |
There was a problem hiding this comment.
| * @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 |
There was a problem hiding this comment.
| } | |
| } | |
Purpose
wso2/product-ballerina-integrator#1447
Goals
Approach
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning