Skip to content

Refactor configuration with v2 and add backward compatibility#93

Open
mm-kgi wants to merge 31 commits intodevelopfrom
feature/601-refactor-configuration-with-v2
Open

Refactor configuration with v2 and add backward compatibility#93
mm-kgi wants to merge 31 commits intodevelopfrom
feature/601-refactor-configuration-with-v2

Conversation

@mm-kgi
Copy link
Copy Markdown
Contributor

@mm-kgi mm-kgi commented Apr 7, 2026

Overview

This PR refactors the DataEngine configuration by introducing a structured V2 schema organized into:

  • General
  • Plugins
  • TemplateManagement
  • RegistrySettings

To maintain backward compatibility, it includes adapters that map legacy V1 configuration to the new V2 format.


Key Changes

  • Introduced V2 configuration POCOs with a grouped and scalable structure
  • Added V1 → V2 adapters with compatibility detection
  • Implemented dynamic base URL resolution derived from the current HTTP request
  • Updated examples, appsettings, and module tests to support both V1 and V2 configurations

Notes

  • Existing V1 configurations will continue to work via the adapter layer
  • New development should use the V2 configuration structure

Copilot AI review requested due to automatic review settings April 7, 2026 21:17
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Copy Markdown

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 refactors DataEngine configuration into a new “V2” grouped schema (General/Plugins/TemplateManagement/RegistrySettings) while introducing legacy V1→V2 adapters to preserve backward compatibility. It updates service wiring and tests/examples to use the new configuration layout and derived base-URL behavior.

Changes:

  • Introduce V2 configuration POCOs and V1→V2 adapters/compat detection.
  • Update DI + providers/health checks to consume V2 config and derive the DataEngine base URL from the current HTTP request.
  • Update examples, appsettings, and module tests to exercise both V1 and V2 config shapes.

Reviewed changes

Copilot reviewed 98 out of 99 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
source/AAS.TwinEngine.Plugin.TestPlugin/Example/nginx/default.conf.template Fix upstream host name typo for submodel registry proxying.
source/AAS.TwinEngine.Plugin.TestPlugin/Example/docker-compose.yml Update example environment variables to V2 config keys and service name fixes.
source/AAS.TwinEngine.Plugin.TestPlugin/Example/basyx/aas-env.properties Fix submodel registry host typo.
source/AAS.TwinEngine.Plugin.TestPlugin/Api/Manifest/ManifestController.cs Minor formatting change.
source/AAS.TwinEngine.Plugin.TestPlugin.PlaywrightTests/ApiTestBase.cs Import ordering/formatting cleanup.
source/AAS.TwinEngine.DataEngine/ServiceConfiguration/LoggingConfigurationExtension.cs Switch OpenTelemetry settings lookup to V2 General:OpenTelemetry section.
source/AAS.TwinEngine.DataEngine/ServiceConfiguration/InfrastructureDependencyInjectionExtensions.cs Register V2 config + legacy adapters; rewire HttpClient registrations for V2.
source/AAS.TwinEngine.DataEngine/ServiceConfiguration/Config/TemplateManagementConfig.cs Add V2 TemplateManagement config model (endpoints, mapping rules, semantics, resilience).
source/AAS.TwinEngine.DataEngine/ServiceConfiguration/Config/RegistrySettingsConfig.cs Add V2 RegistrySettings model (precomputed schedule/enabled).
source/AAS.TwinEngine.DataEngine/ServiceConfiguration/Config/PluginsConfig.cs Add V2 Plugins model (instances, MLP config, resilience).
source/AAS.TwinEngine.DataEngine/ServiceConfiguration/Config/GeneralConfig.cs Add V2 General config model (api config, sanitization, OTEL, customer URL, etc.).
source/AAS.TwinEngine.DataEngine/ServiceConfiguration/ApplicationDependencyInjectionExtensions.cs Source ApiConfiguration from V2 GeneralConfig.
source/AAS.TwinEngine.DataEngine/Infrastructure/Shared/HttpRequestBaseUrlProvider.cs Add base-url provider derived from HTTP request (with V1 fallback).
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/TemplateProvider/Services/TemplateProvider.cs Remove dependency on configurable paths; use fixed path constants.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/TemplateProvider/Services/SubmodelTemplateMappingProvider.cs Read mapping rules from V2 TemplateManagementConfig.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/TemplateProvider/Services/ShellTemplateMappingProvider.cs Read mapping + extraction rules from V2 TemplateManagementConfig.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/SubmodelRegistryProvider/Services/SubmodelDescriptorProvider.cs Remove dependency on options; use fixed path constants.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/PluginDataProvider/Services/PluginManifestProvider.cs Switch from V1 PluginConfig to V2 PluginsConfig instances.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/PluginDataProvider/Services/PluginManifestConflictHandler.cs Constructor parameter reorder for options/logger.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/PluginDataProvider/Services/PluginDataHandler.cs Use IBaseUrlProvider for href generation instead of configured base URL.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/PluginDataProvider/Services/MultiPluginDataHandler.cs Switch semantics context prefix source to V2 PluginsConfig.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/PluginDataProvider/Helper/RegisterPluginHttpClients.cs Use RetryConfig directly instead of retry policy section keys.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/PluginDataProvider/Helper/JsonSchemaValidator.cs Switch semantics context prefix source to V2 PluginsConfig.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/AasRegistryProvider/Services/ShellDescriptorSyncHosted.cs Use V2 RegistrySettingsConfig for schedule/enabled.
source/AAS.TwinEngine.DataEngine/Infrastructure/Providers/AasRegistryProvider/Services/AasRegistryProvider.cs Remove dependency on configurable paths; use fixed path constants.
source/AAS.TwinEngine.DataEngine/Infrastructure/Monitoring/TemplateRepositoryHealthCheck.cs Remove dependency on options; use fixed path constants.
source/AAS.TwinEngine.DataEngine/Infrastructure/Monitoring/TemplateRegistryHealthCheck.cs Remove dependency on options; use fixed path constants.
source/AAS.TwinEngine.DataEngine/Infrastructure/Monitoring/PluginAvailabilityHealthCheck.cs Switch from V1 PluginConfig to V2 PluginsConfig instances.
source/AAS.TwinEngine.DataEngine/Infrastructure/Http/Policies/ResilienceHandlerExtensions.cs Accept RetryConfig directly; remove IOptionsMonitor-based lookup.
source/AAS.TwinEngine.DataEngine/Infrastructure/Http/Extensions/HttpClientRegistrationExtensions.cs Update AddHttpClientWithResilience signature to accept RetryConfig.
source/AAS.TwinEngine.DataEngine/Infrastructure/Http/Authorization/Headers/RequestHeaderMapper.cs Read mappings/sanitization from V2 config models.
source/AAS.TwinEngine.DataEngine/Infrastructure/Http/Authorization/Config/HeaderForwardingOptions.cs Adjust header forwarding model collection property mutability.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/LegacyV1ConfigurationExtensions.cs Add registration extension for V1→V2 adapter implementations.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/LegacyTemplateManagementConfigAdapter.cs Map V1 TemplateMappingRules/headers/retry into V2 TemplateManagement shape.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/LegacyRegistrySettingsConfigAdapter.cs Map V1 precomputed registry settings into V2; handle typo section.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/LegacyPluginsConfigAdapter.cs Map V1 plugins/MLP/semantics/retry into V2 PluginsConfig.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/LegacyGeneralConfigAdapter.cs Map V1 general concerns into V2 GeneralConfig.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/LegacyConfigurationDetector.cs Add schema detection (V1 vs V2) and typo-detection helper.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/ConfigV1/Semantics.cs Move/rename legacy V1 semantics type into LegacyV1 namespace.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/ConfigV1/MultiLanguagePropertySettingsValidator.cs Move legacy V1 validator into LegacyV1 namespace.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/ConfigV1/MultiLanguagePropertySettings.cs Move legacy V1 MLP settings type into LegacyV1 namespace.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/ConfigV1/HttpRetryPolicyOptions.cs Move legacy V1 retry policy options into LegacyV1 namespace.
source/AAS.TwinEngine.DataEngine/Infrastructure/Configuration/LegacyV1/ConfigV1/AasRegistryPreComputed.cs Move legacy V1 precomputed registry config into LegacyV1 namespace.
source/AAS.TwinEngine.DataEngine/appsettings.json Replace V1 flat config with V2 grouped config (and examples).
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/SerializationService.cs Remove configurable export options; use constants.
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/SemanticId/Helpers/SubmodelElementHelper.cs Source default languages from V2 PluginsConfig.
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/SemanticId/Helpers/SemanticIdResolver.cs Split semantics sources: V2 PluginsConfig + TemplateManagementConfig.
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/Config/Helper/PluginsConfigValidator.cs Add validator for V2 PluginsConfig (language tags).
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRepository/Config/AasxExportOptions.cs Convert export options to static constants (no config binding).
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/SubmodelRegistry/SubmodelDescriptorService.cs Use IBaseUrlProvider for href generation and fixed paths.
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/Shared/IBaseUrlProvider.cs Introduce base URL provider abstraction.
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/Plugin/Config/AasEnvironmentConfig.cs Make API path segments constants (no longer configurable), retain V1 URIs for adapter.
source/AAS.TwinEngine.DataEngine/ApplicationLogic/Services/AasRepository/AasRepositoryTemplateService.cs Switch customer domain URL source to V2 GeneralConfig.
source/AAS.TwinEngine.DataEngine.UnitTests/ServiceConfiguration/ConfigurationMigration/LegacyTemplateManagementConfigAdapterTests.cs Add unit tests for V1→V2 TemplateManagement adapter behavior.
source/AAS.TwinEngine.DataEngine.UnitTests/ServiceConfiguration/ConfigurationMigration/LegacyRegistrySettingsConfigAdapterTests.cs Add unit tests for V1→V2 RegistrySettings adapter + typo handling.
source/AAS.TwinEngine.DataEngine.UnitTests/ServiceConfiguration/ConfigurationMigration/LegacyPluginsConfigAdapterTests.cs Add unit tests for V1→V2 Plugins adapter behavior.
source/AAS.TwinEngine.DataEngine.UnitTests/ServiceConfiguration/ConfigurationMigration/LegacyGeneralConfigAdapterTests.cs Add unit tests for V1→V2 General adapter behavior.
source/AAS.TwinEngine.DataEngine.UnitTests/ServiceConfiguration/ConfigurationMigration/LegacyConfigurationDetectorTests.cs Add unit tests for schema/typo detection.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/TemplateProvider/Services/TemplateProviderTests.cs Update tests for TemplateProvider constructor/signature changes.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/TemplateProvider/Services/SubmodelTemplateMappingProviderTests.cs Update tests to bind mapping rules from TemplateManagementConfig.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/TemplateProvider/Services/ShellTemplateMappingProviderTests.cs Update tests to bind mapping+extraction rules from TemplateManagementConfig.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/SubmodelRegistryProvider/Services/SubmodelDescriptorProviderTests.cs Update tests for provider signature/path-constant changes.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/PluginDataProvider/Services/PluginManifestProviderTests.cs Update tests for V2 PluginsConfig usage.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/PluginDataProvider/Services/PluginManifestConflictHandlerTests.cs Adjust tests for constructor changes + add more scenarios.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/PluginDataProvider/Services/PluginDataHandlerTests.cs Update tests to use IBaseUrlProvider.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/PluginDataProvider/Services/MultiPluginDataHandlerTests.cs Update tests to use V2 PluginsConfig.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/PluginDataProvider/Helper/JsonSchemaValidatorTests.cs Update tests to use V2 PluginsConfig.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/AasRegistryProvider/ShellDescriptorSyncHostedTests.cs Update tests for V2 RegistrySettingsConfig usage.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Providers/AasRegistryProvider/AasRegistryProviderTests.cs Update tests for provider signature/path-constant changes.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Monitoring/TemplateRepositoryHealthCheckTests.cs Update tests for health check signature/path-constant changes.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Monitoring/TemplateRegistryHealthCheckTests.cs Update tests for health check signature/path-constant changes.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Monitoring/PluginAvailabilityHealthCheckTests.cs Update tests to use V2 PluginsConfig.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Http/Policies/ResilienceHandlerExtensionsTests.cs Update tests for RetryConfig-based resilience handler configuration.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Http/Extensions/HttpClientRegistrationExtensionsTests.cs Update tests for RetryConfig-based HttpClient registration.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Http/Authorization/Headers/RequestHeaderMapperTests.cs Update tests for new V2 config-based mapper construction.
source/AAS.TwinEngine.DataEngine.UnitTests/Infrastructure/Http/Authorization/HeaderForwardingHandlerTests.cs Update tests to build mapper via V2 config models.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/SerializationServiceTests.cs Update tests for removal of configurable export options.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/SemanticIdHandlerTests.cs Update tests for semantics/MLP moving into V2 config.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/SemanticId/Helpers/SubmodelElementHelperTests.cs Update tests for V2 PluginsConfig-based default languages.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/SemanticId/Helpers/SemanticIdResolverTests.cs Update tests for split V2 semantics sources.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/SemanticId/Helpers/ReferenceHelperTests.cs Update tests for new resolver constructor signature.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRepository/Config/Helper/MultiLanguagePropertySettingsValidatorTests.cs Point tests to legacy V1 validator namespace.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/SubmodelRegistry/SubmodelDescriptorServiceTests.cs Update tests to use IBaseUrlProvider and new constructor.
source/AAS.TwinEngine.DataEngine.UnitTests/ApplicationLogic/Services/AasRepository/AasRepositoryTemplateServiceTests.cs Update tests to use V2 GeneralConfig for customer URL.
source/AAS.TwinEngine.DataEngine.ModuleTests/TestData/v2-config/appsettings.json Add V2 config fixture for module/integration tests.
source/AAS.TwinEngine.DataEngine.ModuleTests/TestData/v1-config/appsettings.json Add V1 config fixture for module/integration tests.
source/AAS.TwinEngine.DataEngine.ModuleTests/Common/ConfigTestFactory.cs Add WebApplicationFactory wrapper to boot with selected config fixture dir.
source/AAS.TwinEngine.DataEngine.ModuleTests/Api/Services/SubmodelRepository/SubmodelRepositoryControllerTests.cs Split module tests to run with both V1 and V2 config fixtures.
source/AAS.TwinEngine.DataEngine.ModuleTests/Api/Services/SubmodelRepository/SerializationControllerTests.cs Split module tests to run with both V1 and V2 config fixtures.
source/AAS.TwinEngine.DataEngine.ModuleTests/Api/Services/SubmodelRegistry/SubmodelDescriptorControllerTests.cs Split module tests to run with both V1 and V2 config fixtures.
source/AAS.TwinEngine.DataEngine.ModuleTests/Api/Services/AasRepository/AasRepositoryControllerTests.cs Split module tests to run with both V1 and V2 config fixtures.
source/AAS.TwinEngine.DataEngine.ModuleTests/Api/Services/AasRegistry/TestData.cs Update expected href host to align with base-url changes.
source/AAS.TwinEngine.DataEngine.ModuleTests/Api/Services/AasRegistry/ShellDescriptorControllerTests.cs Split module tests to run with both V1 and V2 config fixtures.
source/AAS.TwinEngine.DataEngine.ModuleTests/AAS.TwinEngine.DataEngine.ModuleTests.csproj Copy V1/V2 appsettings fixtures to test output.
example/docker-compose.yml Update public example compose to V2 env vars and corrected service naming.

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Test & Coverage Report

Test Results Summary

Metric Count
✅ Passed 1238
❌ Failed 0
⏭️ Skipped 0

View Detailed Test Results


Code Coverage

Unit Tests Coverage

Package Line Rate Branch Rate Complexity Health
AAS.TwinEngine.DataEngine 91% 82% 1614
Summary 91% (2686 / 2963) 82% (1115 / 1355) 1614

Minimum allowed line rate is 80%

Module Tests Coverage

Package Line Rate Branch Rate Complexity Health
AAS.TwinEngine.DataEngine 58% 44% 1614
Summary 58% (1733 / 2963) 44% (593 / 1355) 1614

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
8 New issues

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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