Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
acidiney authored Oct 24, 2021
1 parent 6087e8d commit 635788c
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The `MakeDto` function receive an array of object with this schema:
{
name: String,
serialize: String,
type: 'Number' | 'String' | 'Date' | 'Boolean' | 'Enum' | 'Object',
type: 'Number' | 'String' | 'Date' | 'Boolean' | 'Enum' | 'Object' | 'Array',
required: Boolean
}
```
Expand Down Expand Up @@ -70,6 +70,65 @@ MakeDto([
]
```
#### Array
For `Array` type you need to pass a `itemsType` prop. The `itemsType` specify what will be type of `array` that will be validated.
In case of using `Enum` or `Object` you need to pass as well the `enumOps` or `schema` prop too.
Eg-
```js
MakeDto([
{
name: 'fields',
serialize: 'fields',
required: true,
type: 'Array',
itemsType: 'Number'
}
]
```
or
```js
MakeDto([
{
name: 'fields',
serialize: 'fields',
required: true,
type: 'Array',
itemsType: 'Enum',
enumOps: ['accepted', 'nullable']
}
]
```
or
```js
MakeDto([
{
name: 'fields',
serialize: 'fields',
required: true,
type: 'Array',
itemsType: 'Object',
schema: [
{
name: 'StatusCode',
serialize: 'status_code',
required: true,
type: 'Number'
}
]
}
]
```
## Name
The `name` field is what key on object or array you will send. Eg. `{ fullName: 'Acidiney Dias' }`
Expand Down

0 comments on commit 635788c

Please sign in to comment.