nebulab / cangaroo

Connect Any App to Any Service
https://github.com/nebulab/cangaroo
MIT License
107 stars 18 forks source link

delete parameters from context.json_data before validating schema #23

Closed rohitnick closed 8 years ago

rohitnick commented 8 years ago

context.json_body can also include parameters in addition to request_id and summary, which is as per the guidelines given by wombat.

Therefore removing it from context.json_body before validating objects schema.

fixes #22

iloveitaly commented 8 years ago

@rohitnick What do you think about adding these parameters to the JSON schema as optional fields? Was there a reason that wouldn't work?

Thanks for your work here! Exciting to see this project pick up steam!

rohitnick commented 8 years ago

@iloveitaly Essentially what you are saying will definitely work and should be the right way of doing things. Adding the additional parameters to the JSON schema as optional fields will also solve this issue.

I was in a hurry and didn't wanted to go through the 'json-schema' gem so fixed the issue by removing the parameters.

bricesanchez commented 8 years ago

This PR helped me to go forward with my chaindrive_integration but i had a JSON Validator problem until i've made this change :

diff --git a/app/jobs/cangaroo/poll_job.rb b/app/jobs/cangaroo/poll_job.rb
index b152c07..9c49897 100644
--- a/app/jobs/cangaroo/poll_job.rb
+++ b/app/jobs/cangaroo/poll_job.rb
@@ -30,7 +30,7 @@ module Cangaroo
       command = HandleRequest.call(
         key: destination_connection.key,
         token: destination_connection.token,
-        json_body: response.to_json,
+        json_body: response,
         jobs: Rails.configuration.cangaroo.jobs
       )
AlessioRocco commented 8 years ago

@rohitnick can you rebase master and make specs pass? If you don't want do it let me know and I'll fix it.

rohitnick commented 8 years ago

@AlessioRocco : I can fix this but it can take me upto 48 hrs, as I am busy with other stuff. If you can fix it faster, please do. :)

AlessioRocco commented 8 years ago

@rohitnick I had some time today and I've fixed it with this PR, I've stolen the solution from you so thanks for your work.