Skip to content

Comments

Gracefully handle non indexed services and support deleting service functions#423

Merged
NipunaRanasinghe merged 15 commits intoballerina-platform:1.3.xfrom
LakshanWeerasinghe:gracefully-handle
Oct 24, 2025
Merged

Gracefully handle non indexed services and support deleting service functions#423
NipunaRanasinghe merged 15 commits intoballerina-platform:1.3.xfrom
LakshanWeerasinghe:gracefully-handle

Conversation

@LakshanWeerasinghe
Copy link
Contributor

Purpose

$subject

This PR enables graceful handling of non-indexed service types, improving the user experience when working with services that haven't been indexed yet.

  • Non-indexed service type support: Users can now access and interact with service types that are not indexed, including:
    • Service designer view
    • Service configuration forms
    • Listener configuration forms
Screen.Recording.2025-10-24.at.14.52.47.mov

Additional Enhancements

  • Service type function deletion: Added support for deleting service type functions that are marked as optional-only

@LakshanWeerasinghe LakshanWeerasinghe changed the title Gracefully handle non indexed service and support deleting service functions Gracefully handle non indexed services and support deleting service functions Oct 24, 2025
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 adds graceful handling for non-indexed service types and introduces support for deleting optional service functions. The changes enable users to work with services that haven't been indexed yet, providing access to service designer views and configuration forms. Additionally, service type functions can now be marked as optional and deleted when appropriate.

Key changes:

  • Added optional field to service type functions to distinguish between required and optional functions
  • Implemented fallback service model creation when service types are not found in the database
  • Updated database schema and queries to support the optional function field

Reviewed Changes

Copilot reviewed 136 out of 137 changed files in this pull request and generated no comments.

Show a summary per file
File Description
service_artifacts.json Added optional field to service type function definitions
service-index.sql Added optional column to ServiceTypeFunction table schema
ServiceIndexGenerator.java Updated function creation to include optional parameter
DatabaseManager.java Modified SQL queries to handle optional field in database operations
ServiceModelUtils.java Added fallback service model creation and refactored function generation logic
ListenerUtil.java Refactored listener model creation and improved method organization
ServiceMetadata.java Changed to use ModuleID instead of separate org/package/module fields
Utils.java Fixed annotation value handling to return null for empty annotations
Multiple test config files Updated version references for http/jsondata packages and test expectations
Comments suppressed due to low confidence (4)

service-model-generator/modules/service-model-index-generator/src/main/resources/service-index.sql:1

  • The CHECK constraint references the wrong column name. It should check optional IN (0, 1) instead of enable IN (0, 1).
    service-model-generator/modules/service-model-generator-ls-extension/src/main/java/io/ballerina/servicemodelgenerator/extension/util/Utils.java:1
  • Duplicate conditional check for annotationNode.annotValue().isEmpty(). The second check at line 659 is unreachable because if the condition is true, the method already returns at line 656.
    model-generator-commons/src/main/java/io/ballerina/modelgenerator/commons/FunctionDataBuilder.java:1
  • Catching Throwable is too broad and may catch errors that shouldn't be suppressed (like OutOfMemoryError or StackOverflowError). Consider catching Exception instead, or a more specific exception type like IOException or JsonSyntaxException.
    model-generator-commons/src/main/java/io/ballerina/modelgenerator/commons/FunctionDataBuilder.java:1
  • Catching Throwable is too broad and may catch errors that shouldn't be suppressed (like OutOfMemoryError or StackOverflowError). Consider catching Exception instead, or a more specific exception type.

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

Copy link
Contributor

@NipunaRanasinghe NipunaRanasinghe left a comment

Choose a reason for hiding this comment

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

LGTM

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

2 participants