Summary
Implement the deprecation of single-brace { expr } message template syntax in favor of mustache-style {{ expr }} syntax, as specified in metaschema-framework/metaschema#162.
Implementation Areas
1. Message Template Parser
Location: core/src/main/java/gov/nist/secauto/metaschema/core/model/constraint/impl/ (or similar)
2. Deprecation Warning System
- Track warned files to emit ONE warning per file (avoid log spam)
- Warning format:
WARNING: File '{}' uses deprecated single-brace template syntax. Use '{{ expr }}' instead of '{ expr }'.
- Consider adding source location (line/column) for the first occurrence
// Example implementation
private static final Set<URI> warnedFiles = ConcurrentHashMap.newKeySet();
private void warnDeprecatedSyntax(URI sourceFile) {
if (warnedFiles.add(sourceFile)) {
LOGGER.warn("File '{}' uses deprecated single-brace template syntax. "
+ "Use '{{ expr }}' instead of '{ expr }'.", sourceFile);
}
}
3. CLI Migration Command
Location: metaschema-cli
Add a new command to migrate constraint files:
# Dry-run showing what would change
metaschema-cli migrate-templates --dry-run constraints.xml
# Apply changes in place
metaschema-cli migrate-templates constraints.xml
# Output to different file
metaschema-cli migrate-templates constraints.xml -o constraints-v2.xml
# Report mode - list files using deprecated syntax
metaschema-cli migrate-templates --report src/
4. Validation Mode
Add CLI flag or configuration option to treat deprecated syntax as an error:
metaschema-cli validate --strict-templates module.xml
This enables CI pipelines to enforce migration.
Dependencies
Acceptance Criteria
Related
Summary
Implement the deprecation of single-brace
{ expr }message template syntax in favor of mustache-style{{ expr }}syntax, as specified in metaschema-framework/metaschema#162.Implementation Areas
1. Message Template Parser
Location:
core/src/main/java/gov/nist/secauto/metaschema/core/model/constraint/impl/(or similar){ expr }syntax{{ expr }}syntax2. Deprecation Warning System
WARNING: File '{}' uses deprecated single-brace template syntax. Use '{{ expr }}' instead of '{ expr }'.3. CLI Migration Command
Location:
metaschema-cliAdd a new command to migrate constraint files:
4. Validation Mode
Add CLI flag or configuration option to treat deprecated syntax as an error:
This enables CI pipelines to enforce migration.
Dependencies
Acceptance Criteria
migrate-templatesCLI command implemented--dry-runand--reportmodes working--strict-templatesvalidation flag implementedRelated