Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Okay well I still stand my ground, I understand what you are saying about the validation of the "empty" object but take this kata for example, what happens if I pass an object to the function? Or garbage strings? Or a string with special characters? Would you say it's an error in the kata's design? Nop, because it escapes the kata's intention, and the author addresses this problem by explicitly putting in the description (in the notes section) that those scenarios will not be tested, and there are many katas like this so I don't really understand why this kata has to be the exception, it's not that I'm ignoring what could happen with "invalid" objects it's just that it escapes the kata's intention, and I'm making it clear in the description.
I think the whole problem is because the "REST API" title (and if that's the real issue I would gladly change it), my original intention was to use some of the concepts of what a REST API is and put together a fun challenge, I even said in the description the goal was to mimic the behaviour of what a backend framework do when it needs to handle an incoming request (hence the name of the method "dispatch"). There are plenty of katas with made up scenarios whose pure ultimate goal is make the dev come up with a solution to a fun problem or challenge and practice some of their coding skills, like this one, this one or this one. I intended my kata to be one of those fun challenges and I can see that at least 55 people had fun trying to solve it.
Hi there! First of all thank you for taking the time to review this kata, I will address your concerns here to avoid replying multiple times
I call an "empty object" an object that has no properties, I was confident the description of the kata could provide enough context to know what it was referring to. If this is a problem then how could I make it more clear in the description?
While I understand your annoyance towards how this kata handles the
GET/DELETE
requests receiving objects when in reality this is discouraged please keep in mind that this is my abstraction on this particular problem that is building an API. There could be thousands of different versions of this kata but the one that I found was easier for me to implement was simple passing a "request" object indicating theHTTP
method it needed.The kata says that if an object's property matches with the value of the query passed then it should be returned, I thought that part was self-explanatory since we are talking about basic primitive types such as numbers and strings, however if this is a problem how could I make it more clear in the description?
The kata always make
PUT
request based on the id property, which the kata says is unique for each person, so it does not affect multiple objects. TheDELETE
request does in fact remove multiple objects but because I thought of it more like "delete all where..." kind of deal, in that sense you are rigth it differs from typicalDELETE
request where you usually delete objects given an ID, but then again this kata is my particular abstraction on this problem.I want to finish this reply by saying that it seems unfair to me to get this kata back in the "beta" state since there is nothing wrong with the kata itself, the description is not misleading as is describes exactly what you need to do in order to solve it. I sincerely hope this kata gets published again soon.
Beta Status:Awaiting approval
Can a moderator approve this kata, please?
This comment is hidden because it contains spoiler information about the solution
The test cases have been updated to use
chai
instead of the old test framework.Done.
But why? Both Katas might be based on the same concept but they are developed in different ways. The problem setup, the code needed for the solution, and the test cases are very different.
Yeah, I'm sorry, to be honest, I tend to overthink stuff too much but yes, in fact, that's a much better solution and I have now fixed the test cases so that it checks for the correct
response
object according to the method.I genuinely didn't know about that Kata. Codewars didn't show it to me in the list of possible duplicates when I was creating mine.
I agree. I thought about creating a
Response
class, which encapsulates both the response code and the object array, but I didn't want it to be too complicated.Fixed.
Awesome kata 👌, but I think the description should clarify if the diagonals should also be counted.
Amazing kata! Solving it was equally fun and frustrating. Bravo 👌
Amazing kata! I really enjoyed solving it