Skip to content

Commit bb7e3df

Browse files
committed
Fix layout.
1 parent 2236736 commit bb7e3df

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

articles/iot-pnp/concepts-model-parser.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: Understand the Digital Twins model parser | Microsoft Docs
3-
description: As a developer, learn how to use the DTDL parser to validate models
3+
description: As a developer, learn how to use the DTDL parser to validate models.
44
author: rido-min
55
ms.author: rmpablos
6-
ms.date: 04/29/2020
6+
ms.date: 10/21/2020
77
ms.topic: conceptual
88
ms.custom: mvc
99
ms.service: iot-pnp
1010
services: iot-pnp
11-
manager: peterpr
11+
1212
---
1313

1414
# Understand the digital twins model parser
@@ -23,11 +23,12 @@ The parser is available in NuGet.org with the ID: [Microsoft.Azure.DigitalTwins.
2323
dotnet add package Microsoft.Azure.DigitalTwins.Parser
2424
```
2525

26-
>Note: The latest version of the parser is `3.12.5`
26+
> [!NOTE]
27+
> At the time of writing, the parser version is `3.12.5`.
2728
2829
## Use the parser to validate a model
2930

30-
The model you want to validate might be composed of one or more interfaces described in JSON files. You can use the parser to load all the files in a given folder and use the parser to validate all the files as a whole, including any references between the files:
31+
A model can be composed of one or more interfaces described in JSON files. You can use the parser to load all the files in a given folder and use the parser to validate all the files as a whole, including any references between the files:
3132

3233
1. Create an `IEnumerable<string>` with a list of all model contents:
3334

@@ -56,31 +57,31 @@ The model you want to validate might be composed of one or more interfaces descr
5657

5758
1. Check for validation errors. If the parser finds any errors, it throws an `ParsingException` with a list of errors:
5859

59-
```csharp
60-
try
61-
{
62-
IReadOnlyDictionary<Dtmi, DTEntityInfo> parseResult = await modelParser.ParseAsync(modelJson);
63-
}
64-
catch (ParsingException pex)
65-
{
66-
Console.WriteLine(pex.Message);
67-
foreach (var err in pex.Errors)
60+
```csharp
61+
try
6862
{
69-
Console.WriteLine(err.PrimaryID);
70-
Console.WriteLine(err.Message);
63+
IReadOnlyDictionary<Dtmi, DTEntityInfo> parseResult = await modelParser.ParseAsync(modelJson);
7164
}
72-
}
73-
```
65+
catch (ParsingException pex)
66+
{
67+
Console.WriteLine(pex.Message);
68+
foreach (var err in pex.Errors)
69+
{
70+
Console.WriteLine(err.PrimaryID);
71+
Console.WriteLine(err.Message);
72+
}
73+
}
74+
```
7475

7576
1. Inspect the `Model`. If the validation succeeds, you can use the model parser API to inspect the model. The following code snippet shows how to iterate over all the models parsed and displays the existing properties:
7677

77-
```csharp
78-
foreach (var item in parseResult)
79-
{
80-
Console.WriteLine($"\t{item.Key}");
81-
Console.WriteLine($"\t{item.Value.DisplayName?.Values.FirstOrDefault()}");
82-
}
83-
```
78+
```csharp
79+
foreach (var item in parseResult)
80+
{
81+
Console.WriteLine($"\t{item.Key}");
82+
Console.WriteLine($"\t{item.Value.DisplayName?.Values.FirstOrDefault()}");
83+
}
84+
```
8485

8586
## Next steps
8687

0 commit comments

Comments
 (0)