loopbackio / loopbackio/loopback-datasource-juggler
model default scope with inq causes TypeError: Right-hand side of 'instanceof' is not callable
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 282
- Forks
- 366
- Ø Merge
- 17 Std. 4 Min.
- Gemergte PRs (30 T.)
- 10
Beschreibung
Steps to reproduce
- Create a model including a property like:
"properties" : {
....
"list": {
"type": ["string"],
"index": true
}
...
}
- Add "scope" to the model like:
"scope": {
"where": {
"list": {
"inq": ["1", "2"]
}
}
}
- Add data which satisfies the scope. For example the values of list = ["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/eslint-config@8.0.4
+-- loopback@3.27.0
+-- loopback-boot@2.28.0
+-- loopback-component-explorer@6.5.1
+-- loopback-component-passport@3.12.0
+-- loopback-component-storage@3.7.0
+-- loopback-connector@4.11.1
+-- loopback-connector-postgresql@3.7.0
+-- loopback-datasource-juggler@4.24.0
Related Issues
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in loopback-datasource-juggler/lib/utils.js im Umfeld der Prüfung val instanceof prop.type und reproduziere den Model-Scope mit einer Eigenschaft aus einem Array von Strings und einem inq-Filter. Verfolge, wie der Eigenschaftstyp während der Scope-Auswertung dargestellt wird. Als abgeschlossen gilt die Aufgabe, wenn der GET passende Daten ohne TypeError zurückgibt und ein Regressionstest für diesen Fall vorhanden ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- database
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100