westfieldlabs / apivore

Tests your rails API against its Swagger description of end-points, models, and query parameters.
Apache License 2.0
213 stars 66 forks source link

route defaults not considered in path parameter substitutions #34

Closed gwshaw closed 9 years ago

gwshaw commented 9 years ago

Apivore does not look at the existing parameters as from a default in the routes file in making the path substitutions. For example, from the YML file

paths: '/centres/{centre_id}/movies.{format}':

Not supplying the {format} parameter in the APIvore hash will fail with "No substitution data found..." even though the parameter has been supplied by a default in the route file.

hornc commented 9 years ago

Apivore doesn't look at the routes file, so doesn't know about these application defaults, it is testing in the context of the Swagger documentation, however, the changes since Apivore v1.0 allow parameter defaults to be specified in let blocks, which can be used throughout the request spec, e.g. let(:params) { { "id" => 1, "format" => "json" } }

I think this addresses the issue as reported.