<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.6.23 (Ruby 3.2.0) -->
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-bormann-cbor-draft-numbers-00" category="info" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.16.0 -->
  <front>
    <title>Managing CBOR numbers in Internet-Drafts</title>
    <seriesInfo name="Internet-Draft" value="draft-bormann-cbor-draft-numbers-00"/>
    <author initials="C." surname="Bormann" fullname="Carsten Bormann">
      <organization>Universität Bremen TZI</organization>
      <address>
        <postal>
          <street>Postfach 330440</street>
          <city>Bremen</city>
          <code>D-28359</code>
          <country>Germany</country>
        </postal>
        <phone>+49-421-218-63921</phone>
        <email>cabo@tzi.org</email>
      </address>
    </author>
    <date year="2023" month="February" day="22"/>
    <keyword>CBOR numbers</keyword>
    <abstract>
      <t>CBOR-based protocols often make use of numbers allocated in a
registry.
While developing the protocols, those numbers may not yet be
available.
This impedes the generation of data models and examples that actually
can be used by tools.</t>
      <t>This short draft proposes a common way to handle these situations,
without any changes to existing tools.
Such changes are very well possible in the future, at which time this
draft will be updated.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="intro">
      <name>Introduction</name>
      <t>(Please see abstract.)
<xref target="RFC8949"/></t>
    </section>
    <section anchor="the-problem">
      <name>The Problem</name>
      <t>A CBOR-based protocol might want to define a structure using CDDL
<xref target="RFC8610"/><xref target="RFC9165"/>, like that in <xref target="fig-struct1"/> (based on <xref target="RFC9290"/>):</t>
      <figure anchor="fig-struct1">
        <name>CDDL data model, final form</name>
        <sourcecode type="cddl"><![CDATA[
problem-details = {
  ? &(title: -1) => oltext
  ? &(detail: -2) => oltext
  ? &(instance: -3) => ~uri
  ? &(response-code: -4) => uint .size 1
  ? &(base-uri: -5) => ~uri
  ? &(base-lang: -6) => tag38-ltag
  ? &(base-rtl: -7) => tag38-direction
  / ... /
  * (uint .feature "extension") => any
}
]]></sourcecode>
      </figure>
      <t>The key numbers shown in this structure are likely to be intended for
allocation in an IANA section.</t>
      <t>The key numbers will be used in an example in the specification such
as shown in <xref target="fig-struct2"/>.</t>
      <figure anchor="fig-struct2">
        <name>CBOR-diag example, final form</name>
        <sourcecode type="cbor-diag"><![CDATA[
{
  / title /         -1: "title of the error",
  / detail /        -2: "detailed information about the error",
  / instance /      -3: "coaps://pd.example/FA317434",
  / response-code / -4: 128, / 4.00 /
  4711: {
     / ... /
  }
}
]]></sourcecode>
      </figure>
      <t>However, during development, these numbers are not yet fixed; they are
likely to move around as parts of the specification are added or deleted.</t>
    </section>
    <section anchor="the-anti-pattern">
      <name>The Anti-Pattern</name>
      <t>What not to do during development:</t>
      <figure anchor="fig-bad1">
        <name>CDDL data model, muddled form</name>
        <sourcecode type="cddl"><![CDATA[
problem-details = {
  ? "title" => oltext
  ? "detail" => oltext
  ? "instance" => ~uri
  ? "response-code" => uint .size 1
  ? "base-uri" => ~uri
  ? "base-lang" => tag38-ltag
  ? "base-rtl" => tag38-direction
  / ... /
  * (uint .feature "extension") => any
}
]]></sourcecode>
      </figure>
      <figure anchor="fig-bad2">
        <name>CBOR-diag example, muddled form</name>
        <sourcecode type="cbor-diag"><![CDATA[
{
  "title": "title of the error",
  "detail": "detailed information about the error",
  "instance-code": "coaps://pd.example/FA317434",
  "response-code": 128, / 4.00 /
  4711: {
     / ... /
  }
}
]]></sourcecode>
      </figure>
      <t>This makes the model and the examples compile/check out without allocating
numbers, but it also leads to several problems:</t>
      <ul spacing="normal">
        <li>It becomes hard to assess what the storage/transmission cost of
these structures will be.</li>
        <li>What is being checked in the CI (continuous integration) for the
document is rather different from the final form.</li>
        <li>Draft implementations trying to make use of these provisional structures
have to cater for text strings, which may not actually be needed in
the final form (which might expose specification bugs once numbers
are used, too late in the process).</li>
        <li>The work needed to put in the actual numbers, once allocated, is
significant and error-prone.</li>
        <li>It is not certain the CI system used during development can interact
with the RFC editor's way of editing the document for publication.</li>
      </ul>
    </section>
    <section anchor="what-to-do-during-spec-development">
      <name>What to do during spec development</name>
      <t>To make the transition to a published document easier, the document is
instead written with the convention demonstrated in the following:</t>
      <figure anchor="fig-dev1">
        <name>CDDL data model, development form</name>
        <sourcecode type="cddl"><![CDATA[
problem-details = {
  ? &(title-CPA: -1) => oltext
  ? &(detail-CPA: -2) => oltext
  ? &(instance-CPA: -3) => ~uri
  ? &(response-code-CPA: -4) => uint .size 1
  ? &(base-uri-CPA: -5) => ~uri
  ? &(base-lang-CPA: -6) => tag38-ltag
  ? &(base-rtl-CPA: -7) => tag38-direction
  / ... /
  * (uint .feature "extension") => any
}
]]></sourcecode>
      </figure>
      <t>CPA is short for "code point allocation", and is a reliable search key
for finding the places that need to be updated after allocation.<cref anchor="tbd">An earlier concept for this draft used TBD in place of CPA, as
do many draft specifications being worked on today.
TBD is better recognized than CPA, but also could be misunderstood
to mean further work by the spec developer is required.
A document submitted for publications should not really have "TBD"
in it.</cref></t>
      <t>In the IANA section, the table to go into the registry is prepared as
follows:</t>
      <table anchor="tab-iana">
        <name>IANA table, development form</name>
        <thead>
          <tr>
            <th align="left">Key value</th>
            <th align="left">Name</th>
            <th align="left">CDDL Type</th>
            <th align="left">Brief description</th>
            <th align="left">Reference</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="left">CPA-1</td>
            <td align="left">title</td>
            <td align="left">
              <tt>text / tag38</tt></td>
            <td align="left">short, human-readable summary of the problem shape</td>
            <td align="left">RFC XXXX</td>
          </tr>
          <tr>
            <td align="left">CPA-2</td>
            <td align="left">detail</td>
            <td align="left">
              <tt>text / tag38</tt></td>
            <td align="left">human-readable explanation specific to this occurrence of the problem</td>
            <td align="left">RFC XXXX</td>
          </tr>
          <tr>
            <td align="left">CPA-3</td>
            <td align="left">instance</td>
            <td align="left">
              <tt>~uri</tt></td>
            <td align="left">URI reference identifying specific occurrence of the problem</td>
            <td align="left">RFC XXXX</td>
          </tr>
          <tr>
            <td align="left">CPA-4</td>
            <td align="left">response-code</td>
            <td align="left">
              <tt>uint .size 1</tt></td>
            <td align="left">CoAP response code</td>
            <td align="left">RFC XXXX</td>
          </tr>
          <tr>
            <td align="left">CPA-5</td>
            <td align="left">base-uri</td>
            <td align="left">
              <tt>~uri</tt></td>
            <td align="left">Base URI</td>
            <td align="left">RFC XXXX</td>
          </tr>
          <tr>
            <td align="left">CPA-6</td>
            <td align="left">base-lang</td>
            <td align="left">
              <tt>tag38-ltag</tt></td>
            <td align="left">Base language tag (see tag38)</td>
            <td align="left">RFC XXXX</td>
          </tr>
          <tr>
            <td align="left">CPA-7</td>
            <td align="left">base-rtl</td>
            <td align="left">
              <tt>tag38-direction</tt></td>
            <td align="left">Base writing direction (see tag38)</td>
            <td align="left">RFC XXXX</td>
          </tr>
        </tbody>
      </table>
      <t>The provisionally made up key numbers will then be used in an example
in the specification such as:</t>
      <figure anchor="fig-dev2">
        <name>CBOR-diag example, development form</name>
        <sourcecode type="cbor-diag"><![CDATA[
{
  / title-CPA /         -1: "title of the error",
  / detail-CPA /        -2: "detailed information about the error",
  / instance-CPA /      -3: "coaps://pd.example/FA317434",
  / response-code-CPA / -4: 128, / 4.00 /
  4711: {
     / ... /
  }
}
]]></sourcecode>
      </figure>
      <t>A "removeInRFC" note in the draft points the RFC editor to the present
document so the RFC editor knows what needs to be done at which point.
In the publication process, it is easy to remove the <tt>-CPA</tt> suffixes
and <tt>CPA</tt> prefixes for the RFC editor while filling in the actual IANA
allocated numbers and removing the note.</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document makes no requests of IANA.
However, it specifies a procedure that can be followed during draft
development that has a specific role for IANA and the interaction
between RFC editor and IANA at important points during this
development.
This procedure is intended to be as little of an onus as possible, but
that is the author's assessment only.
IANA feedback is therefore requested.</t>
    </section>
    <section anchor="security-considerations">
      <name>Security considerations</name>
      <t>The security considerations of <xref target="RFC8610"/> and <xref target="RFC8949"/> apply.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor="RFC8949">
          <front>
            <title>Concise Binary Object Representation (CBOR)</title>
            <author fullname="C. Bormann" initials="C." surname="Bormann">
              <organization/>
            </author>
            <author fullname="P. Hoffman" initials="P." surname="Hoffman">
              <organization/>
            </author>
            <date month="December" year="2020"/>
            <abstract>
              <t>The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation. These design goals make it different from earlier binary serializations such as ASN.1 and MessagePack.</t>
              <t>This document obsoletes RFC 7049, providing editorial improvements, new details, and errata fixes while keeping full compatibility with the interchange format of RFC 7049.  It does not create a new version of the format.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="94"/>
          <seriesInfo name="RFC" value="8949"/>
          <seriesInfo name="DOI" value="10.17487/RFC8949"/>
        </reference>
        <reference anchor="RFC8610">
          <front>
            <title>Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures</title>
            <author fullname="H. Birkholz" initials="H." surname="Birkholz">
              <organization/>
            </author>
            <author fullname="C. Vigano" initials="C." surname="Vigano">
              <organization/>
            </author>
            <author fullname="C. Bormann" initials="C." surname="Bormann">
              <organization/>
            </author>
            <date month="June" year="2019"/>
            <abstract>
              <t>This document proposes a notational convention to express Concise Binary Object Representation (CBOR) data structures (RFC 7049).  Its main goal is to provide an easy and unambiguous way to express structures for protocol messages and data formats that use CBOR or JSON.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8610"/>
          <seriesInfo name="DOI" value="10.17487/RFC8610"/>
        </reference>
        <reference anchor="RFC9165">
          <front>
            <title>Additional Control Operators for the Concise Data Definition Language (CDDL)</title>
            <author fullname="C. Bormann" initials="C." surname="Bormann">
              <organization/>
            </author>
            <date month="December" year="2021"/>
            <abstract>
              <t>The Concise Data Definition Language (CDDL), standardized in RFC 8610, provides "control operators" as its main language extension point.</t>
              <t>The present document defines a number of control operators that were not yet ready at the time RFC 8610 was completed: , , and  for the construction of constants; / for including ABNF (RFC 5234 and RFC 7405) in CDDL specifications; and for indicating the use of a non-basic feature in an instance.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="9165"/>
          <seriesInfo name="DOI" value="10.17487/RFC9165"/>
        </reference>
      </references>
      <references>
        <name>Informative References</name>
        <reference anchor="RFC9290">
          <front>
            <title>Concise Problem Details for Constrained Application Protocol (CoAP) APIs</title>
            <author fullname="T. Fossati" initials="T." surname="Fossati">
              <organization/>
            </author>
            <author fullname="C. Bormann" initials="C." surname="Bormann">
              <organization/>
            </author>
            <date month="October" year="2022"/>
            <abstract>
              <t>This document defines a concise "problem detail" as a way to carry machine-readable details of errors in a Representational State Transfer (REST) response to avoid the need to define new error response formats for REST APIs for constrained environments. The format is inspired by, but intended to be more concise than, the problem details for HTTP APIs defined in RFC 7807.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="9290"/>
          <seriesInfo name="DOI" value="10.17487/RFC9290"/>
        </reference>
      </references>
    </references>
    <section numbered="false" anchor="acknowledgements">
      <name>Acknowledgements</name>
      <t>This document was motivated by the AUTH48 experience for RFC 9200..RFC 9203.
Then, Jaime Jiménez made me finally write this document.
Marco Tiloca provided useful comments on an early presentation of this idea.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA7VZ63IbtxX+j6fA0DONnHIp8eKL2HFSWY4bpU3qceRpp5l0
BO6CJEa7C3aBFU3L9LPkR//0NZIX63cOsMuLZCW2J5zRaLk4AA7O5TvfAZMk
EVdjORTCG5/rsfxCSPmtKtXMlDN5+vTvL2VZFxNdOWlKeVZ6XZXaJ88qNfVO
3JNqMqk0FtiWFJlNS1VgsYzE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