(fix) O3-4562: Fix extension configuration schema machinery #1502
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.
Requirements
This PR has a title that briefly describes the work done including the ticket number. Ensure your PR title includes a conventional commit label (such as
feat,fix, orchore, among others). See existing PR titles for inspiration.If applicable
My work includes tests or is validated by existing tests.
I have updated the esm-framework mock to reflect any API changes I have made.
Summary
This PR fixes the extension configuration schema machinery so that extensions can properly define and use their own configuration schemas independent of module schemas.
Problems Solved:
defineExtensionConfigSchema()wasn't properly registering extension schemas (missingmoduleLoadedflag)useConfighook was always merging module config with extension config, even when extension had its own schemaChanges:
extensionHasOwnConfigSchema()function to check if an extension has its own config schemadefineExtensionConfigSchema()to set themoduleLoadedflaguseConfighook to use extension-specific schemas exclusively when they existmock.ts,mock-jest.ts) for testing compatibilityBehavior:
When an extension defines its own config schema using
defineExtensionConfigSchema(), theuseConfighook now returns only the extension's config (not merged with module config). When no extension schema exists, it falls back to merging module + extension configs.Related Issue
https://openmrs.atlassian.net/browse/O3-4562
Other
All 95 existing tests pass. Extension config tests verify the correct exclusive schema usage. No breaking changes to existing functionality.