Skip to content

Feat: addIRI and duplicate ID validation with inline errors in NewEntityDialog#200

Merged
aadorian merged 1 commit intoaadorian:mainfrom
dustintnguyen:feature/Add-input-validation-for-IRI-format-in-NewEntityDialog-#116
Apr 5, 2026
Merged

Feat: addIRI and duplicate ID validation with inline errors in NewEntityDialog#200
aadorian merged 1 commit intoaadorian:mainfrom
dustintnguyen:feature/Add-input-validation-for-IRI-format-in-NewEntityDialog-#116

Conversation

@dustintnguyen
Copy link
Copy Markdown
Contributor

  • Added shared ontology validation utilities
  • Updated the New Entity dialog -Added/updated tests to cover validation logic and UI behavior.

Description

This PR adds robust input validation for entity IDs in the New Entity dialog.

What changed

  • Added shared ontology validation utilities:
    • [isValidIRI] for full IRI or simple identifier format checks
    • [isDuplicateEntityId]for duplicate checks across classes, properties, and individuals
  • Updated the New Entity dialog to:
    • validate trimmed ID and Name inputs before create
    • show inline field-level error messages for invalid ID/name
    • show inline duplicate ID error when an entity already exists
    • keep destructive toast feedback for blocked create attempts
  • Added/updated tests to cover validation logic and UI behavior.

Related Issue(s)

#116
Close Add input validation for IRI format in NewEntityDialog #116

Closes #

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (code improvements without changing functionality)
  • Documentation update
  • Performance improvement
  • Test addition/improvement
  • CI/CD or build process change

Changes Made

-[validation.ts]
-[validation.test.ts]
-[new-entity-dialog.tsx]
-[new-entity-dialog.test.tsx]

Screenshots/Recordings (if applicable)

Screenshot 2026-03-12 at 9 52 31 AM Screenshot 2026-03-12 at 9 48 20 AM

Testing

  1. Start app: npm run dev
  2. Open New Entity dialog.
  3. Verify invalid ID (e.g. 123Person) shows inline invalid IRI message and blocks create.
  4. Verify duplicate ID (existing class/property/individual) shows inline “Entity already exists” and destructive toast.
  5. Verify valid unique ID + name creates entity successfully.

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested on multiple browsers (Chrome, Firefox, Safari, Edge)
  • Tested on different screen sizes

How to Test

  1. Start app: npm run dev
  2. Open New Entity dialog.
  3. Verify invalid ID (e.g. 123Person) shows inline invalid IRI message and blocks create.
  4. Verify duplicate ID (existing class/property/individual) shows inline “Entity already exists” and destructive toast.
  5. Verify valid unique ID + name creates entity successfully.

Performance Impact

  • No performance impact
  • Performance improved (describe how)
  • Potential performance concerns (describe and explain why acceptable)

Performance measurements (if applicable):

Accessibility

  • Keyboard navigation works correctly
  • Screen reader tested
  • Color contrast meets WCAG 2.1 AA standards
  • ARIA labels added where necessary
  • Focus management implemented correctly
  • Not applicable (no UI changes)

Code Quality Checklist

  • Code follows project style guidelines (ESLint/Prettier)
  • Self-review completed
  • Comments added for complex logic
  • No unnecessary console.log or debug code
  • No hardcoded values (uses constants/config)
  • Error handling implemented appropriately
  • TypeScript types are properly defined (no any unless justified)
  • Code is DRY (Don't Repeat Yourself)

Documentation

  • README updated (if needed)
  • API documentation updated (if applicable)
  • Inline code comments added for complex logic
  • ROADMAP.md updated (if applicable)
  • CHANGELOG updated (if applicable)

Dependencies

  • No new dependencies added
  • New dependencies added (list below with justification)

New dependencies (if any):

Breaking Changes

  • No breaking changes
  • Breaking changes (describe below)

Migration guide (if applicable):

Deployment Notes

  • No special deployment steps required
  • Requires environment variable changes (list below)
  • Requires database migration
  • Requires cache clearing
  • Other deployment considerations (describe below)

Deployment instructions (if applicable):

Security Considerations

  • No security implications
  • Input validation added/verified
  • XSS prevention measures in place
  • CSRF protection verified
  • Authentication/authorization checked
  • No sensitive data exposed in logs/errors
  • Dependencies scanned for vulnerabilities

Rollback Plan

Additional Context

Reviewer Checklist

  • Code changes reviewed
  • Tests reviewed and passing
  • Documentation reviewed
  • No obvious security issues
  • Performance impact acceptable
  • Accessibility requirements met
  • Breaking changes justified and documented

Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

…ityDialog

- Added shared ontology validation utilities
- Updated the New Entity dialog
-Added/updated tests to cover validation logic and UI behavior.
@github-project-automation github-project-automation Bot moved this to To triage in @ProtegeDesk Mar 13, 2026
@aadorian aadorian merged commit 1dd982f into aadorian:main Apr 5, 2026
@github-project-automation github-project-automation Bot moved this from To triage to Done in @ProtegeDesk Apr 5, 2026
@aadorian
Copy link
Copy Markdown
Owner

aadorian commented Apr 5, 2026

Thanks @dustintnguyen !!

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants