<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC3986 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3986.xml">
<!ENTITY RFC2616 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml">
<!ENTITY RFC4627 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4627.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<rfc category="info" docName="draft-pbryan-zyp-json-ref-03" ipr="trust200902">

    <front>
        <title>JSON Reference</title>
        <author fullname="Paul C. Bryan" initials="P." surname="Bryan" role="editor">
			<organization>Salesforce.com</organization>
            <address>
                <phone>+1 604 783 1481</phone>
                <email>pbryan@anode.ca</email>
            </address>
        </author>
        <author fullname="Kris Zyp" initials="K." surname="Zyp">
            <organization>SitePen (USA)</organization>
            <address>
                <phone>+1 650 968 8787</phone>
                <email>kris@sitepen.com</email>
            </address>
        </author>
        <date year="2012"/>
        <area>General</area>
        <workgroup>Internet Engineering Task Force</workgroup>
        <keyword>json</keyword>
        <abstract>
            <t>JSON Reference allows a JSON value to reference another value in a JSON
             document.</t>
        </abstract>
    </front>

    <middle>
        <section title="Introduction">
            <t>This specification defines a <xref target="RFC4627">JSON</xref> structure
             which allows a JSON value to reference another value in a JSON document.
             This provides the basis for transclusion in JSON: the use of a target resource
             as an effective substitute for the reference.</t>
        </section>
        <section title="Conventions">
            <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
             "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
             interpreted as described in <xref target="RFC2119"/>.</t>
        </section>
        <section title="Syntax">
            <t><figure><preamble>A JSON Reference is a JSON object, which contains a member
            named "$ref", which has a JSON string value. Example:</preamble>
            <artwork><![CDATA[
{ "$ref": "http://example.com/example.json#/foo/bar" }
]]>         </artwork><postamble>If a JSON value does not have these characteristics, then
            it SHOULD NOT be interpreted as a JSON Reference.</postamble></figure></t>
            <t>The "$ref" string value contains a <xref target="RFC3986">URI</xref>,
            which identifies the location of the JSON value being referenced. It is an error
            condition if the string value does not conform to URI syntax rules. Any
            members other than "$ref" in a JSON Reference object SHALL be ignored.</t>
        </section>
        <section title="Resolution">
            <t>Resolution of a JSON Reference object SHOULD yield the referenced JSON
             value. Implementations MAY choose to replace the reference with the referenced
             value.</t>
            <t>If the URI contained in the JSON Reference value is a relative URI, then
             the base URI resolution MUST be calculated according to <xref target="RFC3986"/>,
             section 5.2. Resolution is performed relative to the referring document.</t>
            <t>If a URI contains a fragment identifier, then the fragment should be resolved
             per the fragment resolution mechansim of the referrant document. If the
             representation of the referrant document is JSON, then the fragment identifier
             SHOULD be interpreted as a <xref target="JSON-Pointer"/>.</t>
        </section>
        <section title="Error Handling">
            <t>In the event of an error condition, evaluation of the JSON Reference SHOULD
             fail to complete.</t>
        </section>
        <section anchor="IANA" title="IANA Considerations">
            <t>This draft includes no request to IANA.</t>
        </section>
        <section anchor="Security" title="Security Considerations">
            <t>A JSON Reference is not guaranteed to resolve to a JSON value. Implementations
             of this specification SHOULD take appropriate precautions.</t>
            <t>Documents containing JSON References can be structured to resolve cyclically.
             Implementations SHOULD include appropriate checks to prevent such structures
             from resulting in infinite recursion or iteration.</t> 
        </section>
    </middle>

    <back>
        <references title="Normative References">
            &RFC2119;
            &RFC3986;
            &RFC4627;
            <reference anchor="JSON-Pointer">
                <front>
                    <title>JSON Pointer</title>
                    <author initials="P." surname="Bryan" fullname="Paul C. Bryan"/>
                    <author initials="K." surname="Zyp" fullname="Kris Zyp"/>
                    <author initials="M." surname="Nottingham" fullname="Mark Nottingham"/>
                    <date year="2012" month="September"/>
                </front>
                <seriesInfo name="Internet-Draft" value="draft-ietf-appsawg-json-pointer-04"/>
                <format type="TXT" target="http://www.ietf.org/internet-drafts/draft-ietf-appsawg-json-pointer-04.txt"/>
                <format type="HTML" target="http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-04"/>
            </reference>
        </references>

        <section title="Acknowledgements">
            <t>The following individuals contributed ideas, feedback and
            wording to this specification:<list>
                <t>Bob Aman, Francis Galiegue.</t>
            </list></t> 
        </section>

        <section title="Examples">
            <t>TBD.</t>
        </section>
        
    </back>

</rfc>
