-
-
Notifications
You must be signed in to change notification settings - Fork 380
Description
๐ Description
The conditionalFiles feature in the generator has been deprecated in favor of conditionalGeneration and is marked for removal.
There are several TODO references in the codebase pointing to this deprecation (for example:
TODO: https://github.com/asyncapi/generator/issues/1553).
This task involves removing all legacy code associated with conditionalFiles to clean up the codebase, reduce maintenance overhead, and fully transition to the newer conditionalGeneration implementation.
๐ฏ Goal
Remove all logic, validation, and tests related to conditionalFiles.
๐ Affected Files
apps/generator/lib/templates/config/validator.js
- Remove
validateConditionalFilesfunction - Remove its usage in
validateTemplateConfig
apps/generator/lib/conditionalGeneration.js
- Remove
conditionalFilesGenerationDeprecatedVersion - Remove logic checking
templateConfig.conditionalFiles - Remove logging related to
conditionalFilesMatched
apps/generator/lib/logMessages.js
- Remove
conditionalFilesMatchedmessage
apps/generator/test/templateConfigValidator.test.js
- Remove unit tests specifically validating
conditionalFiles
โ ๏ธ Impact
-
Breaking Change: Yes
Templates relying solely onconditionalFiles(expected to be rare or non-existent) will no longer function as before. -
Performance:
Slight improvement due to removal of deprecated checks. -
Codebase Cleanup:
Reduces technical debt and simplifies generator logic.
๐งช Verification
Run unit tests to ensure no regressions:
npm run generator:test:unit๐ Migration Strategy
Since conditionalFiles has been deprecated, template maintainers currently using it must migrate to conditionalGeneration.
The migration is straightforward and only requires updating template configuration โ no logic changes are needed.
๐ ๏ธ Example Migration
If a templateโs package.json (or template config) currently contains:
{
"conditionalFiles": {
"my/path/to/file.js": {
"subject": "server.protocol",
"validation": { "const": "kafka" }
}
}
}It should be updated to:
{
"conditionalGeneration": {
"my/path/to/file.js": {
"subject": "server.protocol",
"validation": { "const": "kafka" }
}
}
}๐ Notes
- This change is purely a configuration update.
- No behavioral differences are introduced โ
conditionalGenerationfully replacesconditionalFiles. - Templates relying on
conditionalFileswill stop working once the deprecated support is removed.
๐ฐ Release Notes Requirement
This migration example should be included in the release notes of the version where conditionalFiles support is officially removed, so template authors can upgrade smoothly.