code-citation-lint

Schemas and versions

All schemas are bundled with the package: no network access is needed at lint time, and the same data powers the Node CLI, the library and the browser demo.

Sources

Format Version Source
CFF 1.0.3, 1.1.0 pykwalify YAML schemas from cffconvert (src/cffconvert/schemas/*/schema.yaml), converted to draft-07 JSON Schema by scripts/lib/pykwalify-to-jsonschema.ts
CFF 1.2.0 official JSON Schema: https://citation-file-format.github.io/1.2.0/schema.json
CFF 1.3.0 (draft) vendored draft from cffconvert (src/cffconvert/schemas/1.3.0/schema.json) — not yet released upstream
CodeMeta all versions official JSON-LD contexts from the codemeta/codemeta repository tags
schema.org latest curated software profile generated by scripts/generate-schemaorg-schema.ts (schema.org has no JSON Schema)
SPDX license list trimmed id list from https://spdx.org/licenses/licenses.json → schemas/spdx/ids.json (powers the license-spdx list check; version recorded in the file)

The exact fetch date and URLs are recorded in schemas/sources.json.

schema.org software profile

scripts/generate-schemaorg-schema.ts generates a strict profile from a curated property list covering Thing, CreativeWork, SoftwareSourceCode and SoftwareApplication (the terms relevant for software metadata, including everything the CFF conversion emits):

The curated list lives in the generator script; extend it there and re-run to cover additional schema.org terms.

CodeMeta JSON Schemas

CodeMeta has no official JSON Schema — only JSON-LD contexts. scripts/generate-codemeta-schemas.ts derives a per-version JSON Schema from each vendored context:

CFF 1.0.x / 1.1.0 conversion notes

The old pykwalify schemas are lenient (unknown keys allowed), matching the original semantics. The library therefore surfaces unknown keys as warnings (cff/unknown-key) for those versions, while 1.2.0+ rejects them via additionalProperties: false in the official schema.

The conversion also normalizes a known upstream defect where dots were double-escaped in some patterns (\\.), which would have rejected valid emails/URLs.

Updating schemas

npm run schemas:fetch      # downloads upstream schemas/contexts into schemas/
npm run schemas:generate   # regenerates the CodeMeta JSON Schemas from the contexts
npx tsx scripts/generate-schemaorg-schema.ts  # regenerates the schema.org profile
npm run test               # verify everything still validates

To add a new version:

  1. Add the source to SOURCES in scripts/fetch-schemas.ts
  2. Add the version to CFF_VERSIONS/CODEMETA_VERSIONS in src/registry.ts and the import map in bundledSchemas
  3. For CodeMeta: add the version and its known context URLs to scripts/generate-codemeta-schemas.ts and run schemas:generate
  4. Add fixtures (tests/fixtures/) and extend the version-parametrized tests