<?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.39 (Ruby 3.4.9) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-vasters-json-structure-alternate-names-02" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.33.0 -->
  <front>
    <title>JSON Structure: Alternate Names and Descriptions</title>
    <seriesInfo name="Internet-Draft" value="draft-vasters-json-structure-alternate-names-02"/>
    <author fullname="Clemens Vasters">
      <organization>Microsoft Corporation</organization>
      <address>
        <email>clemensv@microsoft.com</email>
      </address>
    </author>
    <date year="2025" month="December" day="04"/>
    <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>
    <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="RFC5646"/>.</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="RFC5646"/>.</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>
  </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="RFC5646">
        <front>
          <title>Tags for Identifying Languages</title>
          <author fullname="A. Phillips" initials="A." role="editor" surname="Phillips"/>
          <author fullname="M. Davis" initials="M." role="editor" surname="Davis"/>
          <date month="September" year="2009"/>
          <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 specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="47"/>
        <seriesInfo name="RFC" value="5646"/>
        <seriesInfo name="DOI" value="10.17487/RFC5646"/>
      </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="changes-from-draft-vasters-json-structure-alternate-names-01">
      <name>Changes from draft-vasters-json-structure-alternate-names-01</name>
      <ul spacing="normal">
        <li>
          <t>Updated all RFC 4646 references to RFC 5646 (BCP 47) in the references
block, <tt>altnames</tt> section, and <tt>descriptions</tt> section.</t>
        </li>
      </ul>
    </section>
    <section numbered="false" anchor="changes-from-draft-vasters-json-structure-alternate-names-00">
      <name>Changes from draft-vasters-json-structure-alternate-names-00</name>
      <ul spacing="normal">
        <li>
          <t>Fixed section heading levels throughout the document.</t>
        </li>
      </ul>
    </section>
    <section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIA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