Skip to content

Publish 2.0.0 - #26

Merged
greguintow merged 14 commits into
mainfrom
develop
Jan 29, 2026
Merged

greguintow merged 14 commits into
mainfrom
develop

Conversation

@greguintow

@greguintow greguintow commented Jan 29, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Publish 2.0.0 with support to infer class-validator decorators

Open with Devin

grimmerk and others added 14 commits March 28, 2025 04:13
…eadme

test(llm-tool): add complex structured tool test
Co-Authored-By: greg@fireflies.ai <greg.teixeira123@gmail.com>
Add support for inferring JSON Schema properties from class-validator decorators:
- ArrayMaxSize -> maxItems
- ArrayMinSize -> minItems
- Max -> maximum (for numbers)
- Min -> minimum (for numbers)
- IsInt -> type: integer
- MinLength -> minLength (for strings)
- MaxLength -> maxLength (for strings)
- IsUrl -> format: uri
- IsPositive -> minimum: 1

Also adds support for manually specifying these properties via ToolProp options.

Co-Authored-By: greg@fireflies.ai <greg.teixeira123@gmail.com>
- Add assertion that format is undefined in structured output test
- Rename test 11 to 'ToolProp validation constraint options' for clarity
- Fix class-validator integration to not override explicit ToolProp options
- Fix getTargetValidationMetadatas call to pass empty string instead of undefined
- Bump version from 1.0.3 to 1.1.0

Co-Authored-By: greg@fireflies.ai <greg.teixeira123@gmail.com>
Co-Authored-By: greg@fireflies.ai <greg.teixeira123@gmail.com>
- Add Class-Validator Integration section to README
- Document supported decorators and their JSON Schema mappings
- Add examples for using class-validator with ToolProp
- Bump version to 2.0.0

Co-Authored-By: greg@fireflies.ai <greg.teixeira123@gmail.com>
- ArrayUnique -> uniqueItems: true
- ArrayNotEmpty -> minItems: 1
- IsEmail -> format: 'email'

Updated README with new decorators documentation.

Co-Authored-By: greg@fireflies.ai <greg.teixeira123@gmail.com>
Co-Authored-By: greg@fireflies.ai <greg.teixeira123@gmail.com>
@coderabbitai

coderabbitai Bot commented Jan 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • ^(?!main$|master$).*$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

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

@greguintow
greguintow merged commit 7922cd3 into main Jan 29, 2026
8 checks passed
@fireflies-bot

Copy link
Copy Markdown

🔍 PR Complexity Assessment

🟡 Risk Score: 4/10

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

📝 Summary

This PR publishes version 2.0.0 of the @firefliesai/schema-forge library, adding Date type support with date-time format, class-validator decorator integration for automatic JSON Schema constraint inference, and new validation constraint options in the ToolProp decorator.

📊 Lines Analysis

Metric Count
Total Changes 1028
Production Code 838
Test Code 190

💡 Recommendation

Review the class-validator integration logic in class-validator-integration.ts and ensure the decorator property inference precedence (explicit ToolProp options over class-validator inferred values) works correctly. Verify the Date type handling doesn't break existing consumers. The changes are well-tested but given the major version bump, consider impact on downstream services.


This assessment is automated and should be used as a guide. Please use your judgment when reviewing.

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 1 potential issue.

View issue and 5 additional flags in Devin Review.

Open in Devin Review

Comment thread src/lib/utils.ts

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.

🟡 prepareForOpenAIStructuredOutput doesn't strip constraints for 'integer' type

When a property has type: 'integer' (set via @IsInt() class-validator decorator or explicit type: 'integer' in @ToolProp), the minimum, maximum, and multipleOf properties won't be stripped when converting to OpenAI structured output format.

Click to expand

Issue Details

The prepareForOpenAIStructuredOutput function in utils.ts only checks for type === 'number' when deciding whether to strip unsupported numeric constraints:

} else if (
  newObj.type === 'number' ||
  (Array.isArray(newObj.type) && newObj.type.includes('number'))
) {
  // Remove unsupported number properties
  ['minimum', 'maximum', 'multipleOf'].forEach((prop) => {
    if (prop in newObj) delete newObj[prop];
  });
}

However, the PR introduces support for type: 'integer' via:

  1. @IsInt() class-validator decorator (class-validator-integration.ts:152)
  2. Explicit type: 'integer' in @ToolProp options (types.ts:40)

Impact

When using OpenAI structured output with integer types that have constraints, the schema will contain minimum/maximum properties that OpenAI's structured output mode doesn't support, potentially causing API errors or unexpected behavior.

Expected vs Actual

  • Expected: minimum, maximum, multipleOf should be stripped for both number and integer types when forStructuredOutput: true
  • Actual: These constraints are only stripped for number type, not integer

(Refers to lines 93-100)

Recommendation: Add a check for 'integer' type alongside 'number':

} else if (
  newObj.type === 'number' ||
  newObj.type === 'integer' ||
  (Array.isArray(newObj.type) && (newObj.type.includes('number') || newObj.type.includes('integer')))
) {
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

3 participants