-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
defining a nested array model property using @property.array decorator crashes the app #4754
Comments
@alyhegazy , are you extending from another model, is can you try :
This seems to work for me. |
@alyhegazy please ignore my previous comment, I get the same error. |
@deepakrkris the problem is in the |
@alyhegazy we are not supporting nested arrays But this is not well documented as well as the validation code above misses returning an appropriate error. |
@deepakrkris should I create a feature request for supporting it? As it's very likely to have nested arrays in a schema and it seems there's no way around it. What do you think? |
@alyhegazy , looks like we can achieve supporting nested arrays using json schema spec directly in @param() decorator . I am going to work on an example for this. If you are able to contribute with an example faster, that would be great as well. |
@deepakrkris I checked the acceptance criteria you proposed, they look great to me!
I like that you are including a task to improve the error message reported by LoopBack to make the problem easier to understand & troubleshoot for our users 👍 |
Steps to reproduce
define a nested array model property like the following
Current Behavior
The app crashes with the error
Cannot start the application. Error: "items" property must be present if "type" is an array
Expected Behavior
The nested array property should be defined without problems. Would be nice to also allow defining the type of the nested array for example
@property.array(Array<string>)
.Link to reproduction sandbox
Additional information
darwin x64 10.19.0
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
└── @loopback/[email protected]
Related Issues
See Reporting Issues for more tips on writing good issues
Acceptance Criteria
The text was updated successfully, but these errors were encountered: