Closed viztastic closed 7 years ago
Can you create a simpler example that demonstrates your problems? Preferably one that doesn't have any notion of mongoDB or multiple routers and is contained in a single file.
How are you verifying that the objects are being created? Looking at your code, it looks like this route will always respond with a 200 because even in error
cases, you aren't returning early, so the 200
line will get called always.
As far as no proper error messaging... do you have an error handler in your router somewhere like https://github.com/continuationlabs/celebrate#celebrateerrors or something similar at the bottom of your routing table?
Ping @viztastic
No follow up. Closing.
node
version -6.7.0
celebrate
version -4.0.1
joi
version (vianpm ls --depth=0 | grep joi
) -10.2.0
My
joi
schema looks like this:Here is an example value that is not working as expected:
The issue I am having with
celebrate
is:Basically this goes ahead and creates an object without the
name
anddescription
keys (i.e. an object with just the mongo id), even though it is a compliant object. The same happens when the object is incorrectly sent (e.g. if i remove the name key from thePOST
submission)So there are three issues: