| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Checks TX Text Control templates for dependencies that are missing from the runtime environment or from the template contract.
Merge blocks are detected from SubTextPart names that use the TX Text Control merge block prefix txmb_.
using TXTextControl.DocumentServer.Validation;
var checker = new TemplateDependencyChecker();
TemplateDependencyInfo info = checker.Check(
"test.tx",
TXTextControl.StreamType.InternalUnicodeFormat);using TXTextControl.DocumentServer.Validation;
const string jsonData = """
{
"customer": {
"name": "Text Control",
"firstName": "Text"
},
"lineItems": []
}
""";
var checker = new TemplateDependencyChecker();
TemplateDependencyInfo info = checker.Check(
"test.tx",
TXTextControl.StreamType.InternalUnicodeFormat,
jsonData);foreach (MissingFontDependency font in info.MissingFonts)
{
Console.WriteLine($"Missing font: {font.FontName}");
}
foreach (MissingImageDependency image in info.MissingImages)
{
Console.WriteLine($"Missing image: {image.FileName}");
}
if (info.DataDependencies is { } data)
{
foreach (MissingDocumentFieldDependency field in data.MissingDocumentFields)
{
Console.WriteLine($"Merge field missing in document: {field.Name}");
}
foreach (MissingDocumentMergeBlockDependency block in data.MissingDocumentMergeBlocks)
{
Console.WriteLine($"Merge block missing in document: {block.Name}");
}
}Scalar JSON fields use exact dot-notation matching. For example, customer.firstName must exist as customer.firstName in a merge field or form field.
Dotted JSON fields can also be satisfied by a merge block and an inner merge field. For example, customer.name is considered present if the template contains a customer merge block and a merge field named name.
Merge block names are matched leniently so lineItems can match a SubTextPart named txmb_lineItems.
cd tx-check-template-dependencies
dotnet run| Back | FazBrowse Home | New Git URL |