friendsofgo / killgrave

Simple way to generate mock servers written in Go
https://friendsofgo.github.io/killgrave/
MIT License
511 stars 96 forks source link

Add missing imposters validation #166

Open joanlopez opened 5 months ago

joanlopez commented 5 months ago

There are edge cases that aren't properly handled, that should be reviewed and managed adequately. For instance, what if the response field is empty, or it's an empty or null array.

We should try to:

yumski commented 4 months ago

Hey @joanlopez does this issue still need to be worked on? Will be happy to contribute if this still needs to be worked on.

joanlopez commented 4 months ago

Hey @yumski,

Sure, yes - please do it. I can even try to bring some help if needed. As suggested, I'd start by going over the code base and different features, and try to build a list. Then, we can analyze what would make sense and what not.

Thanks! 🙇🏻

Npsolver commented 2 months ago

Hey @joanlopez,

I'd like to contribute to this project. Is this still being worked on? If yes I'll try making a list of edge cases.

joanlopez commented 2 months ago

I'd like to contribute to this project. Is this still being worked on? If yes I'll try making a list of edge cases.

Of course! I haven't seen any progress from @yumski, so feel free to start working on it!

Npsolver commented 2 months ago

Hey @joanlopez,

I was going through the code and how the components work. I was trying out building a test server using the files under the folder internal/server/http/test/testdata/. But when I tested the endpoint /gophers it gave me:

2024/07/27 19:08:21 stat schemas/create_gopher_request.json: no such file or directory: the schema file schemas/create_gopher_request.json not found

whereas the file does exist. I'm not sure what the fix for this is. Can I get some help? Thanks.

joanlopez commented 2 months ago

Hey @npsolver, It looks like you caught a bug from one of our recent refactors, where we eliminated the afero dependency. Thanks for reporting it! Changes on #173 should make it work! 💪🏻

Npsolver commented 1 month ago

Hey @joanlopez, found a typo here: https://github.com/friendsofgo/killgrave/blob/bca67fd6ef0d38bb185e84792007289be2ded513/internal/server/http/route_matchers.go#L58 The _ should be replaced with err.

joanlopez commented 1 month ago

Hey @joanlopez, found a typo here:

https://github.com/friendsofgo/killgrave/blob/bca67fd6ef0d38bb185e84792007289be2ded513/internal/server/http/route_matchers.go#L58

The _ should be replaced with err.

Great catch @Npsolver, I have added it as part of https://github.com/friendsofgo/killgrave/pull/173. Thanks for pointing out!