Fix: PATCH endpoint replacing resources instead of adding them#93
Merged
Fix: PATCH endpoint replacing resources instead of adding them#93
Conversation
Add test script that confirms PATCH /dataset/{id} endpoint replaces
existing resources instead of adding new ones.
- Creates test organization and dataset automatically
- Demonstrates the bug: PATCH replaces all resources like PUT
- Includes cleanup of test data
- Script exits with code 1 when issue is confirmed
Related to #92
Add modified patch_general_dataset() function that adds resources instead of replacing them. Fix needs verification and testing. - Changes resource handling logic to preserve existing resources - Adds new resources to existing list instead of replacing - Updates existing resources by URL or name matching - Implementation ready for testing and validation Related to #92
Created test_patch_resources_issue_fixed.py that confirms the fix works correctly.
PATCH /dataset/{id} now properly adds resources instead of replacing them.
- Enhanced test script with better organization handling
- Confirms fix resolves issue #92
- PATCH now preserves existing resources and adds new ones
- Test shows resource count increases as expected
Verifies fix for #92
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.
PATCH
/dataset/{id}was replacing all existing resources instead of adding new ones, making it behave identically to PUT.Before: PATCH replaced all resources (incorrect)
After: PATCH adds new resources to existing ones (correct)
Fixes #92
Changes
patch_general_dataset()inapi/services/dataset_services/general_dataset.pyTesting
Reproduction Test Results
Verification
API Behavior
PATCH
/dataset/{id}(Fixed){ "resources": [{"url": "new.json", "name": "new_resource"}] }Result: Adds to existing resources ✅
PUT
/dataset/{id}(Unchanged){ "resources": [{"url": "replacement.csv", "name": "replacement"}] }Result: Replaces all resources ✅
Review Checklist