fix: handle null values for optional fetch parameters#2631
Closed
fix: handle null values for optional fetch parameters#2631
Conversation
Make max_length, start_index, and raw parameters properly optional by using Optional[] types and handling null values gracefully. This fixes the issue where LibreChat passes explicit null values for optional parameters, which was causing Pydantic validation failures. Co-authored-by: Ola Hungerford <olaservo@users.noreply.github.com>
Member
Author
|
@claude can you add tests to cover the scenarios from the original issue? |
Contributor
|
Claude finished @olaservo's task —— View job ✅ Added comprehensive tests for null value handling scenarios from issue #2035 What I implementedComplete test suite covering the original issue scenariosI created a full test suite at Core Issue #2035 Tests
Parameter Validation Tests
Server Logic Tests
Key test scenarios from the original issue:# This was failing before the fix
params = {
"url": "https://example.com",
"max_length": None, # LibreChat sends explicit null
"start_index": None, # LibreChat sends explicit null
"raw": None # LibreChat sends explicit null
}
fetch = Fetch(**params) # Now works without ValidationErrorAll 12 tests pass, confirming the fix properly handles the scenarios that were causing LibreChat integration failures. Todo List
The tests are now part of the PR and will help prevent regressions of the null value handling fix. |
…ters - Add test suite covering scenarios from issue #2035 - Test explicit null values for optional parameters - Test omitted optional parameters - Test parameter validation and edge cases - Test server logic that converts None to defaults - Verify LibreChat compatibility with null parameters Co-authored-by: Ola Hungerford <olaservo@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.
Fixes #2035 - fetch server now properly handles null values for optional parameters.
Makes max_length, start_index, and raw parameters properly optional by using Optional[] types and handling null values gracefully.
This fixes the issue where LibreChat and other MCP clients pass explicit null values for optional parameters, which was causing Pydantic validation failures.
Generated with Claude Code