Skip to content

Commit 02c209d

Browse files
committed
Docs updates
1 parent 284eb4f commit 02c209d

17 files changed

+535
-21
lines changed

DataWarehouseAutomation/DataWarehouseAutomation/HandleBarsHelpers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@ public static void RegisterHandleBarsHelpers()
359359
// lookupExtension allows a lookup of an extension value by key value. Pass in the Extensions list and the string key value.
360360
Handlebars.RegisterHelper("lookupExtension", (writer, context, parameters) =>
361361
{
362-
// Check if the parameters are valid
363-
if (parameters.Length != 2 || parameters[0] is not List<Extension> || parameters[1] is not string)
362+
// Check if the parameters are valid.
363+
if (parameters.Length != 2 || parameters[1] is not string)
364364
{
365-
throw new HandlebarsException("{{lookupExtension}} helper expects an Extension list and a string lookup key");
365+
throw new HandlebarsException("{{lookupExtension}} helper expects two arguments: a List<Extension> and a string lookup key");
366366
}
367367

368-
var extensionList = (List<Extension>)parameters[0];
368+
var extensionList = JsonSerializer.Deserialize<List<Extension>>(parameters[0].ToString() ?? string.Empty);
369369
var key = (string)parameters[1];
370370
var result = extensionList.Find(i => i.Key.Equals(key, StringComparison.OrdinalIgnoreCase))?.Value ?? "";
371371

DataWarehouseAutomation/Example_Project/Program.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ static void Main(string[] args)
1616
var sampleTemplateDirectory = AppDomain.CurrentDomain.BaseDirectory+@"..\..\..\..\Sample_Templates\";
1717
var sampleMetadataDirectory = AppDomain.CurrentDomain.BaseDirectory + @"..\..\..\..\Sample_Metadata\";
1818

19-
DisplayPatternResult(sampleTemplateDirectory + @"myFirstTemplate.handlebars", sampleMetadataDirectory + @"myFirstMapping.json");
20-
DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleBasic.handlebars", sampleMetadataDirectory + @"sampleBasic.json");
21-
DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleBasicWithExtensions.handlebars", sampleMetadataDirectory + @"sampleBasicWithExtensions.json");
22-
DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleMultipleDataItemMappings.handlebars", sampleMetadataDirectory + @"sampleMultipleDataItemMappings.json");
23-
DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleSourceQuery.handlebars", sampleMetadataDirectory + @"sampleSourceQuery.json");
24-
DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleSimpleDDL.handlebars", sampleMetadataDirectory + @"sampleSimpleDDL.json");
25-
DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleCalculation.handlebars", sampleMetadataDirectory + @"sampleCalculation.json");
26-
DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleFreeForm.handlebars", sampleMetadataDirectory + @"sampleFreeForm.json");
19+
//DisplayPatternResult(sampleTemplateDirectory + @"myFirstTemplate.handlebars", sampleMetadataDirectory + @"myFirstMapping.json");
20+
//DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleBasic.handlebars", sampleMetadataDirectory + @"sampleBasic.json");
21+
//DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleBasicWithExtensions.handlebars", sampleMetadataDirectory + @"sampleBasicWithExtensions.json");
22+
//DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleMultipleDataItemMappings.handlebars", sampleMetadataDirectory + @"sampleMultipleDataItemMappings.json");
23+
//DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleSourceQuery.handlebars", sampleMetadataDirectory + @"sampleSourceQuery.json");
24+
//DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleSimpleDDL.handlebars", sampleMetadataDirectory + @"sampleSimpleDDL.json");
25+
//DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleCalculation.handlebars", sampleMetadataDirectory + @"sampleCalculation.json");
26+
//DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleFreeForm.handlebars", sampleMetadataDirectory + @"sampleFreeForm.json");
2727
DisplayPatternResult(sampleTemplateDirectory + @"TemplateSampleCustomFunctions.handlebars", sampleMetadataDirectory + @"sampleCustomFunctions.json");
2828

2929
Console.ReadKey();
@@ -44,7 +44,7 @@ private static void DisplayPatternResult(string patternFile, string jsonMetadata
4444
//var deserializedMapping = System.Text.Json.JsonSerializer.Deserialize<ExpandoObject>(jsonInput);
4545
//DataObjectMappingList deserializedMapping = JsonSerializer.Deserialize<DataObjectMappingList>(jsonInput);
4646

47-
JsonNode deserializedMapping = System.Text.Json.JsonSerializer.Deserialize<JsonNode>(jsonInput);
47+
JsonNode deserializedMapping = JsonSerializer.Deserialize<JsonNode>(jsonInput);
4848

4949
var result = template(deserializedMapping);
5050
Console.WriteLine(result);

DataWarehouseAutomation/Sample_Metadata/sampleBasicWithExtensions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"name": "TableOneTarget",
1212
"extensions": [
1313
{
14-
"key": "colour",
14+
"key": "color",
1515
"value": "green",
16-
"description": "The colour of the object."
16+
"description": "The color of the object."
1717
},
1818
{
1919
"key": "taste",

DataWarehouseAutomation/Sample_Metadata/sampleCustomFunctions.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@
55
"sourceDataObjects": [
66
{
77
"dataObjectType": "dataObject",
8-
"name": "ExampleSourceDataObject"
8+
"name": "ExampleSourceDataObject",
9+
"extensions": [
10+
{
11+
"key": "type",
12+
"value": "procedure"
13+
},
14+
{
15+
"key": "hint",
16+
"value": "READ ONLY"
17+
}
18+
]
919
}
1020
],
1121
"targetDataObject": {
@@ -37,7 +47,7 @@
3747
{
3848
"sourceDataItems": [
3949
{
40-
"dataItemType" : "dataItem",
50+
"dataItemType": "dataItem",
4151
"name": "DOB"
4252
}
4353
],

DataWarehouseAutomation/Sample_Templates/TemplateSampleCustomFunctions.Handlebars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ Found a data item mapping from {{sourceDataItems.0.name}} to {{targetDataItem.na
3636
{{#targetDataItemExists "NAME"}}NAME exists{{else}}NAME does not exist{{/targetDataItemExists}}
3737
{{#targetDataItemExists "DATE_OF_BIRTH"}}DATE_OF_BIRTH exists{{else}}DATE_OF_BIRTH does not exist{{/targetDataItemExists}}
3838

39+
The lookup value for 'type' is '{{lookupExtension sourceDataObjects.0.extensions "type"}}'.
40+
3941
-- End of mapping
4042
{{/each}}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>{{exists}} | Schema for Data Warehouse Automation </title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta name="title" content="{{exists}} | Schema for Data Warehouse Automation ">
8+
9+
<link rel="icon" href="../favicon.ico">
10+
<link rel="stylesheet" href="../public/docfx.min.css">
11+
<link rel="stylesheet" href="../public/main.css">
12+
<meta name="docfx:navrel" content="../toc.html">
13+
<meta name="docfx:tocrel" content="../toc.html">
14+
15+
<meta name="docfx:rel" content="../">
16+
17+
<meta name="docfx:disabletocfilter" content="true">
18+
<meta name="docfx:docurl" content="https://github.com/data-solution-automation-engine/data-warehouse-automation-metadata-schema/blob/dev/docs/handlebars/extension_exists.md/#L1">
19+
</head>
20+
21+
<script type="module">
22+
import options from './../public/main.js'
23+
import { init } from './../public/docfx.min.js'
24+
init(options)
25+
</script>
26+
27+
<script>
28+
const theme = localStorage.getItem('theme') || 'auto'
29+
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
30+
</script>
31+
32+
33+
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
34+
<header class="bg-body border-bottom">
35+
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
36+
<div class="container-xxl flex-nowrap">
37+
<a class="navbar-brand" href="../index.html">
38+
<img id="logo" class="svg" src="../." alt="">
39+
40+
</a>
41+
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
42+
<i class="bi bi-three-dots"></i>
43+
</button>
44+
<div class="collapse navbar-collapse" id="navpanel">
45+
<div id="navbar">
46+
<form class="search" role="search" id="search">
47+
<i class="bi bi-search"></i>
48+
<input class="form-control" id="search-query" type="search" disabled="" placeholder="Search" autocomplete="off" aria-label="Search">
49+
</form>
50+
</div>
51+
</div>
52+
</div>
53+
</nav>
54+
</header>
55+
56+
<main class="container-xxl">
57+
<div class="toc-offcanvas">
58+
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
59+
<div class="offcanvas-header">
60+
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
61+
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
62+
</div>
63+
<div class="offcanvas-body">
64+
<nav class="toc" id="toc"></nav>
65+
</div>
66+
</div>
67+
</div>
68+
69+
<div class="content">
70+
<div class="actionbar">
71+
<button class="btn btn-lg border-0 d-md-none" style="margin-top: -.65em; margin-left: -.8em" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
72+
<i class="bi bi-list"></i>
73+
</button>
74+
75+
<nav id="breadcrumb"></nav>
76+
</div>
77+
78+
<article data-uid="">
79+
<h1 id="exists">{{exists}}</h1>
80+
81+
<p>This block helper extension specifically applies to the schema for data solution automation.</p>
82+
<p>The helper can target specific segments in the metadata, and evaluates if either the segment exists at all (without specifying an optional search value) or if the provided optional search value exists in that segment.</p>
83+
<p>Only the <em>multiActiveKey</em> and <em>targetDataItem</em> properties are currently supported.</p>
84+
<h2 id="usage">Usage</h2>
85+
<pre><code class="lang-json">{{#exists &quot;&lt;category / json segment&gt;&quot; &quot;&lt;optional value&gt;&quot;}}
86+
</code></pre>
87+
<h2 id="example">Example</h2>
88+
<pre><code class="lang-json">{{#exists multiActiveKey}}There is a multi-active key!{{else}}No multi-active key is found in this data object mapping.{{/exists}}
89+
{{#exists multiActiveKey &quot;DATE_OF_BIRTH&quot;}}There is a multi-active key which is not DATE_OF_BIRTH{{else}}No multi-active key with DATE_OF_BIRTH is found in this data object mapping.{{/exists}}
90+
{{#exists targetDataItem}}There is a target data item in this mapping!{{else}}No target data items are defined in this mapping.{{/exists}}
91+
</code></pre>
92+
<p>Depending on the metadata, this may result in:</p>
93+
<pre><code class="lang-dotnetcli">There is a multi-active key!
94+
No multi-active key with DATE_OF_BIRTH is found in this data object mapping.
95+
There is a target data item in this mapping!
96+
</code></pre>
97+
</article>
98+
99+
100+
<div class="next-article d-print-none border-top" id="nextArticle"></div>
101+
102+
</div>
103+
104+
<div class="affix">
105+
<nav id="affix"></nav>
106+
</div>
107+
</main>
108+
109+
<div class="container-xxl search-results" id="search-results"></div>
110+
111+
<footer class="border-top">
112+
<div class="container-xxl">
113+
<div class="flex-fill">
114+
<span>Schema for Data Solution Automation</span>
115+
</div>
116+
</div>
117+
</footer>
118+
</body>
119+
</html>
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>{{lookupExtension}} | Schema for Data Warehouse Automation </title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta name="title" content="{{lookupExtension}} | Schema for Data Warehouse Automation ">
8+
9+
<link rel="icon" href="../favicon.ico">
10+
<link rel="stylesheet" href="../public/docfx.min.css">
11+
<link rel="stylesheet" href="../public/main.css">
12+
<meta name="docfx:navrel" content="../toc.html">
13+
<meta name="docfx:tocrel" content="../toc.html">
14+
15+
<meta name="docfx:rel" content="../">
16+
17+
<meta name="docfx:disabletocfilter" content="true">
18+
<meta name="docfx:docurl" content="https://github.com/data-solution-automation-engine/data-warehouse-automation-metadata-schema/blob/dev/docs/handlebars/extension_lookupextension.md/#L1">
19+
</head>
20+
21+
<script type="module">
22+
import options from './../public/main.js'
23+
import { init } from './../public/docfx.min.js'
24+
init(options)
25+
</script>
26+
27+
<script>
28+
const theme = localStorage.getItem('theme') || 'auto'
29+
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
30+
</script>
31+
32+
33+
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
34+
<header class="bg-body border-bottom">
35+
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
36+
<div class="container-xxl flex-nowrap">
37+
<a class="navbar-brand" href="../index.html">
38+
<img id="logo" class="svg" src="../." alt="">
39+
40+
</a>
41+
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
42+
<i class="bi bi-three-dots"></i>
43+
</button>
44+
<div class="collapse navbar-collapse" id="navpanel">
45+
<div id="navbar">
46+
<form class="search" role="search" id="search">
47+
<i class="bi bi-search"></i>
48+
<input class="form-control" id="search-query" type="search" disabled="" placeholder="Search" autocomplete="off" aria-label="Search">
49+
</form>
50+
</div>
51+
</div>
52+
</div>
53+
</nav>
54+
</header>
55+
56+
<main class="container-xxl">
57+
<div class="toc-offcanvas">
58+
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
59+
<div class="offcanvas-header">
60+
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
61+
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
62+
</div>
63+
<div class="offcanvas-body">
64+
<nav class="toc" id="toc"></nav>
65+
</div>
66+
</div>
67+
</div>
68+
69+
<div class="content">
70+
<div class="actionbar">
71+
<button class="btn btn-lg border-0 d-md-none" style="margin-top: -.65em; margin-left: -.8em" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
72+
<i class="bi bi-list"></i>
73+
</button>
74+
75+
<nav id="breadcrumb"></nav>
76+
</div>
77+
78+
<article data-uid="">
79+
<h1 id="lookupextension">{{lookupExtension}}</h1>
80+
81+
<p>This block helper extension specifically applies to the schema for data solution automation.</p>
82+
<p>The lookupExtension helper allows a lookup of an extension by key value.</p>
83+
<p>Pass in the extensions list and the string key value.</p>
84+
<h2 id="usage">Usage</h2>
85+
<pre><code class="lang-json">{{lookupExtension &lt;extension list&gt; &quot;&lt;string value&gt;&quot;}}
86+
</code></pre>
87+
<h2 id="example">Example</h2>
88+
<pre><code class="lang-json">The lookup value for the 'type' extension is '{{lookupExtension sourceDataObjects.0.extensions &quot;type&quot;}}'.
89+
</code></pre>
90+
<p>Depending on the metadata, this may result in:</p>
91+
<pre><code class="lang-dotnetcli">The lookup value for the 'type' extension is 'procedure'.
92+
</code></pre>
93+
</article>
94+
95+
96+
<div class="next-article d-print-none border-top" id="nextArticle"></div>
97+
98+
</div>
99+
100+
<div class="affix">
101+
<nav id="affix"></nav>
102+
</div>
103+
</main>
104+
105+
<div class="container-xxl search-results" id="search-results"></div>
106+
107+
<footer class="border-top">
108+
<div class="container-xxl">
109+
<div class="flex-fill">
110+
<span>Schema for Data Solution Automation</span>
111+
</div>
112+
</div>
113+
</footer>
114+
</body>
115+
</html>

0 commit comments

Comments
 (0)