[ballerina-health-tool] Modify template gen to use a single port, single OAS def in aggregate mode#120
Merged
isuruh15 merged 8 commits intoballerina-platform:mainfrom Aug 15, 2025
Conversation
isuruh15
reviewed
Aug 6, 2025
...ain/java/org/wso2/healthcare/fhir/codegen/ballerina/project/tool/generator/OasGenerator.java
Outdated
Show resolved
Hide resolved
isuruh15
reviewed
Aug 6, 2025
...ain/java/org/wso2/healthcare/fhir/codegen/ballerina/project/tool/generator/OasGenerator.java
Outdated
Show resolved
Hide resolved
isuruh15
previously approved these changes
Aug 7, 2025
2e37b0e to
6d5fba9
Compare
87c34dd to
a8be8f2
Compare
isuruh15
reviewed
Aug 15, 2025
| if (DEFAULT_DATA_TYPES.contains(datatypeDefn.getDefinition().getName()) | ||
| || "Extension".equals(datatypeDefn.getDefinition().getType())) { | ||
| continue; | ||
| } else if (datatypeDefn.getDefinition().getStatus().toString().equalsIgnoreCase("draft") && |
Contributor
There was a problem hiding this comment.
Shall we swap the values as "draft".equalsIgnoreCase(datatypeDefn.getDefinition().getStatus().toString())
6e8f6cd to
71d95ac
Compare
isuruh15
approved these changes
Aug 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Related to: Bal FHIR tool should be able to generate FHIR server skeleton
Goals
Approach
When a profile is passed to the Ballerina Health Tool, it first sends all the StructureDefinition resources to the codegen-tool-framework. This framework processes them and extracts the necessary context, including OpenAPI Specification (OAS) definitions.
OAS definitions are generated for all resources in the profile, regardless of whether the mode is aggregated or not.
In aggregated mode, the tool combines the definitions of all related resources into a single APIDefinition model. It then breaks this model down into key parts such as:
Once all required resources are gathered and processed, a new APIDefinition is created for the aggregation. Finally, this complete definition is written to a YAML file.
User stories
Aggregated resources now have a single OAS-Definition File and all the services now work on a single port.
Release note
In template generation mode for aggregated resources it now have a single OAS-Definition File and all the services now work on a single port.
Automation tests
Tested with multiple packages for both FHIR versions R4 and R5 to see whether the generated templates are correct.
Tested with Devant for USCore501 for aggregated mode and USCore501 Patient for microservices deployment.
Security checks
Related PRs
Add FHIR API template aggregation support for monolithic deployments
Test environment
JDK: 21
Ballerina: 2201.12.3
OS: Windows 11 Pro
Learning
Ballerina HTTP Request Interceptor