Swagger path not recognized
See original GitHub issueHi!
When processing an example swagger definition hippie-swagger complains of an undefined path that is defined:
'use strict'
var SwaggerParser = require('swagger-parser')
var parser = new SwaggerParser()
var hippie = require('hippie-swagger')
var expect = require('chai').expect
var path = require('path')
var dereferencedSwagger
describe('Example of', function () {
before(function (done) {
parser.dereference('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/json/petstore.json', function (err, api) {
if (err) return done(err)
dereferencedSwagger = api
done()
})
})
describe('correct usage', function () {
it('should allow to post to /pets', function (done) {
hippie(dereferencedSwagger)
.json()
.post('/pets')
.expectStatus(200)
.end(done)
})
})
})
The answer I receive is:
$ mocha index.js
Example of
correct usage
1) should allow to post to /pets
0 passing (225ms)
1 failing
1) Example of correct usage should allow to post to /pets:
Error: Swagger spec does not define path: /pets
at Client.middleware (node_modules/hippie-swagger/lib/middleware.js:15:13)
at next (node_modules/hippie/lib/hippie/client.js:456:5)
at Client.setup (node_modules/hippie/lib/hippie/client.js:457:5)
at Client.prepare (node_modules/hippie/lib/hippie/client.js:364:17)
at Client.end (node_modules/hippie/lib/hippie/client.js:382:24)
at Context.<anonymous> (index.js:32:8)
By the way, thanks for this awesome project!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
swagger-codegen is not recognized as an internal or external ...
It depends. If you use absolute paths, there's no need to change the PATH . If you want to use just the file...
Read more >Path not found error for endpoint with trailing slash · Issue #899
Problem statement. Hello When I specify endpoints ending with a slash in my swagger file, at runtime when trying to reach the same...
Read more >Paths and Operations - Swagger
API paths and operations are defined in the global paths section of the API specification. All paths are relative to the API server...
Read more >Fix Swagger Validator errors in Power Platform connectors
The expected path is '{0}'. The dynamic properties extension item value path does not match the expected path based on the schema.
Read more >Can't get swagger docs recognized - OutSystems
ProtocolError: The remote server returned an error: (404) Not Found. ... the url path below swagger, and the url path that points to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lcofre ah! yes you can absolutely test non-node applications this way. You just have to include the full uri in the request. This isn’t well documented and I’ll make a note to build a full fledged example for this use case.
Here’s a working snippet that I tested locally:
And the example server (can be run by any language / backend):
Sorry! I supposed that with no app, it’ll try to test the “host” in the swagger definition or the server where the definition is hosted in. Is this not true?
Or in other words, can I only test NodeJS apps?
Thanks very much for your time!