-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Description
Description
When I try to make a addPet request, I have the following error in the server log:
Error: Parameter (body) failed schema validation
at throwErrorWithCode (/Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/swagger-tools/lib/validators.js:121:13)
at Object.module.exports.validateAgainstSchema (/Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/swagger-tools/lib/validators.js:176:7)
at /Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/swagger-tools/middleware/swagger-validator.js:143:22
at /Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/async/lib/async.js:356:13
at async.forEachOf.async.eachOf (/Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/async/lib/async.js:233:13)
at _asyncMap (/Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/async/lib/async.js:355:9)
at Object.map (/Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/async/lib/async.js:337:20)
at validateValue (/Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/swagger-tools/middleware/swagger-validator.js:136:11)
at /Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/swagger-tools/middleware/swagger-validator.js:343:21
at /Users/martin/dev/tests/swagger/petstore/gen2/server/node_modules/async/lib/async.js:356:13
I generated a nodejs server and a qt5cpp client from the HEAD version.
Here is my code:
#include <QDebug>
#include <QCoreApplication>
#include <QTimer>
#include "client/SWGPetApi.h"
int main(int argc, char ** argv) {
QCoreApplication a(argc, argv);
using namespace Swagger;
SWGPetApi* api = new SWGPetApi();
api->host = "http://localhost:8080";
api->basePath = "/v2";
static QEventLoop loop;
QTimer timer;
timer.setInterval(14000);
timer.setSingleShot(true);
auto validator = []() {
// pet created
qDebug() << "Creation";
loop.quit();
};
QObject::connect(api, &SWGPetApi::addPetSignal, validator);
QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
SWGPet* pet = new SWGPet();
qint64 id = 32423434420393;
pet->setName(new QString("martin"));
pet->setId(id);
pet->setStatus(new QString("bluesy"));
api->addPet(*pet);
timer.start();
loop.exec();
}Swagger-codegen version
2.4.0-SNAPSHOT
Swagger declaration file content or url
https://gist.github.com/MartinDelille/c358209832ed023c1cd7ddb308db0099
Command line used for generation
For the server:
$ swagger-codegen generate -i ../api.yml -l nodejs-server
For the client:
$ swagger-codegen generate -i ../api.yml -l qt5cpp
Steps to reproduce
- Run the server
- Create a project linking the client files
- Perform a
addPetoperation - Look at the nodejs server log
Related issues/PRs
Not that I know.
Suggest a fix/enhancement
I'm quite new to nodejs and REST api connection so I'm afraid it'll be hard for me to suggest a fix. At least, I have a running development environment on my machine (and a PR on its way).
Metadata
Metadata
Assignees
Labels
No labels