-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly handle JSON String values for object type #48
Comments
Ironically, the reason this feature was removed was because of swagger-node-runner. What version of swagger-node-runner are you running? If it's not the latest, do you mind upgrading and trying with sway as-is? Let me know what you find out. |
It is the latest. Just spent the day fixing npm update issues :-) ─┬ swagger-restify-mw@0.6.0 |
Okay. I don't see why we can't just add this back and resurrect its tests but I'd love to let @theganyo chime in first. |
Also, if you don't mind could you create an issue in swagger-node-runner for this as well, for posterity? Link this issue in the issue description so that @theganyo has context. |
I don't recall any specific reason from prior discussions why this feature was removed. The only discussions I'm remembering were around not parsing when the type was indeterminate. But maybe I'm forgetting something? |
Could be. Maybe too much was removed. I'll add it back so that when we know the type is object and the value is a string, we try to parse it. We should do the same for arrays. |
When doing type conversion for strings when the expected type is
object
and the string contains a JSON encoded object, it is not converted to object.This breaks response validation in swagger-restify, which sets up connect middleware, which passes the body of the response to the validator as a string: https://github.com/theganyo/swagger-node-runner/blob/master/lib/connect_middleware.js#L162. I can't see what else it can do, and it would have worked before 473c6db.
The text was updated successfully, but these errors were encountered: