Consolidate validation into single source of truth#58
Merged
Conversation
- Rewrite ValidateCharacterData.ps1 to use module's Test-CharacterData instead of duplicating validation logic (~500 lines to ~210 lines) - Add synergy slot limit validation to Test-CharacterData - Add skipIfPresentCharacters cross-reference validation - Add character ID format validation (uppercase/numbers/underscores) - Fix single-element array unwrapping in ConvertTo-CharacterArray - Fix JSON array serialization for single validation errors in editor - Fix $Error variable conflict (eliminated with duplicate code removal) - Add test for JSON array serialization of single errors - All 60 Pester tests pass Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace hardcoded C:\ paths with cross-platform TestDrive paths so tests pass on both Windows and ubuntu-latest runners. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
NducTiOnomBi
added a commit
that referenced
this pull request
Apr 15, 2026
Kept unknown property validation and test from this branch that were removed during merge with main (PR #58 changes). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eliminates duplicate validation logic by refactoring
ValidateCharacterData.ps1to use the module'sTest-CharacterDatafunction as the single source of truth.Changes
Consolidation
Tools/ValidateCharacterData.ps1— Rewritten from ~500 lines to ~210 lines. Now importsVisualEditorFunctions.psm1and delegates all data validation toTest-CharacterDatainstead of reimplementing it. Steps reduced from 9 to 5.Cannot validate argument on parameter 'MaximumHistoryCount'. The 0 argument is less than the minimum allowed range of 1. Supply an argument that is greater than or equal to 1 and then try the command again.automatic variable conflict bugNew Validations (in
Test-CharacterData)characters.length + sum(numberMatchesRequired) <= 4per synergy set^[A-Z0-9_]+$patternBug Fixes
Tools/StartVisualEditor.ps1— Fixed single-element array unwrapping on/api/validateand/api/saveendpoints (was causingerrors.forEach is not a functionin editor)Tools/VisualEditorFunctions.psm1—ConvertTo-CharacterArraynow wraps with@()to prevent single-element unwrappingTests
forEachbug)Validation
ValidateCharacterData.ps1correctly catches MAZKANATA slot limit violationforEachcrash)