Skip to content

feat(stdlib): add validation library (#20)#23

Merged
ProgrammerKR merged 2 commits into
ProgrammerKR:mainfrom
bastitva0-blip:feat/validation-library
Jul 13, 2026
Merged

feat(stdlib): add validation library (#20)#23
ProgrammerKR merged 2 commits into
ProgrammerKR:mainfrom
bastitva0-blip:feat/validation-library

Conversation

@bastitva0-blip

Copy link
Copy Markdown
Contributor

PR Body

Description

This PR implements the feature request outlined in #20, introducing the std.lib.validation standard library module for ProXPL. It provides a robust, declarative, and chainable API for schema-based data validation and quick runtime data validation checks, perfectly matching the language's "batteries included" philosophy.

This library operates entirely in userland ProXPL using core built-ins, introducing zero overhead or modifications to the native C/C++ core engine.

Related Issues

Closes #20

Proposed Changes

  • Core Validator Engine (std/lib/validation.prox): Implements chainable rules for string(), number(), bool(), list(), and any() types.
  • Schema Contract Evaluator: Implements Schema.define() and schema.validate() to parse payloads and return complete, structured ValidationResult objects with accumulated error lists rather than failing early.
  • Inline Utility Functions (Validate.*): Adds quick, standalone convenience methods (e.g., Validate.isEmail, Validate.isInRange) for minor runtime assertions.
  • Comprehensive Test Suite (tests/test_validation.prox): Thoroughly tests edge cases, validation boundaries, and nested type evaluation.
  • Documentation & Visibility: Added full API documentation in docs/stdlib/validation.md and updated std/README.md and CHANGELOG.md.

File Statistics & Changes

docs/stdlib/validation.md   |  (New API Reference & Examples)
std/lib/validation.prox     |  (Core Library Implementation)
tests/test_validation.prox  |  (Integration & Unit Tests)
CHANGELOG.md                |  +13 lines
std/README.md               |  +23 lines
Checklist:
[x] I have read the CONTRIBUTING.md guidelines.

[x] Code follows the language standards and formatting conventions (CODING_STANDARD.md).

[x] All functionalities are fully covered by tests in tests/test_validation.prox.

[x] Documentation has been updated accordingly.

Maintainer Notes / Open Design Choices
To address the initial questions raised in the feature proposal:

Error Formatting: The library uses structured ProXPL Dictionaries { field: string, message: string } within the ValidationResult.errors list to keep serialization simple, avoiding heavy object overhead.

Type Checking: Strict type checking is enforced using the built-in type_of() method rather than completely generic duck typing to prevent silent mis-evaluations.

@bastitva0-blip

Copy link
Copy Markdown
Contributor Author

yeah take your time please free to tag me and discuss about this

@ProgrammerKR

Copy link
Copy Markdown
Owner

Thanks for the contribution and the comprehensive documentation.

This is a substantial addition to the standard library, so I'll take some time to review the implementation, API design, tests, and documentation before making a decision.

I also noticed the Windows CI failure again. Since this has occurred on multiple PRs, I'll verify whether it's a repository/CI issue or something introduced by this change.

I'll update you after the review. Thanks for your patience!

@ProgrammerKR ProgrammerKR merged commit 735f929 into ProgrammerKR:main Jul 13, 2026
4 of 6 checks passed
@bastitva0-blip

Copy link
Copy Markdown
Contributor Author

@ProgrammerKR
Hey, did some research on the Windows CI failure : this is a well-known upstream issue, not specific to this repo.

Root Cause

The official LLVM Windows installer and Chocolatey package don't ship LLVMConfig.cmake or llvm-config.exe, which is what CMake's find_package(LLVM) needs. This is a documented and longstanding LLVM issue. The current setup_llvm_windows.ps1 script tries to work around it but hits a dead end because the file simply isn't there.

This also explains why the Windows runner itself recently dropped llvm-config.exe from C:\Program Files\LLVM\bin entirely.

Fix

Replace the custom PowerShell script with KyleMayes/install-llvm-action, which is specifically built to solve this problem and is widely used by compiler projects on GitHub Actions.

In .github/workflows/*.yml, replace the Set up LLVM (Windows) step with:

- name: Install LLVM and Clang
  if: matrix.os == 'windows-latest'
  uses: KyleMayes/install-llvm-action@v2
  with:
    version: "17"

- name: Set LLVM_DIR (Windows)
  if: matrix.os == 'windows-latest'
  shell: pwsh
  run: |
    echo "LLVM_DIR=${{ env.LLVM_PATH }}/lib/cmake/llvm" >> $env:GITHUB_ENV
    echo "CMAKE_PREFIX_PATH=${{ env.LLVM_PATH }}" >> $env:GITHUB_ENV

After this, scripts/setup_llvm_windows.ps1 can be removed entirely.

This is unrelated to any code changes in this PR — the same failure appears on PR #22 which only touched 3 lines of C with no new files.

@ProgrammerKR

Copy link
Copy Markdown
Owner

@bastitva0-blip Thanks for investigating and sharing the root cause.

Could you please create a separate issue for this Windows CI/LLVM setup problem with the details and proposed solution? I'll assign it to you.

If you'd like to work on it, feel free to submit a PR to fix it. Otherwise, I'll take care of implementing the fix myself.

Thanks again for your contribution and the detailed research!

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.

Feature Request: std.lib.validation — Schema & Data Validation Library Type: New Standard Library

2 participants