|  | 
| 726 | 726 |  </section> | 
| 727 | 727 |  </section> | 
| 728 | 728 | 
 | 
| 729 |  | - <section title='String-Encoding Non-JSON Data' anchor="content"> | 
|  | 729 | + <section title='String-Encoded Data' anchor="content"> | 
| 730 | 730 | 
 | 
| 731 | 731 |  <section title="Foreword"> | 
| 732 | 732 |  <t> | 
|  | 
| 773 | 773 |  can be constrained using the <xref target="pattern">"pattern"</xref> keyword. | 
| 774 | 774 |  </t> | 
| 775 | 775 | 
 | 
|  | 776 | + <t> | 
|  | 777 | + If this keyword is absent, but "contentMediaType" is present, this | 
|  | 778 | + indicates that the media type could be encoded into UTF-8 like any | 
|  | 779 | + other JSON string value, and does not require additional decoding. | 
|  | 780 | + </t> | 
|  | 781 | + | 
| 776 | 782 |  <t> | 
| 777 | 783 |  The value of this property MUST be a string. | 
| 778 | 784 |  </t> | 
|  | 
| 786 | 792 | 
 | 
| 787 | 793 |  <section title="contentMediaType"> | 
| 788 | 794 |  <t> | 
| 789 |  | - The value of this property must be a media type, as defined by | 
| 790 |  | - <xreftarget="RFC2046">RFC 2046</xref>. This property defines the media | 
| 791 |  | - type of instances which this schema defines. | 
|  | 795 | + If the instance is a string, this property defines the media type | 
|  | 796 | + of the contents of the string. If "contentEncoding" is present, | 
|  | 797 | + this property describes the decoded string. | 
| 792 | 798 |  </t> | 
| 793 |  | - | 
| 794 | 799 |  <t> | 
| 795 |  | - The value of this property MUST be a string. | 
|  | 800 | + The value of this property MUST be a string, which MUST be a media type, | 
|  | 801 | + as defined by <xref target="RFC2046">RFC 2046</xref>. | 
| 796 | 802 |  </t> | 
| 797 | 803 | 
 | 
| 798 | 804 |  <t> | 
| 799 | 805 |  The value of this property SHOULD be ignored if the instance described is not a | 
| 800 | 806 |  string. | 
| 801 | 807 |  </t> | 
|  | 808 | + </section> | 
| 802 | 809 | 
 | 
|  | 810 | + <section title="contentSchema"> | 
| 803 | 811 |  <t> | 
| 804 |  | - If the "contentEncoding" property is not present, but the instance value is a | 
| 805 |  | - string, then the value of this property SHOULD specify a text document type, | 
| 806 |  | - and the character set SHOULD be the character set into which the JSON string | 
| 807 |  | - value was decoded (for which the default is Unicode). | 
|  | 812 | + If the instance is a string, and if "contentMediaType" is present, this | 
|  | 813 | + property contains a schema which describes the structure of the string. | 
|  | 814 | + </t> | 
|  | 815 | + <t> | 
|  | 816 | + This keyword MAY be used with any media type that can be mapped into | 
|  | 817 | + JSON Schema's data model. | 
|  | 818 | + </t> | 
|  | 819 | + <t> | 
|  | 820 | + The value of this property SHOULD be ignored if the instance described is not a | 
|  | 821 | + string, or if "contentMediaType" is not present. | 
| 808 | 822 |  </t> | 
| 809 | 823 |  </section> | 
| 810 | 824 | 
 | 
|  | 
| 847 | 861 |  Unicode). | 
| 848 | 862 |  </postamble> | 
| 849 | 863 |  </figure> | 
|  | 864 | + | 
|  | 865 | + <figure> | 
|  | 866 | + <preamble> | 
|  | 867 | + This example describes a JWT that is MACed using the HMAC SHA-256 | 
|  | 868 | + algorithm, and requires the "iss" and "exp" fields in its claim set. | 
|  | 869 | + </preamble> | 
|  | 870 | + <artwork> | 
|  | 871 | +<![CDATA[ | 
|  | 872 | +{ | 
|  | 873 | + "type": "string", | 
|  | 874 | + "contentMediaType": "application/jwt", | 
|  | 875 | + "contentSchema": { | 
|  | 876 | + "type": "array", | 
|  | 877 | + "minItems": 2, | 
|  | 878 | + "items": [ | 
|  | 879 | + { | 
|  | 880 | + "const": { | 
|  | 881 | + "typ": "JWT", | 
|  | 882 | + "alg": "HS256" | 
|  | 883 | + }  | 
|  | 884 | + }, | 
|  | 885 | + { | 
|  | 886 | + "type": "object", | 
|  | 887 | + "required": ["iss", "exp"], | 
|  | 888 | + "properties": { | 
|  | 889 | + "iss": {"type": "string"}, | 
|  | 890 | + "exp": {"type": "integer"} | 
|  | 891 | + } | 
|  | 892 | + } | 
|  | 893 | + ] | 
|  | 894 | + }  | 
|  | 895 | +}]]> | 
|  | 896 | + </artwork> | 
|  | 897 | + <postamble> | 
|  | 898 | + Note that "contentEncoding" does not appear. While the "application/jwt" | 
|  | 899 | + media type makes use of base64url encoding, that is defined by the media | 
|  | 900 | + type, which determines how the JWT string is decoded into a list of two | 
|  | 901 | + JSON data structures: first the header, and then the payload. Since the | 
|  | 902 | + JWT media type ensures that the JWT can be represented in a JSON string, | 
|  | 903 | + there is no need for further encoding or decoding. | 
|  | 904 | + </postamble> | 
|  | 905 | + </figure> | 
| 850 | 906 |  </section> | 
| 851 | 907 | 
 | 
| 852 | 908 |  </section> | 
|  | 
0 commit comments