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

Policy Definition API does not accept unprefixed Operator instance name #3293

Closed
yurimssilva opened this issue Jul 13, 2023 · 2 comments
Closed
Labels
bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification

Comments

@yurimssilva
Copy link
Contributor

Bug Report

Description

The Policy Definition API does not accept unprefixed odrl:operator instance name values, but requires its @id.

Expected Behavior

The API should be capable of resolving to an Operator instance from its name.
This behavior can be observed in odrl:action, where it accepts use as a valid value.

Observed Behavior

Request

{
  "@context": {
    "@vocab": "https://w3id.org/edc/v0.0.1/ns/",
    "odrl": "http://www.w3.org/ns/odrl/2/"
  },
  "@type": "PolicyDefinition",
  "@id": "{{POLICY_ID}}",
  "policy": {
    "odrl:permission": {
      "odrl:action": "USE",
      "odrl:constraint": {
        "odrl:leftOperand": "BusinessPartnerNumber",
        "odrl:operator": "eq",
        "odrl:rightOperand": "BPN"
      }
    },
    "odrl:prohibition": [],
    "odrl:obligation": []
  }
}

Response

[
  {
    "message": "http://www.w3.org/ns/odrl/2/Operator property '@id' was missing",
    "type": "InvalidRequest",
    "path": null,
    "invalidValue": null
  },
  {
    "message": "ARRAY must be EQ, NEQ, GT, GEQ, LT, LEQ, IN, HAS_PART, IS_A, IS_ALL_OF, IS_ANY_OF, or IS_NONE_OF but was: unknown",
    "type": "InvalidRequest",
    "path": null,
    "invalidValue": null
  }
]

Steps to Reproduce

  1. Request creation of a Policy where its Constraint has a odrl:operator unprefixed instance name, such as in the observed behavior aforementioned.

Context Information

  • EDC version: v0.1.3
@yurimssilva yurimssilva added bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification labels Jul 13, 2023
@ndr-brt
Copy link
Member

ndr-brt commented Jul 13, 2023

This happens because without the odrl.jsonld context set, the json-ld engine does not know how to expand the "eq" operator correctly. Please try with this representation:

{
                  "@context": {
                    "@vocab": "https://w3id.org/edc/v0.0.1/ns/",
                    "odrl": "http://www.w3.org/ns/odrl/2/"
                  },
                  "@type": "PolicyDefinition",
                  "@id": "{{POLICY_ID}}",
                  "policy": {
                    "@context": "http://www.w3.org/ns/odrl.jsonld",
                    "permission": {
                      "action": "USE",
                      "constraint": {
                        "leftOperand": "BusinessPartnerNumber",
                        "operator": "eq",
                        "rightOperand": "BPN"
                      }
                    },
                    "prohibition": [],
                    "obligation": []
                  }
                }

this should be validated accordingly, but currently we don't have a Policy validator set.

@yurimssilva
Copy link
Contributor Author

It works fine for the Operator but it made another unexpected behavior show up in the Action expansion against what we have registered, but it is worth a new issue, this one is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification
Projects
None yet
Development

No branches or pull requests

2 participants