<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="rfc7991bis.rnc"?>
<!-- <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?> -->

<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="info"
  docName="draft-bortzmeyer-rpp-json-dot-namespaces-00"
  ipr="trust200902"
  obsoletes=""
  updates=""
  submissionType="IETF"
  xml:lang="en"
  version="3">

  <front>
    <title abbrev="JSON namespaces with dots for RPP">Simple
    namespace-like proposal for JSON using dots, for the RPP</title>

    <seriesInfo name="Internet-Draft" value="draft-bortzmeyer-rpp-json-dot-namespaces-00"/>
   
    <author fullname="Stéphane Bortzmeyer" initials="S."
	    surname="Bortzmeyer">      
      <organization>Afnic</organization>
      <address>
        <postal>
          <street>7 avenue du 8 mai 1945</street>
          <city>Guyancourt</city>
          <code>78280</code>
          <country>FR</country>
          <!-- Uses two letter country code -->
        </postal>        
        <email>bortzmeyer+ietf@nic.fr</email>  
        <uri>https://www.afnic.fr/</uri>
      </address>
    </author>

    <date year="2025"/>

    <area>General</area>
    <workgroup>Internet Engineering Task Force</workgroup>

    <keyword>JSON RPP</keyword>

    <abstract>
      <t>This document proposes a lightweight convention for
      namespaces in the JSON payloads of RPP: a registry of namespaces
      plus the convention to write JSON names as namespace.shortname. It is
      not intended to be published as a RFC, just to stir discussion.</t>
    </abstract>
 
  </front>

  <middle>
    
    <section>
      <name>Introduction</name>
      <t>In the current discussions about RPP (RESTful Provisioning
      Protocol, see <xref target="I-D.wullink-rpp-requirements"/>),
      there has been a lot of talk about the extensibility of the
      protocol (see section 13 of the above draft). One of the issues
      raised by this requirment of extensibility is the fact that
      JSON (<xref target="RFC8259"/>), unlike XML, has no concept of namespaces. In the JSON
      world, the common way to introduce new members in objects is for
      the receiver to ignore unknown members (section 7 of the above
      draft makes that a requirment, see the "strict vs. lenient" discussion). This allows future
      extensions but, for a provisioning protocol, it is annoying
      since it means that requests from the client will be partially
      and silently ignored. Also, the lack of namespaces can create
      collisions between two extensions using the same name.</t>
      <t>As an example, if we have this payload describing a contact:</t>
      <sourcecode type="json" markers="false">
{
  "name": "John Foobar",
  "date-of-birth": "2025-05-30",
  "country": "ZZ"
}  
      </sourcecode>
      <t>What if we want to extend RPP to add the fact that John
      Foobar is a physical person, for instance for compliance with
      data privacy regulations that apply only to physical persons,
      like the GDPR?</t>
      <sourcecode type="json" markers="false">
{
  "name": "John Foobar",
  "date-of-birth": "2025-05-30",
  "country": "ZZ",
  "is-a-physical-person": true
}  
      </sourcecode>
      <t>How the "is-a-physical-person" member be marked and processed?</t>
      <t>There have been a lot of proposals to add some form of
      namespaces in JSON, often as part as an effort to design a
      schema language for JSON. In the IETF world, see for instance JMAP
      (<xref target="RFC8620"/>), which uses URIs to indicate
      extensions. Another proposal was
      <xref target="I-D.saintandre-json-namespaces"/>, using also URIs. But none has
      caught, in the sense of being widely recognized as a good way
      to create namespaces in JSON.</t>
      <t>For this document, the requirments are:</t>
      <ul>
          <li>Do not try to solve the general problem, a RPP-specific
	  solution is fine, using existing IETF infrastructure such as
	  an IANA registry.</li>
          <li>Ergonomy (ease of typing) is not mandatory (we won't
	  write the JSON manually) but nice (we may have to read the
	  JSON objects).</li>
	  <li>Do not use the existing proposed schema languages since
	  there is apparently no consensus on these but also do not
	  try <eref target="https://xkcd.com/927/">to invent a new one</eref>.</li>
	  <li>Try to be simple and lightweight.</li>
      </ul>

      <section>
        <name>Requirements Language</name>
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
          "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
          RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
          interpreted as described in BCP 14 <xref target="RFC2119"/>
          <xref target="RFC8174"/> when, and only when, they appear in
          all capitals, as shown here.</t>
      </section>
    </section>
    
    <section>
      <name>The proposal</name>
      <t>Core names are not namespaced (at this stage, it is not
      decided if mappings for domains, contacts and hosts will be
      regarded as core, or as extensions).</t>
      <t>Namespaces have to be registered with IANA, per <xref
      target="IANA"/>.</t>
      <section anchor="syntax">
	<name>Syntax</name>
      <t>The syntax follows ABNF (<xref target="RFC5234"/>). A namespace is identified by a string in restricted ASCII,
      just letters and dash:</t>
      <sourcecode type="abnf" markers="false">
namespace = %x2D / %x41-5A / %x61-7A 
      </sourcecode>
      <t>The name of a member of a JSON object in RPP will be "namespace.shortname":</t>
      <sourcecode type="abnf" markers="false">
name = [namespace %x2E] shortname
      </sourcecode>
      <t>Presently, shortname is not defined in RPP but we can assume
      it will be a (may be restricted?) form of JSON strings. It MUST NOT
      include dots.</t>
      </section>
      <section>
	<name>Example</name>
      <sourcecode type="json" markers="false">
{
  "name": "John Foobar",
  "date-of-birth": "2025-05-30",
  "country": "ZZ",
  "physical-person.status": true
}  
      </sourcecode>
      </section>
    </section>

    <section>
      <name>Towards a full extensibility proposal</name>
      <t>Of course, this small proposal is far from a complete
      solution to extend RPP. Such a solution would need to include:</t>
      <ul>
	<li>A way for the RPP clients and servers to advertise their
	capabilities (which extensions are supported).</li>
	<li>A way to extend non-payload stuff such as HTTP status codes.</li>
      </ul>
    </section>
    
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <t>IANA is requested to create a registry of namespaces. These
      namespaces must conform to the syntax of <xref
      target="syntax"/>. The policy to follow is "First Come First
      Served" as defined in <xref target="RFC8126"
      section="4.4"/>. (Alternative, "Specification Required", because
      it would be nice to have a spec but I understand that,
      currently, the actual semantics of "Specification Required" are
      not clear; for instance, is an Internet Draft sufficient?)</t>
    </section>
    
    <section anchor="Security">
      <name>Security Considerations</name>
      <t>There is probably zero security consequences of this proposal.</t>
    </section>
    
  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        
        <xi:include
            href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include
            href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5234.xml"/>
        <xi:include
            href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8126.xml"/>
        <xi:include
            href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include
            href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8259.xml"/>
        
      </references>
 
      <references>
        <name>Informative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8620.xml"/>
        <xi:include
	    href="https://datatracker.ietf.org/doc/bibxml3/draft-saintandre-json-namespaces"/>
        <xi:include
	    href="https://datatracker.ietf.org/doc/bibxml3/draft-wullink-rpp-requirements"/>
      </references>
    </references>

    <section>
      <name>Discussions and alternatives</name>
      <t>To be deleted before publication.</t>
      <t>TODO</t>
    </section>

 </back>
</rfc>
