Skip to content

[Feedback]: Language.yaml: pattern doesn't match RFC 5646, rejects the description's own examples #698

Description

@bartvriesema

Organization

Maastricht University

Contact Details

b.vriesema@maastrichtuniversity.nl

Short description

source/schemas/Language.yaml cites RFC 4647 for this field's format:

The language used in the described entity. A string formatted according to RFC 4647

RFC 4647 is "Matching of Language Tags" - it defines how to match a language range against a tag (e.g. for HTTP Accept-Language negotiation), not the tag's own syntax. The tag-syntax standard - which this field's description actually walks through (primary subtag, region, script, variant, extension, private-use) - is RFC 5646 ("Tags for Identifying Languages", BCP 47).

The pattern itself also doesn't correctly implement RFC 5646 §2.1's grammar for langtag:

langtag = language ["-" script] ["-" region] *("-" variant) *("-" extension) ["-" privateuse]

Comparing field by field:

RFC 5646 Current pattern Problem
Order: language → script → region → variant* → extension* → privateuse Checks the region-shaped group before the script-shaped group Swapped - this alone is why zh-Hant-TW fails
script = 4ALPHA, canonically Title Case (Hant, Latn) Requires [a-z]{4} - all-lowercase only Rejects any canonically-cased script subtag
variant = 5*8alphanum | DIGIT 3alphanum (e.g. valencia, 1996, fonipa) (-([a-z]{2}|[0-9]{3}))* - 2 letters or 3 digits Doesn't match any real registered variant
extension = singleton 1*("-" 2*8alphanum) - a 1-char singleton, then subtags (-[a-z0-9]{2,8})* - no singleton, minimum 2 chars Can't represent a real extension tag at all

Reproduction: the description field explicitly gives these as valid examples, but the pattern rejects all three:

  • zh-Hant-TW (defect 1 + 2: wrong order, wrong case)
  • nl-sgn-NL (defect 1 + 2)
  • nl-s-NL (defect 1 + 2)

Use case: any implementation that validates a write request against this pattern (rather than just documenting it) rejects legitimate, common language tags like Traditional Chinese (zh-Hant-TW) or the sign-language forms the description itself recommends.

Suggested fix: correct the citation to RFC 5646, and replace pattern with one built directly from its ABNF grammar, e.g.:

^(?:(?:[a-zA-Z]{2,3}(?:-[a-zA-Z]{3}){0,2}|[a-zA-Z]{4}|[a-zA-Z]{5,8})(?:-[a-zA-Z]{4})?(?:-(?:[a-zA-Z]{2}|[0-9]{3}))?(?:-(?:[a-zA-Z0-9]{5,8}|[0-9][a-zA-Z0-9]{3}))(?:-0-9A-WY-Za-wy-z (?:-[a-zA-Z0-9]{2,8})+)(?:-x(?:-[a-zA-Z0-9]{1,8})+)?|x(?:-[a-zA-Z0-9]{1,8})+)$

Related issues

No response

Version

v6.0

Follow-up invitation

Yes

Your uses case(s)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: feedbackFeedback for the upcoming OOAPI release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions