Skip to content

Fix: deletion of ProjectProperties#57

Merged
nscuro merged 2 commits intoDependencyTrack:mainfrom
BastiaanN:fix-project-property-delete
Apr 14, 2026
Merged

Fix: deletion of ProjectProperties#57
nscuro merged 2 commits intoDependencyTrack:mainfrom
BastiaanN:fix-project-property-delete

Conversation

@BastiaanN
Copy link
Copy Markdown

@BastiaanN BastiaanN commented Apr 10, 2026

Deletion of project properties currently fails with the following error message:

{
  "status": 400,
  "title": "The provided JSON payload could not be mapped",
  "detail": "Cannot coerce empty String (\"\") to `alpine.model.IConfigProperty$PropertyType` value (but could if coercion was enabled using `CoercionConfig`)\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 92] (through reference chain: org.dependencytrack.model.ProjectProperty[\"propertyType\"])"
}

This happens because the ProjectProperty struct includes all fields when marshalling to json, including empty fields. The DT api does not allow an empty propertyType.

I thought about adding omitempty to all fields except groupName and propertyName but that might break semantics of the other calls. Instead, i created a new ProjectPropertyDelete struct that only includes the two fields needed for the delete endpoint.

I also used AI (Claude Opus 4.6) to generate tests for projectProperties, which i reviewed and modified carefully and take full responsibility for. I also noted that the GetAll method accepts PageOptions but that the API is not paginated at all. As a result totalCount is always returned as 0. This PR does not fix that.

@BastiaanN BastiaanN requested a review from nscuro as a code owner April 10, 2026 12:26
@owasp-dt-bot
Copy link
Copy Markdown

owasp-dt-bot commented Apr 10, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Signed-off-by: Bastiaan Nijkamp <b-github@wesnijk.nl>
@BastiaanN BastiaanN force-pushed the fix-project-property-delete branch from f8d1d54 to 69d1311 Compare April 10, 2026 12:27
@BastiaanN BastiaanN changed the title Fix deletion of ProjectProperties Fix: deletion of ProjectProperties Apr 10, 2026
Comment thread project_property.go Outdated
Signed-off-by: Bastiaan Nijkamp <b-github@wesnijk.nl>
@BastiaanN BastiaanN requested a review from nscuro April 14, 2026 11:20
@nscuro nscuro added the defect Something isn't working label Apr 14, 2026
Copy link
Copy Markdown
Member

@nscuro nscuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nscuro nscuro merged commit 0682699 into DependencyTrack:main Apr 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

defect Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants