Skip to content

model default scope with inq causes TypeError: Right-hand side of 'instanceof' is not callable  #1894

@ewrayjohnson

Description

@ewrayjohnson

Steps to reproduce

  1. Create a model including a property like:
  "properties" : {
    ....
    "list": {
        "type": ["string"],
        "index": true
      }
      ...
  }
  1. Add "scope" to the model like:
  "scope": {
    "where": {
      "list": {
        "inq": ["1", "2"]
      }
    }
  }
  1. Add data which satisfies the scope. For example the values of list = ["2"]
  2. Do a simple GET on the model via the REST API.

Current Behavior

Exception thrown is: "TypeError: Right-hand side of 'instanceof' is not callable" in loopback-datasource-juggler\lib\utils.js on or about line 67. The offending code is this clause:
val instanceof prop.type

Expected Behavior

No exception thrown and the data returned.

Link to reproduction sandbox

reproduction sandbox forthcoming

Additional information

If I put a try catch around the offending statement, everything works as expected.

win32 x64 12.18.3

+-- @loopback/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions