Skip to content

Fix #1802: normalize boolean string values in _clean_package_data#2089

Closed
Monal-Reddy wants to merge 5 commits into
aboutcode-org:mainfrom
Monal-Reddy:fix-1802-discoveredpackage-boolean
Closed

Fix #1802: normalize boolean string values in _clean_package_data#2089
Monal-Reddy wants to merge 5 commits into
aboutcode-org:mainfrom
Monal-Reddy:fix-1802-discoveredpackage-boolean

Conversation

@Monal-Reddy
Copy link
Copy Markdown
Contributor

Issues

Closes: #1802

Changes

Fix an issue where DiscoveredPackage creation fails with:

ValidationError: "true" value must be either True or False

This occurs when boolean values are provided as strings ("true" / "false"), which Django BooleanField does not accept.

The fix normalizes boolean string values in _clean_package_data() by converting "true" and "false" to their corresponding Python boolean values (True / False) for fields defined as BooleanField in the DiscoveredPackage model.

Tests

Added a regression test in scanpipe/tests/pipes/test_pipes.py to ensure boolean string values are normalized correctly.

Checklist

  • I have read the contributing guidelines
  • I have linked an existing issue above
  • I have added unit tests covering the new code
  • I have reviewed and understood every line of this PR

…kage_data and add regression test

Signed-off-by: Monal Reddy <monalreddy001@gmail.com>
Signed-off-by: Monal-Reddy <monalreddy001@gmail.com>
Signed-off-by: Monal-Reddy <monalreddy001@gmail.com>
Signed-off-by: Monal-Reddy <monalreddy001@gmail.com>
Signed-off-by: Monal-Reddy <monalreddy001@gmail.com>
@Monal-Reddy
Copy link
Copy Markdown
Contributor Author

hi @AyanSinhaMahapatra I was able to reproduce the issue and validate fix locally, I tested it using django shell as running the full pipeline via UI was taking too long. Please review when convenient.

@tdruez
Copy link
Copy Markdown
Contributor

tdruez commented Mar 11, 2026

This has already been fixed on the toolkit side: aboutcode-org/scancode-toolkit#4631
See also #1986

@tdruez tdruez closed this Mar 11, 2026
@Monal-Reddy
Copy link
Copy Markdown
Contributor Author

ok, will check it, thankyou.

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.

Error creating DiscoveredPackage

2 participants