-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
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)
- Update parser to handle chosen transition approach (see Deprecate single-brace message template syntax in favor of mustache-style double-braces metaschema#162 for options)
- Implement deprecation detection for legacy
{ expr }syntax - Add support for new
{{ expr }}syntax
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.xmlThis enables CI pipelines to enforce migration.
Dependencies
- Requires decision on transition approach in Deprecate single-brace message template syntax in favor of mustache-style double-braces metaschema#162
- Parser changes depend on which option is selected (file-level marker, hard cutover, etc.)
Acceptance Criteria
- Parser updated per chosen transition approach
- Deprecation warnings emitted (one per file)
-
migrate-templatesCLI command implemented -
--dry-runand--reportmodes working -
--strict-templatesvalidation flag implemented - Unit tests for parser with both syntaxes
- Integration tests for CLI migration command
- Documentation updated
Related
- Deprecate single-brace message template syntax in favor of mustache-style double-braces metaschema#162 - Specification and transition approach decision
- fix: correct message template syntax in module constraints metaschema#161 - Fix message template syntax in module constraints
coderabbitai
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
To Triage