loopbackio / loopbackio/loopback-next
property.array generates incorrect schema
Open
@achrinza is already working on this.
Since Feb 22, 2020.
bug
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1.1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
Here is the gist of code for easy replication.
Steps to reproduce
@property.array(String, {
jsonSchema: {
items: {
"type": "string",
"format": "email",
"minLength": 5,
"maxLength": 50,
"transform": ["toLowerCase"]
},
},
uniqueItems: true,
})
emails?: string[];
Current Behavior
Notice the nested items objects created.
"emails":{
"type":"array",
"items":{
"type":"string",
"items":{
"type":"string",
"format":"email",
"minLength":5,
"maxLength":50,
"transform":[
"toLowerCase"
]
}
}
}
Expected Behavior
"emails":{
"type":"string",
"items":{
"type":"string",
"format":"email",
"minLength":5,
"maxLength":50,
"transform":[
"toLowerCase"
]
},
"uniqueItems":true
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.