<?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.7.29 (Ruby 3.4.4) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-vasters-json-structure-alternate-names-00" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.29.0 -->
  <front>
    <title>JSON Structure: Alternate Names and Descriptions</title>
    <seriesInfo name="Internet-Draft" value="draft-vasters-json-structure-alternate-names-00"/>
    <author fullname="Clemens Vasters">
      <organization>Microsoft Corporation</organization>
      <address>
        <email>clemensv@microsoft.com</email>
      </address>
    </author>
    <date year="2025" month="July" day="02"/>
    <area>Web and Internet Transport</area>
    <workgroup>Building Blocks for HTTP APIs</workgroup>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <?line 42?>

<t>This document is an extension to JSON Structure Core. It defines three
annotation keywords, <tt>altnames</tt>, <tt>altenums</tt>, and <tt>descriptions</tt>, which allow
schema authors to provide alternative identifiers, display names, and
multi-variant descriptions for types, properties, and enumeration values.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://json-structure.github.io/alternate-names/draft-vasters-json-structure-alternate-names.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-vasters-json-structure-alternate-names/"/>.
      </t>
      <t>
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/json-structure/alternate-names"/>.</t>
    </note>
  </front>
  <middle>
    <?line 50?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>This document is an extension to JSON Structure Core <xref target="JSTRUCT-CORE"/>. It
defines three annotation keywords, <tt>altnames</tt>, <tt>altenums</tt>, and <tt>descriptions</tt>,
which allow schema authors to provide alternative identifiers, display names,
and multi-variant descriptions for types, properties, and enumeration values.</t>
      <t>These annotations facilitate mapping between internal schema identifiers and
external data representations (e.g., JSON keys that do not conform to identifier
rules) and support internationalization by enabling localized labels.</t>
      <section anchor="conventions">
        <name>Conventions</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.
<?line -6?>
        </t>
      </section>
      <section anchor="keywords">
        <name>Keywords</name>
        <t>This section defines the alternate names and symbols annotations.</t>
        <section anchor="the-altnames-keyword">
          <name>The <tt>altnames</tt> Keyword</name>
          <t>The <tt>altnames</tt> keyword provides alternative names for a named type or property.
Alternate names are not subject to the identifier syntax restrictions imposed on
<tt>name</tt> and MAY be used to map internal schema names to external representations.</t>
          <t>The value of <tt>altnames</tt> MUST be a map where each key is a purpose indicator and
each value is a string representing an alternate name.</t>
          <ul spacing="normal">
            <li>
              <t>The key <tt>"json"</tt> is RESERVED. When used, it specifies the property key to use
for a property when encoded in JSON. This allows for JSON keys that do not
conform to identifier rules.</t>
            </li>
            <li>
              <t>Keys starting with the prefix <tt>"lang:"</tt> (e.g., <tt>"lang:en"</tt>, <tt>"lang:fr"</tt>) are
RESERVED for localized display names. The suffix after the colon specifies the
language code. The language code MUST conform to <xref target="RFC4646"/>.</t>
            </li>
            <li>
              <t>Other keys are allowed for custom usage, provided they do not conflict with
the reserved keys or prefixes.</t>
            </li>
          </ul>
          <t>The <tt>altnames</tt> keyword MAY be included in any schema element that has an
explicit name (i.e., named types or properties). When present, the alternate
names provide additional mappings that schema processors MAY use for encoding,
decoding, or user interface display.</t>
          <t>Example:</t>
          <sourcecode type="json"><![CDATA[
{
  "Person": {
    "type": "object",
    "altnames": {
      "json": "person_data",
      "lang:en": "Person",
      "lang:de": "Person"
    },
    "properties": {
      "firstName": {
        "type": "string",
        "altnames": {
          "json": "first_name",
          "lang:en": "First Name",
          "lang:de": "Vorname"
        }
      },
      "lastName": {
        "type": "string",
        "altnames": {
          "json": "last_name",
          "lang:en": "Last Name",
          "lang:de": "Nachname"
        }
      }
    },
    "required": ["firstName", "lastName"]
  }
}
]]></sourcecode>
        </section>
        <section anchor="the-altenums-keyword">
          <name>The <tt>altenums</tt> Keyword</name>
          <t>The <tt>altenums</tt> keyword provides alternative representations (symbols) for
enumeration values defined by a type using the <tt>enum</tt> keyword. Alternate symbols
allow schema authors to map internal enum values to external codes or localized
display symbols.</t>
          <t>The value of <tt>altenums</tt> MUST be a JSON object (map) where each key is a purpose
indicator and each corresponding value is an object mapping each enumeration
value (as defined in the <tt>enum</tt> array) to its alternate symbol.</t>
          <ul spacing="normal">
            <li>
              <t>The key <tt>"json"</tt> is RESERVED and MUST be used to specify alternate symbols for
JSON encoding.</t>
            </li>
            <li>
              <t>Keys beginning with <tt>"lang:"</tt> (e.g., <tt>"lang:en"</tt>, <tt>"lang:es"</tt>) are RESERVED
for providing localized alternate symbols.</t>
            </li>
            <li>
              <t>Additional keys are permitted for custom usage, subject to no conflicts with
reserved keys or prefixes.</t>
            </li>
          </ul>
          <t>The <tt>altenums</tt> keyword MUST be used only with schemas that include an <tt>enum</tt>
keyword. When present, it provides alternative representations for each
enumeration value that schema processors MAY use for encoding or display
purposes.</t>
          <sourcecode type="json"><![CDATA[
{
  "Color": {
    "type": "string",
    "enum": ["RED", "GREEN", "BLUE"],
    "altenums": {
      "json": {
        "RED": "#FF0000",
        "GREEN": "#00FF00",
        "BLUE": "#0000FF"
      },
      "lang:en": {
        "RED": "Red",
        "GREEN": "Green",
        "BLUE": "Blue"
      },
      "lang:de": {
        "RED": "Rot",
        "GREEN": "Grün",
        "BLUE": "Blau"
      }
    }
  }
}
]]></sourcecode>
        </section>
        <section anchor="the-descriptions-keyword">
          <name>The <tt>descriptions</tt> Keyword</name>
          <t>The <tt>descriptions</tt> keyword provides multi-variant descriptions as an alternative
to the <tt>description</tt> keyword. It allows schema authors to provide localized or
context-specific descriptions for types, properties, or enumeration values.</t>
          <t>The value of <tt>descriptions</tt> MUST be a map where each key is a purpose indicator
and each value is a string representing a description.</t>
          <ul spacing="normal">
            <li>
              <t>Keys beginning with <tt>"lang:"</tt> (e.g., <tt>"lang:en"</tt>, <tt>"lang:fr"</tt>) are RESERVED
for localized descriptions. The suffix after the colon specifies the language
code. The language code MUST conform to <xref target="RFC4646"/>.</t>
            </li>
            <li>
              <t>Other keys are allowed for custom usage, provided they do not conflict with
the reserved keys or prefixes.</t>
            </li>
          </ul>
          <t>The <tt>descriptions</tt> keyword MAY be included in any schema element that can have a
description. When present, the descriptions provide additional mappings that
schema processors MAY use for user interface display.</t>
          <t>Example:</t>
          <sourcecode type="json"><![CDATA[
{
  "Person": {
    "type": "object",
    "descriptions": {
      "lang:en": "A person object with first and last name",
      "lang:de": "Ein Person-Objekt mit Vor- und Nachnamen",
      "lang:fr": "Un objet personne avec prénom et nom de famille",
      "lang:cn": "一个带有名字和姓氏的人对象",
      "lang:jp": "名前と姓を持つ人物オブジェクト"
    },
    "properties": {
      "firstName": {
        "type": "string",
        "descriptions": {
          "lang:en": "The first name of the person",
          "lang:de": "Der Vorname der Person",
          "lang:fr": "Le prénom de la personne",
          "lang:cn": "人的名字",
          "lang:jp": "人の名前"
        }
      },
      "lastName": {
        "type": "string",
        "descriptions": {
          "lang:en": "The last name of the person",
          "lang:de": "Der Nachname der Person",
          "lang:fr": "Le nom de famille de la personne",
          "lang:cn": "人的姓氏",
          "lang:jp": "人の姓"
        }
      }
    },
    "required": ["firstName", "lastName"]
  }
}
]]></sourcecode>
        </section>
      </section>
      <section anchor="enabling-the-annotations">
        <name>Enabling the Annotations</name>
        <t>Alternate names and symbols annotations can be enabled in a schema or
meta-schema by adding the <tt>JSONSchemaAlternateNames</tt> key to the <tt>$uses</tt> clause
when referencing the extended meta-schema:</t>
        <sourcecode type="json"><![CDATA[
{
  "$schema": "https://json-structure.org/meta/extended/v0/#",
  "$id": "myschema",
  "$uses": [
    "JSONStructureAlternateNames"
  ],
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "altnames": {
        "lang:fr": "Nom"
      }
    }
  }
}
]]></sourcecode>
        <t>The annotation are enabled by default in the validation meta-schema:</t>
        <sourcecode type="json"><![CDATA[
{
  "$schema": "https://json-structure.org/meta/validation/v0/#",
  "$id": "myschema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "altnames": {
        "lang:fr": "Nom"
      }
    }
  }
}
]]></sourcecode>
      </section>
      <section anchor="security-and-interoperability-considerations">
        <name>Security and Interoperability Considerations</name>
        <t>Alternate names and symbols annotations do not affect the validation of instance
data. They are purely metadata and MUST be ignored by validators that do not
support this extension. However, applications that rely on alternate names for
mapping or localization MUST implement appropriate safeguards to ensure that the
alternate identifiers are used consistently.</t>
      </section>
      <section anchor="iana-considerations">
        <name>IANA Considerations</name>
        <t>This document has no IANA actions.</t>
      </section>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner"/>
          <date month="March" year="1997"/>
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC4646">
        <front>
          <title>Tags for Identifying Languages</title>
          <author fullname="A. Phillips" initials="A." surname="Phillips"/>
          <author fullname="M. Davis" initials="M." surname="Davis"/>
          <date month="September" year="2006"/>
          <abstract>
            <t>This document describes the structure, content, construction, and semantics of language tags for use in cases where it is desirable to indicate the language used in an information object. It also describes how to register values for use in language tags and the creation of user-defined extensions for private interchange. This document, in combination with RFC 4647, replaces RFC 3066, which replaced RFC 1766. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="4646"/>
        <seriesInfo name="DOI" value="10.17487/RFC4646"/>
      </reference>
      <reference anchor="RFC8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba"/>
          <date month="May" year="2017"/>
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
      <reference anchor="JSTRUCT-CORE" target="https://json-structure.github.io/core/draft-vasters-json-structure-core.html">
        <front>
          <title>JSON Structure Core</title>
          <author fullname="Clemens Vasters">
            <organization/>
          </author>
          <date>n.d.</date>
        </front>
      </reference>
    </references>
    <?line 298?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA9VaX2/cxhF/30+xpfJgA+JJdt2kPbRNT9I5ViJLriQnKIog
2iP37hjzyCuXlHwVFNROHhogQYsEaIGgDy1QNE2ANu2bG/Sp+SiKk36M/GZ2
ySPvTpKVOEDrB5vHnZ2Z/c3/pX3fFyKP8li3pffi3s623MuzIsiLDC86ca6z
ROVabquRNlIlodzQJsiicR6lifFEgMVBmk3a0uShEGEaJKBsyzBT/dw/VAYM
jP+6SRPflHx9VbL1idj4q6vCFL1RZAyY5pMx9m92929KuSRVbFIoFiWhHmv8
leTesvR0GOVpFqm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