You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a tag was already attached to another project(tag T1 on project X), you can use the API to associate the tag T1 on project Y as well. But if you use the API to put a new tag T2 on project Y, it will fail with: "A tag with name T2 does not exist."
Steps to Reproduce
Use the Rest API to tag a project with a brand new tag name:
@Path("/{name}/project")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Operation(
summary = "Tags one or more projects.",
description = "<p>Requires permission <strong>PORTFOLIO_MANAGEMENT</strong></p>"
)````, it will call `org.dependencytrack.resources.v1.TagResource.tagProjects(String, Set<String>)`
An eror is obtained: "A tag with name T2 does not exist.""
Expected Behavior
The tag should be created automatically, persisted, and associated to the project, OR at least a REST API to properly create a tag should be provided. (By the way, please update the API descriptors, it looks like the API documentation is not updated)
org.dependencytrack.persistence.TagQueryManager.tagProjects(String, Collection)
runInTransaction(() -> {
final Tag tag = getTagByName(tagName);
if (tag == null) {
// TODO - CREATE HERE THE TAG,
throw new NoSuchElementException("A tag with name %s does not exist".formatted(tagName));
}
final Query<Project> projectsQuery = pm.newQuery(Project.class);
final var params = new HashMap<String, Object>(Map.of("uuids", projectUuids));
preprocessACLs(projectsQuery, ":uuids.contains(uuid)", params, /* bypass */ false);
projectsQuery.setNamedParameters(params);
final List<Project> projects = executeAndCloseList(projectsQuery);
for (final Project project : projects) {
bind(project, List.of(tag), /* keepExisting */ true);
}
});
}
Current Behavior
If a tag was already attached to another project(tag T1 on project X), you can use the API to associate the tag T1 on project Y as well. But if you use the API to put a new tag T2 on project Y, it will fail with: "A tag with name T2 does not exist."
Steps to Reproduce
Expected Behavior
The tag should be created automatically, persisted, and associated to the project, OR at least a REST API to properly create a tag should be provided. (By the way, please update the API descriptors, it looks like the API documentation is not updated)
org.dependencytrack.persistence.TagQueryManager.tagProjects(String, Collection)
Dependency-Track Version
4.12.6
Dependency-Track Distribution
Container Image
Database Server
PostgreSQL
Database Server Version
No response
Browser
Google Chrome
Checklist
The text was updated successfully, but these errors were encountered: