Skip to content

Refactor validation messages and introduce new parsing and validation…#314

Merged
scottolsonjr merged 3 commits into
mainfrom
parsing-and-validation-helpers
Jun 13, 2026
Merged

Refactor validation messages and introduce new parsing and validation…#314
scottolsonjr merged 3 commits into
mainfrom
parsing-and-validation-helpers

Conversation

@scottolsonjr

Copy link
Copy Markdown
Contributor

Refactor validation messages and introduce new parsing and validation helpers

  • Replaced hardcoded validation messages in various validators with constants from ResponseValidationMessages.
  • Introduced ScriptLinkParsing class with methods for safe parsing of integers, booleans, and DateTime.
  • Added ScriptLinkValidation class for validating URLs and OpenForm strings.
  • Consolidated structural mutation messages into StructuralMutationCore.
  • Updated ArgumentGuards to use new message constants.
  • Ensured consistency and clarity in error handling across the codebase.

… helpers

- Replaced hardcoded validation messages in various validators with constants from ResponseValidationMessages.
- Introduced ScriptLinkParsing class with methods for safe parsing of integers, booleans, and DateTime.
- Added ScriptLinkValidation class for validating URLs and OpenForm strings.
- Consolidated structural mutation messages into StructuralMutationCore.
- Updated ArgumentGuards to use new message constants.
- Ensured consistency and clarity in error handling across the codebase.

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 standardizes validation/guard error messages across the Validators and Helpers layers, while adding new shared parsing and format-validation helpers intended to improve consistency in ScriptLink-related input handling.

Changes:

  • Centralized several response-validation strings into ResponseValidationMessages and updated response validators to use them.
  • Introduced ScriptLinkParsing (safe int/bool/DateTime parsing) and ScriptLinkValidation (URL/OpenForm validation), plus new unit tests for both.
  • Consolidated/expanded structural-mutation message constants in StructuralMutationCore and updated various helper methods to use the shared message constants.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
dotnet/RarelySimple.AvatarScriptLink.Objects.Validators/RowObjectResponseValidators.cs Switched hardcoded RowObject validation strings to centralized constants.
dotnet/RarelySimple.AvatarScriptLink.Objects.Validators/ResponseValidationMessages.cs Added centralized constants for response validation messages.
dotnet/RarelySimple.AvatarScriptLink.Objects.Validators/OptionObjectResponseValidators.cs Switched hardcoded OptionObject validation strings to centralized constants.
dotnet/RarelySimple.AvatarScriptLink.Objects.Validators/FormObjectResponseValidators.cs Switched hardcoded FormObject validation strings to centralized constants.
dotnet/RarelySimple.AvatarScriptLink.Objects.Validators/FieldObjectResponseValidators.cs Switched hardcoded FieldObject validation strings to centralized constants (incl. formatted flag message).
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers/Validators/ArgumentGuards.cs Refactored/changed accessibility and began reusing shared structural-mutation messages.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers/StructuralMutationCore.cs Added additional shared structural-mutation message constants.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers/ScriptLinkValidation.cs Added new URL/OpenForm validation helpers.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers/ScriptLinkParsing.cs Added new safe parsing helpers for int/bool/DateTime.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers/OptionObjectHelpers.cs Updated thrown message references to consolidated structural-mutation messages.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers/OptionObject2Helpers.cs Updated thrown message references to consolidated structural-mutation messages.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers/OptionObject2015Helpers.cs Updated thrown message references to consolidated structural-mutation messages.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers/FormObjectHelpers.cs Updated thrown message references to consolidated structural-mutation messages.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers.Tests/ScriptLinkValidationTests.cs Added unit tests for the new ScriptLinkValidation helpers.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers.Tests/ScriptLinkParsingTests.cs Added unit tests for the new ScriptLinkParsing helpers.
dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers.Tests/ArgumentGuardsTests.cs Removed tests that directly exercised ArgumentGuards.

Comment thread dotnet/RarelySimple.AvatarScriptLink.Objects.Helpers/ScriptLinkValidation.cs Outdated
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
68.3% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube Cloud

@scottolsonjr scottolsonjr merged commit 9ac35d5 into main Jun 13, 2026
5 of 6 checks passed
@scottolsonjr scottolsonjr deleted the parsing-and-validation-helpers branch June 13, 2026 16:06
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