Movatterモバイル変換


[0]ホーム

URL:


RFC 9290CoRE Problem DetailsOctober 2022
Fossati & BormannStandards Track[Page]
Stream:
Internet Engineering Task Force (IETF)
RFC:
9290
Category:
Standards Track
Published:
ISSN:
2070-1721
Authors:
T. Fossati
Arm Limited
C. Bormann
Universität Bremen TZI

RFC 9290

Concise Problem Details for Constrained Application Protocol (CoAP) APIs

Abstract

This document defines a concise "problem detail" as a way to carrymachine-readable details of errors in a Representational State Transfer (REST) response to avoid theneed to define new error response formats for REST APIs forconstrained environments.The formatis inspired by, but intended to be more concise than, the problemdetails for HTTP APIs defined in RFC 7807.

Status of This Memo

This is an Internet Standards Track document.

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained athttps://www.rfc-editor.org/info/rfc9290.

Copyright Notice

Copyright (c) 2022 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.

Table of Contents

1.Introduction

REST response status information such as Constrained Application Protocol (CoAP) responsecodes (Section 5.9 of [RFC7252]) is sometimes not sufficient to convey enough information aboutan error to be helpful. This specification defines a simple and extensibleframework to define Concise Binary Object Representation (CBOR)[STD94] data items to suit this purpose.This framework is designed to be reused by REST APIs, which can identify distinct"shapes" of these data items specific to their needs.Thus, API clients can be informed of both the high-level error class(using the response code) and the finer-grained details of the problem(using the vocabulary defined here). This pattern of communication is illustrated inFigure 1.

CoAPCoAPClientServerRequest(failure)ErrorResponsewithaCBORdataitemgivingProblemDetails
Figure 1:Problem Details: Example with CoAP

The framework presented is largely inspired by the problem details for HTTP APIs defined in[RFC7807].Appendix B discusses applications where interworking with[RFC7807] is required.

1.1.Terminology and Requirements Language

The terminology from[RFC7252],[STD94], and[RFC8610] applies; in particular, CBORdiagnostic notation is defined in Section8 of RFC 8949[STD94] andAppendix G of [RFC8610].Readers are also expected to be familiar with the terminology from[RFC7807].

In this document, the structure of data is specified in Concise Data Definition Language (CDDL)[RFC8610][RFC9165].

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[RFC2119][RFC8174] when, and only when, they appear in all capitals, as shown here.

2.Basic Problem Details

A Concise Problem Details data item is a CBOR data item with the followingstructure (rules named starting withtag38 are defined inAppendix A):

problem-details = non-empty<{  ? &(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  standard-problem-detail-entries  custom-problem-detail-entries}>standard-problem-detail-entries = (  * nint => any)custom-problem-detail-entries = (  * (uint/~uri) => { + any => any })non-empty<M> = (M) .and ({ + any => any })oltext = text / tag38
Figure 2:Structure of Concise Problem Details Data Item

(Examples of elaborated Concise Problem Details data items canbe found later in the document, e.g.,Figure 3.)

A number of problem detail entries, the Standard Problem Detailentries, are predefined (more predefined details can be registered,seeSection 3.1).

Note that, unlike[RFC7807], Concise Problem Details data items haveno explicit "problem type".Instead, the category (or, one could say, Gestalt) of the problem canbe understood from the shape of the problem details offered. We talk ofa "problem shape" for short.

The title (key -1):

A short, human-readable summary of the problem shape.Beyond the shape of the problem, it is not intended to summarize allthe specific information given with the problem details.For instance, the summary might include that an account does nothave enough money for a transaction to succeed but not the detailedinformation such as the account number, how much money that accounthas, and how much would be needed.

The detail (key -2):

A human-readable explanation specific to this occurrence of the problem.

The instance (key -3):

A URI reference that identifies the specific occurrence of the problem.It may or may not yield further information if dereferenced.

The response-code (key -4):

The CoAP response code (Sections5.9 and12.1.2 of[RFC7252]) generated by the originserver for this occurrence of the problem.

The base-uri (key -5):

The base URI (see Section5.1 of RFC 3986[STD66]) that should be used to resolverelative URI references embedded in this Concise Problem Detailsdata item.

The base-lang (key -6):

The language-tag (tag38-ltag) that applies to the presentation ofunadorned text strings (not using tag 38) in this Concise ProblemDetails data item; seeAppendix A.

The base-rtl (key -7):

The writing-direction (tag38-direction) that applies to thepresentation of unadorned text strings (not using tag 38) in thisConcise Problem Details data item; seeAppendix A.

Both "title" and "detail" can use either an unadorned CBOR text string(text) or a language-tagged text string (tag38); seeAppendix A forthe definition of the latter.Language tag and writing direction information for unadorned textstrings is intended to be obtained from context; if that contextneeds to be saved or forwarded with a Concise Problem Details dataitem, "base-lang" and "base-rtl" can be used.If no such (explicitly saved or implicit) context information isavailable, unadorned text is interpreted with language-tag "en" andwriting-direction "false" (ltr).

The "title" string is advisory and included to giveconsumers a shorthand for the category (problem shape) of the error encountered.

The "detail" member, if present, ought to focus on helping the clientcorrect the problem rather than giving extensive server-sidedebugging information.ConsumersSHOULD NOT parse the "detail" member for information;extensions (seeSection 3) are more suitable and lesserror-prone ways to obtain such information.Note that the "instance" URI reference may be relative; this meansthat it must be resolved relative to the representation's base URI, asper Section5 of RFC 3986[STD66].

The "response-code" member, if present, is only advisory; it conveysthe CoAP response code used for the convenience of the consumer.GeneratorsMUST use the same response code here as in the actual CoAPresponse; the latter is needed to assure that generic CoAP software thatdoes not understand the problem-details format still behavescorrectly.Consumers can use the "response-code" member to determine what theoriginal response code used by the generator was, in cases where ithas been changed (e.g., by an intermediary or cache), and when messagebodies persist without CoAP information (e.g., in an events log or analyticsdatabase).Generic CoAP software will still use the CoAP response code.To support the use case of message-body persistence without support bythe problem-details generator, the entity that persists the ConciseProblem Details data item can copy over the CoAP response codethat it received on the CoAP level.Note that the "response-code" value is a numeric representation of theactual code (seeSection 3 of [RFC7252]), so it does not take the usualpresentation form that resembles anHTTP status code:4.04 Not Found is represented by the number 132.

The "base-uri" member is usually not present in the initialrequest-response communication as it can be inferred as per Section5.1.3 of RFC 3986[STD66].An entity that stores a Concise Problem Details data item or otherwisemakes it available for consumers without this context might add in a"base-uri" member to allow those consumers to perform resolution of anyrelative URI references embedded in the data item.

3.Extending Concise Problem Details

This specification defines a generic problem-details container with only aminimal set of attributes to make it usable.

It is expected that applications will extend the base format by defining newattributes.

These new attributes fall into two categories: generic and applicationspecific.

Generic attributes will be allocated in thestandard-problem-detail-entriesslot according to the registration procedure defined inSection 3.1.

Application-specific attributes will be allocated in thecustom-problem-detail-entries slot according to the procedure described inSection 3.2.

Consumers of a Concise Problem Details data itemMUST ignore anyStandard Problem Detail entries or Custom Problem Detail entries, or keys inside the CustomProblem Detail entries, that they do not recognize ("ignore-unknownrule"); this allows problem details to evolve. When storing the data item for future use or forwarding it to otherconsumers, it is stronglyRECOMMENDED to retain the unrecognizedentries; exceptions might be when storage or forwarding occurs in adifferent format/protocol that cannot accommodate them or when thestorage or forwarding function needs to filter out privacy-sensitiveinformation and for that needs to assume unrecognized entries might beprivacy-sensitive.

3.1.Standard Problem Detail Entries

Beyond the Standard Problem Detail keys defined inFigure 2, additionalStandard Problem Detail keys can be registered for use in thestandard-problem-detail-entries slot (seeSection 6.1).

Standard Problem Detail keys are negative integers, so they can neverconflict with Custom Problem Detail keys defined for a specificapplication domain(which are unsigned integers or URIs.)

In summary, the keys for Standard Problem Detail entries are in aglobal namespace that is not specific to a particular application domain.

3.1.1.Standard Problem Detail Entry: Unprocessed CoAP Option

Section 2 provides a number of generally applicable Standard ProblemDetail entries. The present section both registers another usefulStandard Problem Detail entry and serves as an example of a StandardProblem Detail Entry registration, in the registration template formatthat would be ready for registration.

Key value:

-8

Name:

unprocessed-coap-option

CDDL type:

one-or-more<uint>, where

one-or-more<T> = T / [ 2* T ]
Brief description:

Option number(s) of CoAP option(s) that were not understood

Specification reference:

Section 3.1.1 of RFC 9290

The specification of the Standard Problem Detail entry referenced bythe above registration template follows:

The Standard Problem Detail entryunprocessed-coap-option providesthe option number or numbers of any CoAP options present in the request thatcould not be processed by the server.

This may be a critical option that the server is unaware of, or anoption the server is aware of but could not process (and chose notto, or was not allowed to, ignore it).

The Concise Problem Details data item including this StandardProblem Detail Entry can be used in fulfillment of the "SHOULD"requirement inSection 5.4.1 of [RFC7252].

Several option numbers may be given in a list (in no particular order),without any guarantee that the list is a complete representation ofall the problems in the request (as the server mighthave stopped processing already at one of the problematic options).If an option with the given number was repeated, there is noindication which of the values caused the error.

Clients need to expect to see options in the list that they did not sendin the request; this can happen if the request traversed a proxythat added the option but did not act on the problem-detailsresponse being returned by the origin server.

For a few special values of unprocessed CoAPoptions (such as Accept or Proxy-Uri), note that there are special responsecodes (4.06 Not Acceptable, 5.05 Proxying Not Supported,respectively) to be sent instead of 4.02 Bad Option.

3.2.Custom Problem Detail Entries

Applications may extend the Concise Problem Details data item withadditional entries to convey additional, application-specific information.

Such new entries are allocated in thecustom-problem-detail-entries slot andcarry a nested map specific to that application. The map key can be eitheran (absolute!) URI (under control of the entity defining this extension)or an unsigned integer.Only the latter needs to be registered (Section 6.2).

Within the nested map, any number of attributes can be given for asingle extension.The semantics of each custom attributeMUST be described in thedocumentation for the extension; for extensions that are registered(i.e., are identified by an unsigned int), that documentation goesalong with the registration.

The unsigned integer form allows a more compact representation.Inexchange, authors are expected to comply with the requiredregistration and documentation process.In comparison, the URI form is less space efficient but requires noregistration. Therefore, it is useful for experimenting during the developmentcycle and for applications deployed in environments where producers andconsumers of Concise Problem Details are more tightly integrated.(Thus, the URI form covers the potential need we might otherwise have for a "Private Use" range for the unsigned integers.)

Note that the URI given for the extension is for identificationpurposes only and, even if dereferenceable in principle, itMUST NOT bedereferenced in the normal course of handling problem details (i.e., outsidediagnostic or debugging procedures involving humans).

Figure 3 shows an example (in CBOR diagnostic notation)of a custom extension using a (made-up) URI as thecustom-problem-detail-entries key.

{  / 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 /  "tag:3gpp.org,2022-03:TS29112": {    / cause /  0: "machine-readable error cause",    / invalidParams / 1: [      [        / param / "first parameter name",        / reason / "must be a positive integer"      ],      [        / param / "second parameter name"      ]    ],    / supportedFeatures / 2: "d34db33f"  }}
Figure 3:Example Extension with URI Key

Obviously, a Standards Development Organization (SDO) like 3GPP can also easily register such a CustomProblem Detail entry to receive a more efficient unsigned integer key;Figure 4 shows howthe same example would look using a (made-up) registered unsigned int as thecustom-problem-detail-entries key:

{  / 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 is made-up example key that is not actually registered:/  4711: {    / cause /  0: "machine-readable error cause",    / invalidParams / 1: [      [        / param / "first parameter name",        / reason / "must be a positive integer"      ],      [        / param / "second parameter name"      ]    ],    / supportedFeatures / 2: "d34db33f"  }}
Figure 4:Example Extension with Unsigned Int (Registered) Key

In summary, the keys for the maps used inside Custom Problem Detailentries are defined specifically for use with the identifier of that CustomProblem Detail entry, the documentation of which defines theseinternal entries, typically chosen to address a given applicationdomain.

When there is a need to evolve a Custom Problem Detail entry definition, the"ignore-unknown rule" discussed inSection 3 provides an easy way to include additional information.The assumption is that this is done in a backward- and forward-compatible way.Sometimes, Custom Problem Detail entries may need to evolve in a way whereforward compatibility by applying the "ignore-unknown rule" would notbe appropriate: for example, when adding a "must-understand" member,which can onlybe ignored at the peril of misunderstanding the Concise ProblemDetails data item ("false interoperability").In this case, a new Custom Problem Detail key can simply beregistered for this case, keeping the old key backward andforward compatible.

4.Privacy Considerations

Problem details may unintentionally disclose information.This can lead to both privacy and security problems.SeeSection 5 for more details that apply to both domains; particularattention needs to be given to unintentionally disclosing PersonallyIdentifiable Information (PII).

5.Security Considerations

Concise Problem Details can contain URIs that are not intended to bedereferenced (Section 3.2, Paragraph 5). One reason is that dereferencingthese can lead to information disclosure (tracking).Information disclosure can also be caused by URIs in problem detailsthatare intended for dereferencing, e.g., the "instance" URI.Implementations need to consider which component of a client shouldperform the dereferencing and which servers are trusted with servingthem.In any case, the security considerations of Section7 of RFC 3986[STD66] apply.

The security and privacy considerations outlined inSection 5 of [RFC7807] apply in full.While these are phrased in terms of security considerations for new RFC 7807 problem types, they equally apply to the problem detailentry definitions used here (Section 3). In summary, bothwhen defining new detail entries and when actually using them to generate aConcise Problem Details data item, care needs to be taken that they donot leak sensitive information.Entities storing or forwarding Concise Problem Details data items needto consider whether this leads to information being transferred out ofthe context within which access to sensitive information was acceptable.See alsoSection 3, Paragraph 6 (the last paragraph of the introduction tothat section).Privacy-sensitive information in the problem detailsSHOULD NOT be obscured in ways that might lead to misclassification asnon-sensitive (e.g., by base64-encoding).

6.IANA Considerations

6.1.Standard Problem Detail Keys Registry

This specification defines a new subregistry titled "Standard ProblemDetail Keys" in the "Constrained RESTful Environments (CoRE) Parameters" registry[IANA.core-parameters],with "Specification Required" as the Registration Procedure (Section 4.6 of [RFC8126]).

Each entry in the registry must include:

Key Value:

a negative integer to be used as the value of the key

Name:

a name that could be used in implementations for the key

CDDL Type:

type of the data associated with the key in CDDL notation

Brief Description:

a brief description

Reference:

a reference document

Change Controller:

(seeSection 2.3 of [RFC8126])

The designated expert is requested to assign the shortest key values (1+0 and1+1 encoding) to registrations that are likely to enjoy wide use andcan benefit from short encodings.

To be immediately useful in CDDL and programming-language contexts, aname consists of a lowercase ASCII letter (a-z) and zero or moreadditional ASCII characters that are either lowercase letters,digits, or a hyphen-minus, i.e., it matches[a-z][-a-z0-9]*.As with the key values, names need to be unique.

The specification in the reference document needs to provide adescription of the Standard Problem Detail entry, replicating the CDDLdescription in "CDDL Type", and describing the semantics of thepresence of this entry and the semantics of the value given with it.

Initial entries in this subregistry are as follows:

Table 1:Initial Entries in the Standard Problem Detail Keys Registry
Key ValueNameCDDL TypeBrief DescriptionReferenceChange Controller
-1titletext / tag38Short, human-readable summary of the problem shapeRFC 9290IETF
-2detailtext / tag38Human-readable explanation specific to this occurrence of the problemRFC 9290IETF
-3instance~uriURI reference identifying specific occurrence of the problemRFC 9290IETF
-4response-codeuint .size 1CoAP response codeRFC 9290IETF
-5base-uri~uriBase URIRFC 9290IETF
-6base-langtag38-ltagBase language tag (seeAppendix A)RFC 9290IETF
-7base-rtltag38-directionBase writing direction (seeAppendix A)RFC 9290IETF
-8unprocessed-coap-optionone-or-more<uint>Option number(s) of CoAP option(s) that were not understoodRFC 9290,Section 3.1.1IETF

6.2.Custom Problem Detail Keys Registry

This specification defines a new subregistry titled "Custom ProblemDetail Keys" in the "Constrained RESTful Environments (CoRE) Parameters" registry[IANA.core-parameters], with as "Expert Review" as the Registration Procedure (Section 4.5 of [RFC8126]).

The designated expert is instructed to attempt making the registration experienceas close to First Come First Served as reasonably achievable, butchecking that the reference document does provide a description as setout below.(This requirement is a relaxed version of "Specification Required" asdefined inSection 4.6 of [RFC8126].)

Each entry in the registry must include:

Key Value:

an unsigned integer to be used as the value of the key

Name:

a name that could be used in implementations for the key

Brief Description:

a brief description

Reference:

a reference document that provides a description of the map,including a CDDL description, that describes all inside keys andvalues

Change Controller

(seeSection 2.3 of [RFC8126])

The designated expert is requested to assign the shortest key values (1+0 and1+1 encoding) to registrations that are likely to enjoy wide use andcan benefit from short encodings.

To be immediately useful in CDDL and programming-language contexts, aname consists of a lowercase ASCII letter (a-z) and zero or moreadditional ASCII characters that are either lowercase letters,digits, or a hyphen-minus, i.e., it matches[a-z][-a-z0-9]*.As with the key values, names need to be unique.

Initial entries in this subregistry are as follows:

Table 2:Initial Entries in the Custom Problem Detail Key Registry
Key ValueNameBrief DescriptionReferenceChange Controller
7807tunnel-7807Carry RFC 7807 problem details in a Concise Problem Details data itemRFC 9290,Appendix BIETF

6.3.Media Type

IANA has added the following media type to the "Media Types"registry[IANA.media-types].

Table 3:New Media Type 'application/concise-problem-details+cbor'
NameTemplateReference
concise-problem-details+cborapplication/concise-problem-details+cborRFC 9290,Section 6.3
Type name:

application

Subtype name:

concise-problem-details+cbor

Required parameters:

N/A

Optional parameters:

N/A

Encoding considerations:

binary (CBOR data item)

Security considerations:

Section 5 of RFC 9290

Interoperability considerations:

none

Published specification:

Section 6.3 of RFC 9290

Applications that use this media type:

Clients and servers in the Internet of Things

Fragment identifier considerations:

The syntax and semantics of fragment identifiers is as specified for"application/cbor". (At publication of RFC 9290, there is nofragment identification syntax defined for "application/cbor".)

Additional information:


Deprecated alias names for this type:
N/A
Magic number(s):
N/A
File extension(s):
N/A
Macintosh file type code(s):
N/A
Person & email address to contact for further information:

CoRE WG mailing list (core@ietf.org)or IETF Applications and Real-Time Area (art@ietf.org)

Intended usage:

COMMON

Restrictions on usage:

none

Author/Change controller:

IETF

Provisional registration:

no

6.4.Content-Format

IANA has registered a Content-Format number in the"CoAP Content-Formats"subregistry, within the "Constrained RESTful Environments (CoRE)Parameters" registry[IANA.core-parameters], as follows:

Table 4:Content-Format Registration
Media TypeEncodingIDReference
application/concise-problem-details+cbor-257RFC 9290

6.5.CBOR Tag 38

In the registry "CBOR Tags"[IANA.cbor-tags], IANA has registered CBOR tag 38. IANA has updated the reference for CBOR tag 38 to point to RFC 9290,Appendix A.

7.References

7.1.Normative References

[IANA.cbor-tags]
IANA,"Concise Binary Object Representation (CBOR) Tags",<https://www.iana.org/assignments/cbor-tags>.
[IANA.core-parameters]
IANA,"Constrained RESTful Environments (CoRE) Parameters",<https://www.iana.org/assignments/core-parameters>.
[IANA.media-types]
IANA,"Provisional Standard Media Type Registry",<https://www.iana.org/assignments/provisional-standard-media-types>.
[RFC2119]
Bradner, S.,"Key words for use in RFCs to Indicate Requirement Levels",BCP 14,RFC 2119,DOI 10.17487/RFC2119,,<https://www.rfc-editor.org/info/rfc2119>.
[RFC4647]
Phillips, A., Ed. andM. Davis, Ed.,"Matching of Language Tags",BCP 47,RFC 4647,DOI 10.17487/RFC4647,,<https://www.rfc-editor.org/info/rfc4647>.
[RFC5646]
Phillips, A., Ed. andM. Davis, Ed.,"Tags for Identifying Languages",BCP 47,RFC 5646,DOI 10.17487/RFC5646,,<https://www.rfc-editor.org/info/rfc5646>.
[RFC7252]
Shelby, Z.,Hartke, K., andC. Bormann,"The Constrained Application Protocol (CoAP)",RFC 7252,DOI 10.17487/RFC7252,,<https://www.rfc-editor.org/info/rfc7252>.
[RFC7807]
Nottingham, M. andE. Wilde,"Problem Details for HTTP APIs",RFC 7807,DOI 10.17487/RFC7807,,<https://www.rfc-editor.org/info/rfc7807>.
[RFC8126]
Cotton, M.,Leiba, B., andT. Narten,"Guidelines for Writing an IANA Considerations Section in RFCs",BCP 26,RFC 8126,DOI 10.17487/RFC8126,,<https://www.rfc-editor.org/info/rfc8126>.
[RFC8174]
Leiba, B.,"Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words",BCP 14,RFC 8174,DOI 10.17487/RFC8174,,<https://www.rfc-editor.org/info/rfc8174>.
[RFC8610]
Birkholz, H.,Vigano, C., andC. Bormann,"Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures",RFC 8610,DOI 10.17487/RFC8610,,<https://www.rfc-editor.org/info/rfc8610>.
[RFC9165]
Bormann, C.,"Additional Control Operators for the Concise Data Definition Language (CDDL)",RFC 9165,DOI 10.17487/RFC9165,,<https://www.rfc-editor.org/info/rfc9165>.
[STD66]
Berners-Lee, T.,Fielding, R., andL. Masinter,"Uniform Resource Identifier (URI): Generic Syntax",STD 66,RFC 3986,.
<https://www.rfc-editor.org/info/std66>
[STD94]
Bormann, C. andP. Hoffman,"Concise Binary Object Representation (CBOR)",STD 94,RFC 8949,.
<https://www.rfc-editor.org/info/std94>

7.2.Informative References

[HTTPAPI]
Nottingham, M.,Wilde, E., andS. Dalal,"Problem Details for HTTP APIs",Work in Progress,Internet-Draft, draft-ietf-httpapi-rfc7807bis-04,,<https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-rfc7807bis-04>.
[RDF]
Cyganiak, R.,Wood, D., andM. Lanthaler,"RDF 1.1 Concepts and Abstract Syntax",W3C Recommendation,,<http://www.w3.org/TR/2014/REC-rdf11-concepts-20140225/>.
[RFC4648]
Josefsson, S.,"The Base16, Base32, and Base64 Data Encodings",RFC 4648,DOI 10.17487/RFC4648,,<https://www.rfc-editor.org/info/rfc4648>.
[RFC6082]
Whistler, K.,Adams, G.,Duerst, M.,Presuhn, R., Ed., andJ. Klensin,"Deprecating Unicode Language Tag Characters: RFC 2482 is Historic",RFC 6082,DOI 10.17487/RFC6082,,<https://www.rfc-editor.org/info/rfc6082>.
[Unicode-14.0.0]
The Unicode Consortium,"The Unicode Standard, Version 14.0.0",Mountain View: The Unicode Consortium,ISBN 978-1-936213-29-0,,<https://www.unicode.org/versions/Unicode14.0.0/>.
[Unicode-14.0.0-bidi]
The Unicode Consortium,"Unicode Standard Annex #9 --- Unicode Bidirectional Algorithm",,<https://www.unicode.org/reports/tr9/#Markup_And_Formatting>.

Appendix A.Language-Tagged Strings

This appendix serves as the archival documentation for CBOR tag 38, atag for serializing language-tagged text strings in CBOR.The text of this appendix is adapted from the specification textsupplied for its initial registration.It has been extended to allow supplementing the language tag by adirection indication.

As with any IANA-registered item, a specification that further updates thisregistration needs to update the reference column of the IANA registry (seeSection 6.5).Future specifications may update this appendix, other parts of this document,or both.(When updating this appendix, keep in mind that applications beyondConcise Problem Details data items may adopt the tag defined here.)Users of this tag are advised to consult the registry to obtain themost recent update for this appendix.

A.1.Introduction

In some cases, it is useful to specify the natural language of a textstring. This specification defines a tag that does just that. Onetechnology that supports language-tagged strings is the ResourceDescription Framework (RDF)[RDF].

A.2.Detailed Semantics

A language-tagged text string in CBOR has the tag 38 and consists of an arraywith a length of 2 or 3.

The first element is a well-formed language tag described in BCP 47 ([RFC5646] and[RFC4647]), represented as a UTF-8 textstring (major type 3).

The second element is an arbitrary UTF-8 text string (major type3). Both the language tag and the arbitrary string can optionally beannotated with CBOR tags; this is not shown in the CDDL below.

The optional third element, if present, represents a ternary value thatindicates a direction, as follows:

  • false: left-to-right direction ("ltr").The text is expected to be displayed with left-to-right basedirection if standalone and isolated with left-to-right direction(as if enclosed in LRI ... PDI or equivalent, see[Unicode-14.0.0-bidi]) in thecontext of a longer string or text.
  • true: right-to-left direction ("rtl").The text is expected to be displayed with right-to-left basedirection if standalone and isolated with right-to-left direction(as if enclosed in RLI ... PDI or equivalent, see[Unicode-14.0.0-bidi]) in the contextof a longer string or text.
  • null: indicates that no indication is made about the direction("auto"), enabling an internationalization library to make an auto-detectiondecision such as treating the string as if enclosed in FSI ... PDIor equivalent, see[Unicode-14.0.0-bidi].

If the third element is absent, directionality context may be applied(e.g., base-directionality information for an entire CBOR message orpart thereof). If there is no directionality context applied, thedefault interpretation is the same as fornull ("auto").

In CDDL:

tag38 = #6.38([tag38-ltag, text, ?tag38-direction])tag38-ltag = text .regexp "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"tag38-direction = &(ltr: false, rtl: true, auto: null)

NOTE: Language tags of any combination of case are allowed. ButSection 2.1.1 of [RFC5646], part of BCP 47,recommends a case combination for language tags that encoders thatsupport tag 38 may wish to follow when generating language tags.

Data items with tag 38 that do not meet the criteria above are not valid(see Section5.3.2 of RFC 8949[STD94]).

NOTE: The Unicode Standard[Unicode-14.0.0] includes a set of charactersdesigned for tagging text (including language tagging) in the rangeU+E0000 to U+E007F. Although many applications, including RDF,do not disallow these characters in text strings, the Unicode Consortiumhas deprecated these characters and recommends annotating language via ahigher-level protocol instead. See the section "Deprecated TagCharacters" in Section 23.9 of[Unicode-14.0.0] as well as[RFC6082].

NOTE: while this document references a version of Unicode that was recent at the time of writing, the statements made based on this version are expected to remain valid for future versions.

A.3.Examples

Examples in this section are given in CBOR diagnostic notation first and thenas a pretty-printed hexadecimal representation of the encoded item.

The following example shows how the English-language string "Hello" isrepresented.

38(["en", "Hello"])
D8 26               # tag(38)   82               # array(2)      62            # text(2)         656E       # "en"      65            # text(5)         48656C6C6F # "Hello"

The following example shows how the French-language string "Bonjour" isrepresented.

38(["fr", "Bonjour"])
D8 26                   # tag(38)   82                   # array(2)      62                # text(2)         6672           # "fr"      67                # text(7)         426F6E6A6F7572 # "Bonjour"

The following example uses right-to-left (RTL) script, which in the context of this specification may be rendered differently by different document presentation environments. The descriptive text may be more reliable to follow than the necessarily device- and application-specific rendering.The example shows how the Hebrew-language string

שלום

is represented, where in direction of reading, the sequence of characters is:"ש" (HEBREW LETTER SHIN, U+05E9),"ל" (HEBREW LETTER LAMED, U+05DC),"ו" (HEBREW LETTER VAV, U+05D5),"ם" (HEBREW LETTER FINAL MEM, U+05DD).Note thertl direction expressed by setting the third element in the array to "true".

38(["he", "שלום", true])
D8 26                     # tag(38)   83                     # array(3)      62                  # text(2)         6865             # "he"      68                  # text(8)         D7A9D79CD795D79D # "שלום"      F5                  # primitive(21)

Appendix B.Interworking with RFC 7807

On certain occasions, it will be necessary to carry ("tunnel")[RFC7807] problem details in a Concise Problem Details data item.

This appendix defines a Custom Problem Detail entry for that purpose.This is assigned Custom Problem Detail key 7807 inSection 6.2.Its structure is:

tunnel-7807 = {  ? &(type: 0) => ~uri  ? &(status: 1) => 0..999  * text => any}

To carry an[RFC7807] problem details JSON object in a Concise ProblemDetails data item, first convert the JSON object to CBOR as per Section6.2 of RFC 8949[STD94]. Create an empty Concise Problem Details data item.

Move the values for "title", "detail", and "instance", if present,from the[RFC7807] problem details to the equivalent Standard ProblemDetail entries.Create a Custom Problem Detail entry with key 7807.Move the values for "type" and "status", if present, to the equivalentkeys 0 and 1 of the Custom Problem Detail entry.Move all remaining key/value pairs (additional members as perSection 3.2 of [RFC7807]) in the converted[RFC7807] problemdetails object to the Custom Problem Detail map unchanged.

The inverse direction, carrying Concise Problem Details in an RFC 7807 problemdetails JSON object requires the additional support provided by[HTTPAPI], which is planned to create the HTTP Problem TypesRegistry. An HTTP Problem Type can then be registered that extractstop-level items from the Concise Problem Details data item in a similar wayto the conversion described above and that carries the rest of theConcise Problem Details data item in an additional member via base64urlencoding without padding (Section 5 of [RFC4648]). Details can be definedin a separate document when the work on[HTTPAPI] is completed.

Acknowledgments

The authors would like to thankMark Nottingham andErik Wilde, the authors of RFC 7807;Klaus Hartke andJaime Jiménez, the coauthors of an earlier draft version of thisspecification;Christian Amsüss,Marco Tiloca,Ari Keränen,andMichael Richardson for review and comments on this document.Francesca Palombini for her review (and support) as responsible AD,andJoel Jaeggli for his OPSDIR review, both of which broughtsignificant additional considerations to this document.

ForAppendix A,John Cowan andDoug Ewell are also to be acknowledged.The content of an earlier draft version of this appendix was also discussedin the "apps-discuss@ietf.org" and "ltru@ietf.org" mailinglists.More recently, the authors initiated a discussion about the handlingof writing direction information in conjunction with language tags.That led to discussions within the W3C Internationalization CoreWorking Group.The authors would like to acknowledge that cross-organizationcooperation and particular contributions fromJohn Klensin andAddison Phillips and specific text proposals byMartin Dürst.

Contributors

Peter Occil
Email:poccil14@gmail.com
URI:http://peteroupc.github.io/CBOR/

Peter defined CBOR tag 38, basis ofAppendix A.

Christian Amsüss
Email:christian@amsuess.com

Christian contributed what becameSection 3.1.1.

Authors' Addresses

Thomas Fossati
Arm Limited
Email:thomas.fossati@arm.com
Carsten Bormann
Universität Bremen TZI
Postfach 330440
D-28359Bremen
Germany
Phone:+49-421-218-63921
Email:cabo@tzi.org

[8]ページ先頭

©2009-2025 Movatter.jp