Skip to content

docs: clarify that knownValues is an open vocabulary - #213

Merged
s-adamantine merged 1 commit into
mainfrom
docs/clarify-known-values-open-vocabulary
May 18, 2026
Merged

docs: clarify that knownValues is an open vocabulary#213
s-adamantine merged 1 commit into
mainfrom
docs/clarify-known-values-open-vocabulary

Conversation

@s-adamantine

@s-adamantine s-adamantine commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Documents one of the lexicon's quieter conventions: knownValues is an open vocabulary, not a closed enum. Lexicon validators do not reject values outside the list, and several lexicons in this repo already document that explicitly (collection#type, attachment#contentType, badge.definition#badgeType all say "Values beyond the known set are permitted"), but the rest don't — and there's no top-level explanation of the convention anywhere. This makes it easy for implementers to read a knownValues list as a closed registry, either rejecting otherwise-valid records on the producer side or treating a custom value as a bug on the consumer side.

This PR is documentation-only — no schema or type changes.

Changes

README.md — new "Schema Conventions" section

Added after the Lexicon Reference table. Two subsections:

  1. knownValues is an open vocabulary, not a closed enum. Spells out that custom values are wire-valid, contrasts with enum (which the validator does enforce), and gives practical guidance: prefer a known entry when one matches, custom is fine when none do, but consumers that bucket by the canonical list will treat custom values as "other". Uses locationType: "geojson-polygon" as a concrete example (valid record, but a Location Protocol registry consumer won't recognize it — use geojson for canonical bucketing).
  2. strongRef pins to a specific record version. Brief note that the CID inside a strongRef provides snapshot-at-time-of-reference semantics. This is here because the most common mistake people make when they don't internalize this is to embed full records by value to 'snapshot' them — strongRef + CID already does that, and several fields in this repo are typed that way for exactly that reason (badge.award.badge, badge.response.badgeAward, funding.receipt.for).

Inline lexicon descriptions

Brought three knownValues field descriptions in line with the existing pattern on collection#type / attachment#contentType / badge.definition#badgeType:

  • app.certified.location#locationType — adds the open-vocabulary disclaimer, AND explicitly directs implementers to use the catch-all geojson entry for non-Point GeoJSON (Polygon, MultiPolygon, FeatureCollection) rather than inventing typed variants like geojson-polygon. The inner GeoJSON payload's own type field carries the specifics.
  • org.hypercerts.workscope.tag#category — adds the disclaimer.
  • org.hypercerts.workscope.tag#status — adds the disclaimer.

STRING_CONSTRAINTS.md — split a misleading bullet

The "When to use neither" section had a single bullet conflating knownValues and enum:

knownValues/enum fields do not need length constraints; the allowed values are already defined.

That's correct for enum (closed, validator-enforced, allowed values are fully defined) but wrong for knownValues (open, custom values still need maxLength to bound size). Split into two bullets making the distinction explicit.

SCHEMAS.md

Auto-regenerated via npm run gen-schemas-md. Only the rows whose JSON descriptions changed are affected.

What I intentionally did not change

A few knownValues fields whose descriptions could also get the disclaimer for consistency, but where the semantics are tighter and adding the disclaimer might mislead implementers in the other direction:

  • badge.response#response (accepted/rejected) — extending with custom variants like neutral would change the semantics of the response, and the recipient-side UI only models accept/reject.
  • actor.organization#visibility (public/unlisted) — discoverability semantics; custom variants here likely won't be honored by any platform that reads this field.
  • workscope.cel#version (v1) — schema version; extending it means a new CEL context format and that's a coordinated upgrade, not an at-your-own-risk extension.

Happy to add them anyway if reviewers prefer pure consistency over the semantic-tightening signal.

Test plan

  • npm run gen-schemas-md ✅ (SCHEMAS.md regenerated cleanly)
  • npm run format ✅ (no formatting drift)
  • npm run check ✅ (135 tests pass, including all 92 doc-snippet validation tests — confirms README + SKILL.md code blocks still validate against the lexicon)

Changeset

Patch-level — included in this PR.

Summary by CodeRabbit

Documentation

  • Clarified that certain schema fields with known values support custom values beyond documented examples in addition to standard options
  • Updated field descriptions for location types and tag categories/statuses to explicitly permit custom values with usage guidance
  • Added "Schema Conventions" section documenting the distinction between open and closed vocabularies for improved interoperability

Review Change Stack

Adds a 'Schema Conventions' section to README.md explaining that
knownValues fields are open: custom string values are wire-valid, the
listed values are interop conventions, and only 'enum' fields are
closed and validator-enforced. Also documents the strongRef + CID
pinning semantic so consumers don't reach for embedded-record
shortcuts.

Updates inline descriptions on app.certified.location#locationType,
org.hypercerts.workscope.tag#category, and org.hypercerts.workscope.tag#status
to say 'Values beyond the known set are permitted' — bringing them in
line with the existing wording on collection#type, attachment#contentType,
and badge.definition#badgeType.

The locationType description now also explicitly tells implementers to
use the catch-all 'geojson' entry for any non-Point GeoJSON (Polygon,
MultiPolygon, FeatureCollection) rather than inventing typed variants.

Splits a misleading bullet in STRING_CONSTRAINTS.md that conflated
knownValues with enum — the two have different validation semantics
(enum is closed, knownValues is open), and knownValues fields still
want maxLength to bound the size of custom values.

Regenerates SCHEMAS.md.

Documentation-only — no schema or type changes.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@changeset-bot

changeset-bot Bot commented May 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 80e5b42

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hypercerts-org/lexicon Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3bb73c45-2547-4dca-a231-c685a28698b5

📥 Commits

Reviewing files that changed from the base of the PR and between 254fcf0 and 80e5b42.

📒 Files selected for processing (6)
  • .changeset/clarify-knownvalues-open-vocabulary.md
  • README.md
  • SCHEMAS.md
  • STRING_CONSTRAINTS.md
  • lexicons/app/certified/location.json
  • lexicons/org/hypercerts/workscope/tag.json

📝 Walkthrough

Walkthrough

This patch documentation-only update clarifies that knownValues in the hypercerts lexicon represents an open vocabulary allowing custom string values, distinct from closed enum fields. Field descriptions are updated to reflect this distinction, with supporting conventions and constraints documentation added to README.md and STRING_CONSTRAINTS.md.

Changes

knownValues Open Vocabulary Clarification

Layer / File(s) Summary
Schema conventions and constraint documentation
.changeset/clarify-knownvalues-open-vocabulary.md, README.md, STRING_CONSTRAINTS.md
New "Schema Conventions" section in README explains that knownValues is an open vocabulary (validators do not enforce as closed) and how strongRef pins versions. STRING_CONSTRAINTS.md clarifies that enum fields don't need length constraints while knownValues fields require maxLength.
JSON schema field descriptions
lexicons/org/hypercerts/workscope/tag.json, lexicons/app/certified/location.json
Field descriptions for category and status in tag schema, and locationType in location schema are expanded to explicitly state values beyond the known set are permitted, with locationType also clarifying GeoJSON format guidance.
Auto-generated documentation
SCHEMAS.md
Field descriptions for org.hypercerts.workscope.tag (category, status) and app.certified.location (locationType) are updated in auto-generated documentation to reflect the schema clarifications.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • hypercerts-org/hypercerts-lexicon#103: Shares knownValues and STRING_CONSTRAINTS.md updates, but PR #103 applies schema/validation changes (enum→knownValues conversion) while this PR clarifies the semantic meaning and documentation of existing knownValues fields.

Suggested reviewers

  • aspiers
  • holkexyz

Poem

🐰 Schemas speak in clearer tongues today,
Open values lead the lexicon's way—
No closed enum, but space for thee,
Custom strings dance wild and free!
Strong and kind, this patch does play. 📚✨

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: documenting that knownValues is an open vocabulary rather than a closed enum, which is precisely what the PR accomplishes across all files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Lexicon Documentation Sync ✅ Passed Documentation sync verified. JSON descriptions updated, README.md added Schema Conventions section, SCHEMAS.md regenerated, all lexicons exist, ERD needs no changes for description-only edits.
Lexicons Styleguide Compliance ✅ Passed Lexicon files comply with styleguide. Names use proper casing (lowerCamelCase fields, kebab-case knownValues). Changes are documentation-only with no structural updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/clarify-known-values-open-vocabulary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aspiers aspiers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic clarification, thanks!

@s-adamantine
s-adamantine merged commit c831b8f into main May 18, 2026
6 checks passed
@s-adamantine
s-adamantine deleted the docs/clarify-known-values-open-vocabulary branch May 18, 2026 11:49
This was referenced May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants