Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QuerySpecValidator fails to catch errors when filterExpression has more than one objects #3424

Closed
DimitrisGk-iel opened this issue Sep 7, 2023 · 5 comments · Fixed by #3467
Assignees
Labels
api Feature related to the (REST) api bug Something isn't working
Milestone

Comments

@DimitrisGk-iel
Copy link

DimitrisGk-iel commented Sep 7, 2023

Bug Report

Describe the Bug

When we issue a EDC_QUERY_SPEC_TYPE query that has a filterExpresssion with more than one objects, QuerySpecValidator fails to catch it.
image

Expected Behavior

A message that the operandLeft is missing e.g.
{"message":"mandatory value 'https://w3id.org/edc/v0.0.1/ns/filterExpression/https://w3id.org/edc/v0.0.1/ns/operandLeft' is missing or it is blank","type":"ValidationFailure","path":"[https://w3id.org/edc/v0.0.1/ns/filterExpression/https://w3id.org/edc/v0.0.1/ns/operandLeft","invalidValue":null}]

Observed Behavior

SEVERE 2023-09-06T00:01:58.1307352 JerseyExtension: Unexpected exception caught
java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:208)
	at org.eclipse.edc.spi.query.Criterion$Builder.build(Criterion.java:132)
	at org.eclipse.edc.core.transform.transformer.to.JsonObjectToCriterionTransformer.transform(JsonObjectToCriterionTransformer.java:51)
	at org.eclipse.edc.core.transform.transformer.to.JsonObjectToCriterionTransformer.transform(JsonObjectToCriterionTransformer.java:29)
	at org.eclipse.edc.core.transform.Transfo

Steps to Reproduce

Steps to reproduce the behavior:

  1. Issue the above query to the /v3/assets/request endpoint
  2. See error

Context Information

  • Used version EDC v0.2.1

Detailed Description

If applicable, add screenshots and logs to help explain your problem.

Possible Implementation

CriterionValidator should be run on all filterExpression objects and not just the first one

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

Thanks for your contribution 🔥 We will take a look asap 🚀

@ndr-brt ndr-brt added bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification labels Sep 7, 2023
@github-actions
Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale Open for x days with no activity label Sep 22, 2023
@ndr-brt
Copy link
Member

ndr-brt commented Sep 25, 2023

At a glance, the issue should be caused by the wrong definition for the filterExpression validator, it should be verifyArrayItem instead of verifyObject.

.verifyObject(EDC_QUERY_SPEC_FILTER_EXPRESSION, CriterionValidator::instance);

@ndr-brt ndr-brt added bug Something isn't working api Feature related to the (REST) api and removed stale Open for x days with no activity bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification labels Sep 25, 2023
@ndr-brt ndr-brt added this to the Milestone 12 milestone Sep 25, 2023
@ndr-brt ndr-brt self-assigned this Sep 25, 2023
@arnoweiss
Copy link

logically, multiple filterExpressions are AND-chained, right?

@ndr-brt
Copy link
Member

ndr-brt commented Nov 16, 2023

@arnoweiss yes, they are

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Feature related to the (REST) api bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants