Skip to content

docs: document validation scope and external term validation - #622

Merged
jeswr merged 12 commits into
rdfjs:mainfrom
jeswr:docs/validation-scope
Aug 23, 2026
Merged

docs: document validation scope and external term validation#622
jeswr merged 12 commits into
rdfjs:mainfrom
jeswr:docs/validation-scope

Conversation

@jeswr

@jeswr jeswr commented Jul 2, 2026

Copy link
Copy Markdown
Member

Recurring issues (#308, and the writer side in #329/#383) stem from the same expectation gap: N3.js validates per-format grammar, not the terms themselves. This adds a short Validation subsection under Compatibility stating what the parser guarantees, what it deliberately does not check (RFC 3987 well-formedness beyond the grammar, unresolved relative IRIs without baseIRI, literal value vs datatype, BCP 47 language tags, and that the writer trusts its input terms), and a compact validating-Transform snippet composing validate-iri, rdf-validate-datatype, and bcp-47 for users who need term validation.

All claims and the snippet were verified against n3@2.1.0 and current main (e.g. <http://example.org/%ZZ> and "abc"^^xsd:integer parse; the snippet rejects both).

Refs #308

cc @jeswr

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread README.md
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jeswr jeswr added ai-generated Authored or prepared by an AI coding agent needs-author-review Awaiting author review; agent has done its part (author removes if follow-ups remain) labels Jul 9, 2026
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md Outdated
@jeswr
jeswr marked this pull request as ready for review August 23, 2026 17:44
Copilot AI lite review requested due to automatic review settings August 23, 2026 17:44

Copilot AI 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.

Pull request overview

This PR clarifies N3.js’s validation responsibilities by documenting that parsing validates per-format grammar/syntax (not RDF term well-formedness), and that writing serializes provided terms as-is—bridging the expectation gap referenced in #308 and writer-side issues (#329/#383).

Changes:

  • Adds a Validation subsection under Compatibility describing what the parser/writer do and do not validate.
  • Provides a short stream-based Transform example for post-parse term validation using external validators.
  • Links to proposed parser-level opt-in validation modes (PR #634).
Suppressed comments (1)

README.md:514

  • Several typos/grammar issues in this paragraph ("snipped"/"occuring"), and termTypes looks like an accidental code identifier (RDF/JS uses termType; here you likely mean "term types"). Also, the snippet requires additional packages but doesn't mention installing them.
The following code snipped shows how to validate that NamedNodes and Literals are validly formed. Depending on your application you may wish to apply further validation: such as ensuring that nested Quad terms are valid in RDF 1.2, and ensuring that `termTypes` are only occuring in the positions that is valid for RDF 1.1 and RDF 1.2.
```JavaScript

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jeswr
jeswr merged commit 478067c into rdfjs:main Aug 23, 2026
50 checks passed
@jeswr
jeswr deleted the docs/validation-scope branch August 23, 2026 17:49
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.2.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Authored or prepared by an AI coding agent needs-author-review Awaiting author review; agent has done its part (author removes if follow-ups remain) released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants