fix: enforce minimum one obligation requirement for licenses (Issue #136)#194
Open
abhayrajjais01 wants to merge 5 commits intofossology:mainfrom
Open
fix: enforce minimum one obligation requirement for licenses (Issue #136)#194abhayrajjais01 wants to merge 5 commits intofossology:mainfrom
abhayrajjais01 wants to merge 5 commits intofossology:mainfrom
Conversation
…ossology#136) - Add validation to CreateLicense endpoint to reject licenses without obligations - Add validation to UpdateLicense endpoint to prevent removing all obligations - Add validation to ImportLicenses flow for imported licenses - Update existing tests to include obligations - Add new test case for license creation without obligations - Create getTestObligation() helper function for tests Addresses all feedback from PR fossology#191: - Validation occurs before database transactions (not after) - UpdateLicense endpoint now validates obligations - All test cases updated and passing - Clear, user-friendly error messages Fixes fossology#136 Signed-off-by: abhayrajjais01 <abhayraj916146@gmail.com>
8161b24 to
416e7ee
Compare
Signed-off-by: Abhayraj Jaiswal <205578164+abhayrajjais01@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.
Description
Fixes #136 - Enforces that licenses cannot exist without at least one obligation attached.
Changes
CreateLicenseendpoint (before DB transaction)UpdateLicenseendpointInsertOrUpdateLicenseOnImportfunctiongetTestObligation()helper function for testsAddresses PR #191 Review Feedback
UpdateLicenseendpointTesting
TestCreateLicense/withoutObligationsBreaking Changes
Warning
This is a breaking change. Existing code that creates/updates licenses without obligations will now fail with 400 Bad Request.
Error Messages
CreateLicense: "cannot create license without obligations"
UpdateLicense: "cannot update license to have zero obligations"
ImportLicenses: "cannot import license without obligations: at least one obligation is required"