Skip to content

Expand validation options: implementation approach and severity levels#631

Draft
alistair3149 wants to merge 2 commits intomasterfrom
validation-option-3
Draft

Expand validation options: implementation approach and severity levels#631
alistair3149 wants to merge 2 commits intomasterfrom
validation-option-3

Conversation

@alistair3149
Copy link
Copy Markdown
Member

@alistair3149 alistair3149 commented Feb 23, 2026

Summary

  • Adds additional pros to Option 1 and Option 2
  • Adds Option 3: both frontend and backend validation, with a generic interpreter approach
    and single source of truth
  • Extracts warning/error severity levels into a separate document as an independent concern

Test plan

  • Review the document for clarity and completeness

Written by Claude Code, Opus 4.6. Result of extensive back and forth with @alistair3149.
Context: the NeoWiki codebase and existing Validation Architecture document.

Generated with Claude Code

@alistair3149 alistair3149 marked this pull request as draft February 23, 2026 18:46
@alistair3149
Copy link
Copy Markdown
Member Author

alistair3149 commented Feb 23, 2026

This is unrelated to validation but related to option 3, so I put it here as a comment instead.

In option 3, the document mentions that the same constraint metadata could drive the Schema Editor UI. Some more detail on that thought:

Currently, each Property Type has a hand-coded AttributesEditor Vue component (e.g., TextAttributesEditor, NumberAttributesEditor). These components use only two UI primitives — boolean toggles and optional number inputs — with some grouping and conditional visibility. Text and URL already share nearly identical code for the multiple/uniqueItems toggles.

If constraints are declared as metadata (which Option 3's generic interpreter already requires), the same metadata could describe the editor UI: what control type to render, grouping, visibility rules. A generic renderer would replace per-type components, so adding a new Property Type or constraint wouldn't require writing a new Vue component — just a metadata declaration.

This becomes more valuable as the number of Property Types grows, and especially if third-party extensions define their own types via the plugin system.

Written by Claude Code, Opus 4.6. Result of back and forth with @alistair3149 exploring the validation architecture.
Context: the NeoWiki codebase, Validation.md, and the Schema Editor constraint UI components.

@alistair3149 alistair3149 marked this pull request as ready for review February 23, 2026 18:52
Comment thread docs/planning/Validation.md
@alistair3149 alistair3149 changed the title Add validation Option 3: backend validation with warning/error severity Expand validation options: implementation approach and severity levels Feb 24, 2026
Comment thread docs/planning/Validation.md Outdated
Pros:
* API users can edit Subjects without prior validation without risking creating "invalid" Subjects
* API users can potentially validate Subjects without editing via a new dedicated endpoint
* The Schema remains the single source of truth for rules. Interpreters are generic and stable.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not a pro of this approach. I'm guessing these additions are AI-generated?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is considered a pro because the validation rules are only defined with the schema.
The single source of truth approach makes validation more maintainable and simpler.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's a pro of having a single source of truth, but if we don't have backend validation, then we also have a single source of truth, so this is not a pro of adding backend validation, it's just something that does not regress.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I have restructured the document to make it more clear.

Comment thread docs/planning/Validation.md Outdated
alistair3149 and others added 2 commits March 24, 2026 15:22
Adds a third option to the Validation Architecture document. This option
introduces user-defined severity levels (warning vs error) on Schema
constraints, with the Schema as the single source of truth and generic
constraint interpreters in both TS and PHP for instant feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reframe Option 3 as "both frontend and backend validation" with the
generic interpreter approach. Move severity levels to a separate
document as an independent concern. Distribute shared pros across
options that have them instead of mirroring as cons.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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