Skip to content

Defect in QueryDSLBindings class while updating local field pathSpecs for ListPath [DATACMNS-1302] #1744

Open
@spring-projects-issues

Description

@spring-projects-issues

GT opened DATACMNS-1302 and commented

The method in question is below in QuerydslBindings class -

{{^private static String fromRootPath(Path<?> path) {

	Path<?> rootPath = path.getMetadata().getRootPath();

	if (rootPath == null) {
		throw new IllegalStateException(String.format("Couldn't find root path on path %s!", path));
	}

	return path.toString().substring(rootPath.getMetadata().getName().length() + 1);
}^}}

Let's say I have customized bindings for 3 paths for root object QUser with root name in generated metadata as "user":

  • user.userName
  • user.profile.internalSystemID
  • user.emails.any().value which gets internally translated as any(user.emails).value

When bindings are updated locally in pathSpecs, the logic in above method simply tries to strip the root object path name and following DOT, so in this case it ends up storing following 3 entries:

  • userName
  • profile.internalSystemID
  • ser.emails).value <--- this is a wrong key

During a subsequent phase when bindings are invoked, since invocation logic isn't able to find the binding using key "emails.value" (which is how the HTTP request parameter is expected to be named) in pathSpec, it uses the default binding which is obviously different from what we wanted.

Unfortunately it's a private static method, so we can override anything on our end. Also, we could have worked around it by trying to also register an alias with this binding but none of the binder methods exposed take alias an argument and hence when they internally construct AliasingPathBinder, the alias is always null.


No further details from DATACMNS-1302

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions