Skip to content

Remove deprecated conditionalFiles supportย #2000

@Satya900

Description

@Satya900

๐Ÿ“„ 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 validateConditionalFiles function
  • 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 conditionalFilesMatched message

apps/generator/test/templateConfigValidator.test.js

  • Remove unit tests specifically validating conditionalFiles

โš ๏ธ Impact

  • Breaking Change: Yes
    Templates relying solely on conditionalFiles (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 โ€” conditionalGeneration fully replaces conditionalFiles.
  • Templates relying on conditionalFiles will 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions