What I'm doing wrong? it's about validate body
See original GitHub issueHi! I need help, please.
I have a basic schema in which the name is required and I expect it returns an error message or HTTP bat request when the name is empty but not it just creates the record with the name empty.
the controller was created with the foal g rest-api entity
command
const companySchema = {
properties: {
name: { type: 'string' },
},
required: ['name'],
additionalProperties: false,
type: 'object',
};
@Post('/companies')
@ValidateBody(companySchema)
async create(ctx: Context) {
const company = await getRepository(Company).save(ctx.request.body);
return new HttpResponseCreated(company);
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Seeking Validation from the Wrong People Is Self-Destructive
People who have been abused, mistreated, hurt, or wronged in any other way almost universally seek validation.
Read more >Kip Moore - The Journey To Slowheart - YouTube
JOURNEY TO SLOWHEART includes several songs that appears on Kip Moore recent album SLOWHEART, available now: ...
Read more >Validation: The Most Powerful Relationship Skill You Were ...
1) they have lost trust and respect for each other and therefore don't show much empathy to each other, 2) they don't take...
Read more >What is Invalidation? 5 Things You Shouldn't Say
Validation doesn't necessarily mean we agree with another's subjective reality. Validation simply allows another person's emotional state a space to exist.
Read more >Emotional Invalidation: A Form of Emotional Abuse
Emotional invalidation is painful. Sometimes it's unintentional, but it's a sign of emotional abuse when done repeatedly and intentionally.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ups! my bad, I didn’t know. I tried in postman and it works 😇
you can close this, thanks!
Maybe Foal could have a way to execute hooks as well in the future.