Skip to content

Fixes to array support#30

Merged
greguintow merged 3 commits intodevelopfrom
feat/improve-array-support
Feb 24, 2026
Merged

Fixes to array support#30
greguintow merged 3 commits intodevelopfrom
feat/improve-array-support

Conversation

@greguintow
Copy link
Copy Markdown
Contributor

@greguintow greguintow commented Feb 24, 2026

What does this PR do?

Fixes to array support


Open with Devin

Summary by CodeRabbit

  • New Features

    • Added support for boolean values in enum definitions
    • Added support for 'integer' as a schema type option
  • Bug Fixes

    • Improved date-time format handling to respect existing format preferences
    • Enhanced type inference logic to validate consistency before applying type constraints

@fireflies-bot
Copy link
Copy Markdown

Copy link
Copy Markdown

@fireflies-bot fireflies-bot left a comment

Choose a reason for hiding this comment

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

✅ Auto-Approved - Low Complexity PR

🟢 Risk Score: 2/10

[██░░░░░░░░]

📝 Summary

This PR fixes array support in the class-validator integration by improving type handling for enums (adding boolean support), refactoring global storage access, and adding a check for same-type values before inferring array item types.

📊 Lines Analysis

Metric Count
Total Changes 33
Production Code 33
Test Code 0

💡 Recommendation

Low risk bug fix PR. Review the logic change in inferClassValidatorProperties that now checks if all values are the same type before inferring the type. Verify that mixed-type enums are handled correctly. Consider adding tests for the new boolean enum support.


This is an automated approval based on the complexity assessment. A human reviewer may still review if needed.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

Updates type definitions to support boolean enum values and 'integer' type, centralizes class-validator metadata access via a helper function, adds type compatibility checking for array item inference, and guards against overwriting existing format values.

Changes

Cohort / File(s) Summary
Type System Extensions
src/lib/types.ts
Extended SchemaItemType interface to include 'integer' as a type option and allow boolean values in enum unions alongside string and number.
Class Validator Integration
src/lib/class-validator-integration.ts
Replaced direct globalThis access with centralized getGlobalStorage helper; introduced type compatibility check before inferring ARRAY_CONTAINS item types; expanded enum type casting to include boolean values.
Utility Functions
src/lib/utils.ts
Added guard condition to prevent overwriting existing format property when normalizing Date item types to 'date-time'.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fixes to array support' clearly describes the main changes in the changeset, which involve improvements to array handling across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/improve-array-support

Comment @coderabbitai help to get the list of available commands and usage tips.

@greguintow greguintow merged commit 1bb3ff3 into develop Feb 24, 2026
5 of 6 checks passed
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/types.ts (1)

33-41: 🧹 Nitpick | 🔵 Trivial

Widen BaseSchemaProperty.enum to include boolean[] for consistency with SchemaItemType.

SchemaItemType.enum accepts (string | number | boolean)[] (line 25), but BaseSchemaProperty.enum (line 35) is typed as string[] | number[] | object. This inconsistency cascades to PropertyOptions and JSONSchemaProperty, which both extend BaseSchemaProperty. While boolean enum values are currently assigned through the items property (which uses SchemaItemType), aligning BaseSchemaProperty.enum with SchemaItemType.enum would ensure consistent type support across the interface hierarchy and prevent type mismatches if boolean enums are assigned at the property level in the future.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/types.ts` around lines 33 - 41, The BaseSchemaProperty.enum union is
missing boolean[] and should match SchemaItemType.enum; update the type of
BaseSchemaProperty.enum to include boolean[] (so it accepts (string | number |
boolean)[] or a matching union) to keep consistency across SchemaItemType.enum
and the derived types PropertyOptions and JSONSchemaProperty, ensuring
property-level enums can be boolean arrays without type errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/lib/types.ts`:
- Around line 33-41: The BaseSchemaProperty.enum union is missing boolean[] and
should match SchemaItemType.enum; update the type of BaseSchemaProperty.enum to
include boolean[] (so it accepts (string | number | boolean)[] or a matching
union) to keep consistency across SchemaItemType.enum and the derived types
PropertyOptions and JSONSchemaProperty, ensuring property-level enums can be
boolean arrays without type errors.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7832dc4 and c451a27.

📒 Files selected for processing (3)
  • src/lib/class-validator-integration.ts
  • src/lib/types.ts
  • src/lib/utils.ts

@greguintow greguintow mentioned this pull request Feb 24, 2026
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