Closed arslanerdemm closed 9 months ago
apparently I can't add multiple reviewers.. feel free to review @Andy3189 @lierseleow
Validation doesnt work for me:
curl localhost:8080/v1/calc/co2 -X POST -H "Content-Type: application/json" -d '{}'
is valid json but should return errorcurl localhost:8080/v1/calc/co2 -X POST -H "Content-Type: application/json" -d '{"routes":[{"steps":[{"start":"Alexanderplatz","end":"Gesundbrunnnen","vehicle":"U8","distance":-1},{"start":"Gesundbrunnnen","end":"Westhafen","vehicle":"S41","distance":400}]}]}'
contains a negative distance, if the field is given, it should be validated tooVerification whether a start and endpoint or a distance is given works.
curl localhost:8080/v1/calc/co2 -X POST -H "Content-Type: application/json" -d '{}'
is valid json but should return errorthis is now fixed
curl localhost:8080/v1/calc/co2 -X POST -H "Content-Type: application/json" -d '{"routes":[{"steps":[{"start":"Alexanderplatz","end":"Gesundbrunnnen","vehicle":"U8","distance":-1},{"start":"Gesundbrunnnen","end":"Westhafen","vehicle":"S41","distance":400}]}]}'
contains a negative distance, if the field is given, it should be validated too
do I understand it correct, that if the distance is invalid but the start and end location are given, we should still validate the distance, even tho when we could calculate the distance ourselves?
curl localhost:8080/v1/calc/co2 -X POST -H "Content-Type: application/json" -d '{}'
is valid json but should return errorthis is now fixed
curl localhost:8080/v1/calc/co2 -X POST -H "Content-Type: application/json" -d '{"routes":[{"steps":[{"start":"Alexanderplatz","end":"Gesundbrunnnen","vehicle":"U8","distance":-1},{"start":"Gesundbrunnnen","end":"Westhafen","vehicle":"S41","distance":400}]}]}'
contains a negative distance, if the field is given, it should be validated toodo I understand it correct, that if the distance is invalid but the start and end location are given, we should still validate the distance, even tho when we could calculate the distance ourselves?
It makes the most sense to do it here, otherwise we have to do it later. Otherwise we have the headache of having to validate it later and check if start and endpoints and distances have valid values again
curl localhost:8080/v1/calc/co2 -X POST -H "Content-Type: application/json" -d '{}'
is valid json but should return errorthis is now fixed
curl localhost:8080/v1/calc/co2 -X POST -H "Content-Type: application/json" -d '{"routes":[{"steps":[{"start":"Alexanderplatz","end":"Gesundbrunnnen","vehicle":"U8","distance":-1},{"start":"Gesundbrunnnen","end":"Westhafen","vehicle":"S41","distance":400}]}]}'
contains a negative distance, if the field is given, it should be validated toodo I understand it correct, that if the distance is invalid but the start and end location are given, we should still validate the distance, even tho when we could calculate the distance ourselves?
It makes the most sense to do it here, otherwise we have to do it later. Otherwise we have the headache of having to validate it later and check if start and endpoints and distances have valid values again
should work as expected now, could you try again and lemme know? @Andy3189 @lierseleow
Id probably call the error message for no routes something along the lines of request must contain atleast one route, buts its okay
Edit: nvm its good like this
@lierseleow are you still experiencing the same issue with the curl request?
18 json validation from rest-api