Closed brownstein closed 5 years ago
Any chance of getting this merged? It seems to be the root cause for #19 as well.
Fix proposed just skips handling everything if Parameters are not available resulting in not having parameters added in Swagger. There was a proper fix for older version that was able to handle custom grouping, submitted by my friend and I, but pull request was not merged due to rewrite.
To fix this issue the right way, parameter grouping should be handled.
@Vaxter The alternative (current approach) seems to be to just crash, which also results in not having parameters added in Swagger. Not sure why this isn't a step in the right direction.
@brownstein https://github.com/fsbahman/apidoc-swagger/pull/25/commits/2d332e39a1a0847e1f39a1c6cc9c1b6f320fe9f1
Here, this is a step in the right direction. Now fields are generated, but needs additional work to handle mixing groups and handling form data cases. Also, apiDoc allows free form grouping, so better default group should also be handled. This was a quick fix, but should do the trick.
I'm using apidoc-swagger against a project which annotates URL parameters using a group named "URL Parameters" instead of the default, and I ran across some unsafe access patterns to the Parameters array.
Specifically,
var required = verbs.parameter && verbs.parameter.fields && verbs.parameter.fields.Parameter.length > 0;
on line 83 of apidocToSwagger.js makes an unsafe check, which causes an unhandled exception if "Parameter" is not defined.PR incoming.