fix: Align SDK endpoints and tests with OpenAPI spec#47
Merged
Conversation
- Fix deduplication logic to group by inputPurl instead of batchIndex - Update API endpoints to match OpenAPI specifications: - fullscans: Support both listing and individual scan retrieval - report: Fix file handling and accept 200/201 status codes - diffscans: Correct path structure for create_from_repo - apitokens: Add list method and flexible update routing - auditlog: Fix query parameter handling - Multiple endpoints: Correct HTTP methods and response formats - Add base_path parameter support for cleaner file organization - Update all unit tests to match actual API behavior - Remove batchIndex from deduped results while maintaining backward compatibility - Comprehensive test coverage for 40+ endpoints with proper mocking
|
🚀 Preview package published! Install with: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketdev==3.0.5.dev1 |
barslev
approved these changes
Sep 9, 2025
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.
Multiple Socket SDK endpoints were not properly aligned with the OpenAPI specification, causing unit tests to fail and incorrect API behavior. The PURL endpoint deduplication logic was grouping by
batchIndexinstead ofinputPurl, causing different packages with the same batch index to be incorrectly merged into a single result.Root Cause
Deduplication Logic: The
Dedupe.dedupe()function was usingbatchIndexfor grouping packages instead ofinputPurl, which caused different packages that happened to have the same batch index to be merged together incorrectly.API Specification Misalignment: Several SDK endpoints had incorrect URL paths, HTTP methods, and response handling that didn't match the actual OpenAPI specification, leading to failed API calls and incorrect behavior.
Missing Functionality: Some endpoints were missing methods (like
apitokens.list()) and parameters (likebase_pathfor file uploads) that are available in the API.Fix
Fixed Deduplication Logic: Updated
Dedupe.dedupe()to always group byinputPurlinstead ofbatchIndex, ensuring different packages remain separate even if they share the same batch index. Maintained backward compatibility by keeping thebatchedparameter but ignoring its value.Aligned API Endpoints: Updated multiple endpoints to match OpenAPI specifications:
apitokens.list()and enhanced parameter handlingEnhanced File Upload Support: Added
base_pathparameter to file upload methods for cleaner file organization and better key naming in multipart uploads.Comprehensive Test Updates: Updated all unit tests to reflect correct API behavior and added proper mocking for 40+ endpoints.
Public Changelog
inputPurlinstead ofbatchIndex, ensuring different packages remain separate in resultsbase_pathparameter support in file upload methods for cleaner file organizationapitokens.list()method for retrieving organization API tokens