Skip to content

Error "A binary operator with incompatible types was detected." when evaluating policies #844

@yorek

Description

@yorek

If a policy is defined as following:

"policy": {
  "database": "@claims.SeriesId eq @item.series_id"
}

it will generate a runtime error if SeriesId is a String and series_id is an integer.

For example, the claims is like the following:

{  
  "identityProvider": "test",
  "userId": "12345",
  "userDetails": "john@contoso.com",
  "userRoles": ["role1", "role2", "author"],
  "claims": [{
    "typ": "SeriesId",
    "val": "10000"
  }]
}

and the series_id column of the table underlying the entity is defined as integer, DAB will generate the following error:

{
  "error": {
    "code": "BadRequest",
    "message": "A binary operator with incompatible types was detected. Found operand types 'Edm.String' and 'Edm.Int32' for operator kind 'Equal'.",
    "status": 400
  }
}

Metadata

Metadata

Assignees

Labels

authbugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions