Closed shideneyu closed 8 years ago
Hi @shideneyu, thanks for getting in touch and reporting your issue.
The error message you are receiving is thrown when Apivore does not recognise (or cannot find) the Swagger version of your api spec. Currently Apivore only supports and validates Swagger 2.0, which is the current version. It is not yet backwards compatible with any earlier versions of swagger.
The way it checks for the swagger version is by looking for the property
"swagger":
which is a required field.
See https://github.com/westfieldlabs/apivore/blob/master/spec/data/sample2.0.json#L2 for an example.
The most likely cause is either you are using an older Swagger spec format, or that particular property is missing from your api.json
? Let me know if that doesn't explain it, and maybe provide a link the swagger spec so I can look into it further, thanks!
Thanks you, I think that you are entirely right:
api.json
{
"apiVersion": "0.1",
"swaggerVersion": "1.2",
"produces": [
"application/xml",
"application/json",
"application/octet-stream",
"text/plain"
],
"apis": [
{
"path": "/sites.{format}",
"description": "Operations about sites"
}
],
"info": {}
}
The thing is, I'm using grape-swagger , it is not compatible with Swagger 2.0.
Thanks you for your insight anyways !
Hi,
I followed the readme, installed apivore, but I get an issue that I can't manage to get rid of while running my specs
When I run my specs, I got this issue, that arises upon the call of
instance_for
forApivre::SwaggerChecker
:(after looking at the gem, I noticed that the variable 'version', alias of 'swagger' is nil (in
/lib/apivore/swagger.rb
); I added a debugger there for testing purposes and runned my tests upon it to discover this.)My spec:
By the way, as you can see in the attachment, my Swagger UI can successfully test the endpoint and renders 200, and the inputted url is
http://localhost:3000/api.json