~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/Newtonsoft.Json/Doc/JsonSchema.aml

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="utf-8"?>
 
2
<topic id="JsonSchema" revisionNumber="1">
 
3
  <developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
 
4
    <introduction>
 
5
      <para>Json.NET supports the JSON Schema standard via the <codeEntityReference>T:Newtonsoft.Json.Schema.JsonSchema</codeEntityReference>
 
6
      and <codeEntityReference>T:Newtonsoft.Json.JsonValidatingReader</codeEntityReference> classes. It sits under
 
7
      the <codeEntityReference>N:Newtonsoft.Json.Schema</codeEntityReference> namespace.</para>
 
8
      <para>JSON Schema is used to validate the structure and
 
9
      data types of a piece of JSON, similar to XML Schema for XML. Read more about JSON Schema at 
 
10
      <externalLink>
 
11
        <linkText>json-schema.org</linkText>
 
12
        <linkUri>http://json-schema.org/</linkUri>
 
13
        <linkTarget>_blank</linkTarget>
 
14
      </externalLink></para>
 
15
    </introduction>
 
16
    <!-- Optional procedures followed by optional code example but must have
 
17
         at least one procedure or code example -->
 
18
<section>
 
19
  <title>Validating with JSON Schema</title>
 
20
<content>
 
21
<para>The simplest way to check if JSON is valid is to load the JSON into a JObject or JArray and then
 
22
use the <codeEntityReference>M:Newtonsoft.Json.Schema.Extensions.IsValid(Newtonsoft.Json.Linq.JToken,Newtonsoft.Json.Schema.JsonSchema)</codeEntityReference>
 
23
method with the JSON Schema.</para>
 
24
 
 
25
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\JsonSchemaTests.cs" region="IsValidBasic" title="Validate JSON with IsValid" />
 
26
 
 
27
<para>To get validation error messages use the
 
28
<codeEntityReference>M:Newtonsoft.Json.Schema.Extensions.IsValid(Newtonsoft.Json.Linq.JToken,Newtonsoft.Json.Schema.JsonSchema,System.Collections.Generic.IList{System.String}@)</codeEntityReference>
 
29
or
 
30
<codeEntityReference>M:Newtonsoft.Json.Schema.Extensions.Validate(Newtonsoft.Json.Linq.JToken,Newtonsoft.Json.Schema.JsonSchema,Newtonsoft.Json.Schema.ValidationEventHandler)</codeEntityReference>
 
31
overloads.</para>
 
32
 
 
33
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\JsonSchemaTests.cs" region="IsValidMessages" title="Validate JSON with IsValid" />
 
34
 
 
35
<para>Internally IsValid uses <codeEntityReference>T:Newtonsoft.Json.JsonValidatingReader</codeEntityReference>
 
36
to perform the JSON Schema validation. To skip the overhead of loading JSON into a JObject/JArray, validating
 
37
the JSON and then deserializing the JSON into a class, JsonValidatingReader can be used with JsonSerializer to validate JSON while the object is being deserialized.</para>
 
38
 
 
39
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\JsonSchemaTests.cs" region="JsonValidatingReader" title="Validate JSON with JsonValidatingReader" />
 
40
 
 
41
</content>
 
42
</section>
 
43
 
 
44
<section>
 
45
  <title>Creating JSON Schemas</title>
 
46
  <content>
 
47
 
 
48
<para>The simplest way to get a <codeEntityReference>T:Newtonsoft.Json.Schema.JsonSchema</codeEntityReference> object is to load it from a string or a file.</para>
 
49
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\JsonSchemaTests.cs" region="LoadJsonSchema" title="Creating JSON Schemas from strings or files" />
 
50
 
 
51
<para>It is also possible to create JsonSchema objects in code.</para>
 
52
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\JsonSchemaTests.cs" region="ManuallyCreateJsonSchema" title="Create new JSON Schemas in code" />
 
53
 
 
54
  </content>
 
55
</section>
 
56
    <relatedTopics>
 
57
      <codeEntityReference>T:Newtonsoft.Json.Schema.JsonSchema</codeEntityReference>
 
58
      <codeEntityReference>T:Newtonsoft.Json.JsonValidatingReader</codeEntityReference>
 
59
    </relatedTopics>
 
60
 
 
61
  </developerConceptualDocument>
 
62
</topic>
 
 
b'\\ No newline at end of file'