-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Steps to reproduce
Probably related to this TODO in the code:
// TODO(bajtos): support model classes defined via ES5 constructor function
As part of our build process, we generate the OpenAPI models (using lb4 openapi), build them and include them as a node package. During startup of the rest server generateOpenAPISchema() is called to generate JSON to work with the model definitions.
Inside isTypeResolver, it attempts to figure out if the function is a class or a resolver, by using /^class/.test(fn.toString(). In my case, this doesn't pass, fn.toString() evaluates to:
function MainFilters(data) {
if (data != null && typeof data === 'object') {
Object.assign(this, data);
}
}
Obviously this is intended as an object constructor, but it's not detected. My current workaround is to check: if (fn.definition) return false; which seems to work ok.
Current Behavior
An exception is thrown by metaToJsonProperty.
Expected Behavior
An exception is not thrown.
Link to reproduction sandbox
Not able to provide a simple test, however I hope from the description that it makes sense.
Additional information
win32 x64 12.5.0
"@loopback/boot": "^1.5.10"
"@loopback/context": "^1.23.4"
"@loopback/core": "^1.10.6"
"@loopback/openapi-v3": "^1.10.0"
"@loopback/rest": "^1.22.0"
"@loopback/rest-explorer": "^1.4.3"
"@loopback/cli": "^1.24.0"
Related Issues
See Reporting Issues for more tips on writing good issues