Skip to content

Commit c281f8f

Browse files
committed
Update project documentations
1 parent 8c461e8 commit c281f8f

File tree

41 files changed

+3608
-392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3608
-392
lines changed

JsonSchema/RelogicLabs/JsonSchema/JsonAssert.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
namespace RelogicLabs.JsonSchema;
77

88
/// <summary>
9-
/// Provides assertion functionalities to validate Json document against a Schema or Json.
9+
/// Provides assertion functionalities to validate JSON document against a Schema or JSON.
1010
/// </summary>
1111
public class JsonAssert
1212
{
1313
public RuntimeContext Runtime { get; }
14-
public IDataTree DataTree { get; }
14+
public IDataTree ExpectedTree { get; }
1515

1616
/// <summary>
1717
/// Initializes a new instance of the <see cref="JsonAssert"/> class for the
@@ -22,57 +22,57 @@ public JsonAssert(string schema) : this(schema, SCHEMA_TREE) { }
2222

2323
/// <summary>
2424
/// Initializes a new instance of the <see cref="JsonAssert"/> class for the
25-
/// specified <paramref name="expected"/> string which can be either a Schema or a Json
25+
/// specified <paramref name="expected"/> string which can be either a Schema or a JSON
2626
/// representation.
2727
/// </summary>
28-
/// <param name="expected">An expected Schema or Json string for validation or conformation.</param>
28+
/// <param name="expected">An expected Schema or JSON string for validation or conformation.</param>
2929
/// <param name="type">The type of string provided by <paramref name="expected"/>, indicating
30-
/// whether it represents a Schema or Json. Use <see cref="TreeType.SCHEMA_TREE"/> for Schema
31-
/// and <see cref="TreeType.JSON_TREE"/> for Json.</param>
30+
/// whether it represents a Schema or JSON. Use <see cref="TreeType.SCHEMA_TREE"/> for Schema
31+
/// and <see cref="TreeType.JSON_TREE"/> for JSON.</param>
3232
public JsonAssert(string expected, TreeType type)
3333
{
3434
if(type == SCHEMA_TREE)
3535
{
3636
Runtime = new RuntimeContext(MessageFormatter.SchemaAssertion, true);
37-
DataTree = new SchemaTree(Runtime, expected);
37+
ExpectedTree = new SchemaTree(Runtime, expected);
3838
}
3939
else
4040
{
4141
Runtime = new RuntimeContext(MessageFormatter.JsonAssertion, true);
42-
DataTree = new JsonTree(Runtime, expected);
42+
ExpectedTree = new JsonTree(Runtime, expected);
4343
}
4444
}
4545

4646
/// <summary>
47-
/// Tests whether the input JSON string conforms to the Schema specified
48-
/// in the <see cref="JsonAssert"/> constructor.
47+
/// Tests whether the input JSON string conforms to the expected Schema or JSON
48+
/// specified in the <see cref="JsonAssert"/> constructor.
4949
/// </summary>
50-
/// <param name="jsonActual">The actual JSON to conform or validate.</param>
51-
public void IsValid(string jsonActual)
50+
/// <param name="json">The actual JSON to conform or validate.</param>
51+
public void IsValid(string json)
5252
{
5353
Runtime.Clear();
54-
JsonTree jsonTree = new(Runtime, jsonActual);
55-
DebugUtilities.Print(DataTree, jsonTree);
56-
if(!DataTree.Match(jsonTree))
54+
JsonTree jsonTree = new(Runtime, json);
55+
DebugUtilities.Print(ExpectedTree, jsonTree);
56+
if(!ExpectedTree.Match(jsonTree))
5757
throw new InvalidOperationException("Invalid runtime state");
5858
}
5959

6060
/// <summary>
6161
/// Tests whether the specified JSON string conforms to the given Schema string
6262
/// and throws an exception if the JSON string does not conform to the Schema.
6363
/// </summary>
64-
/// <param name="schemaExpected">The expected Schema to conform or validate.</param>
65-
/// <param name="jsonActual">The actual JSON to conform or validate.</param>
66-
public static void IsValid(string schemaExpected, string jsonActual)
67-
=> new JsonAssert(schemaExpected).IsValid(jsonActual);
64+
/// <param name="schema">The expected Schema to conform or validate.</param>
65+
/// <param name="json">The actual JSON to conform or validate.</param>
66+
public static void IsValid(string schema, string json)
67+
=> new JsonAssert(schema).IsValid(json);
6868

6969
/// <summary>
7070
/// Tests if the provided JSON strings are logically equivalent, meaning their structural
7171
/// composition and internal data are identical. If the JSON strings are not equivalent,
7272
/// an exception is thrown.
7373
/// </summary>
74-
/// <param name="jsonExpected">The expected JSON to compare.</param>
75-
/// <param name="jsonActual">The actual JSON to compare.</param>
76-
public static void AreEqual(string jsonExpected, string jsonActual)
77-
=> new JsonAssert(jsonExpected, JSON_TREE).IsValid(jsonActual);
74+
/// <param name="expected">The expected JSON to compare.</param>
75+
/// <param name="actual">The actual JSON to compare.</param>
76+
public static void AreEqual(string expected, string actual)
77+
=> new JsonAssert(expected, JSON_TREE).IsValid(actual);
7878
}

JsonSchema/doc/api/RelogicLabs.JsonSchema.Exceptions.CommonException.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ <h1 id="RelogicLabs_JsonSchema_Exceptions_CommonException" data-uid="RelogicLabs
137137
<div><a class="xref" href="RelogicLabs.JsonSchema.Exceptions.JsonLexerException.html">JsonLexerException</a></div>
138138
<div><a class="xref" href="RelogicLabs.JsonSchema.Exceptions.JsonParserException.html">JsonParserException</a></div>
139139
<div><a class="xref" href="RelogicLabs.JsonSchema.Exceptions.JsonSchemaException.html">JsonSchemaException</a></div>
140+
<div><a class="xref" href="RelogicLabs.JsonSchema.Exceptions.NoValueReceivedException.html">NoValueReceivedException</a></div>
140141
<div><a class="xref" href="RelogicLabs.JsonSchema.Exceptions.PragmaNotFoundException.html">PragmaNotFoundException</a></div>
142+
<div><a class="xref" href="RelogicLabs.JsonSchema.Exceptions.ReceiverNotFoundException.html">ReceiverNotFoundException</a></div>
141143
<div><a class="xref" href="RelogicLabs.JsonSchema.Exceptions.SchemaLexerException.html">SchemaLexerException</a></div>
142144
<div><a class="xref" href="RelogicLabs.JsonSchema.Exceptions.SchemaParserException.html">SchemaParserException</a></div>
143145
</dd>

0 commit comments

Comments
 (0)