Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validating the response not compatible with OAS 3.0+ #9

Open
FMCorz opened this issue Jun 21, 2019 · 0 comments
Open

Validating the response not compatible with OAS 3.0+ #9

FMCorz opened this issue Jun 21, 2019 · 0 comments

Comments

@FMCorz
Copy link

FMCorz commented Jun 21, 2019

Validating the response value does not work as expected, the schema is not read from responses.[code].content.[media type].schema. Leading to the following error:

  swagger-tools:middleware:validator   Response validation: +2ms
  swagger-tools:middleware:validator     Response code: 200 +0ms
  swagger-tools:middleware:validator     Validation: failed +1ms
  swagger-tools:middleware:validator   Reason: Value at index 0 is not a valid void: [object Object] +0ms
  swagger-tools:middleware:validator   Stack: +8ms
  swagger-tools:middleware:validator       at throwErrorWithCode (oas3-tools/lib/validators.js:116:13) +0ms
  swagger-tools:middleware:validator       at oas3-tools/lib/validators.js:489:9 +0ms
  swagger-tools:middleware:validator       at arrayEach (lodash/lodash.js:516:11) +0ms
  swagger-tools:middleware:validator       at Function.forEach (lodash/lodash.js:9344:14) +0ms
  swagger-tools:middleware:validator       at validateTypeAndFormat (oas3-tools/lib/validators.js:487:7) +0ms
  swagger-tools:middleware:validator       at Object.module.exports.validateSchemaConstraints (oas3-tools/lib/validators.js:643:7) +0ms
  swagger-tools:middleware:validator       at validateValue (oas3-tools/middleware/swagger-validator.js:130:16) +0ms
  swagger-tools:middleware:validator       at ServerResponse.res.end (oas3-tools/middleware/swagger-validator.js:302:9) +0ms
  swagger-tools:middleware:validator       at exports.listPets (snip/controllers/pets.ts:5:7) +0ms
  swagger-tools:middleware:validator       at swaggerRouter (oas3-tools/middleware/swagger-router.js:388:20) +0ms
  connect:dispatcher <anonymous>  : /pets +11ms

I used the following spec, but I had to add to update the version to 3.0.1 or nothing happened (the server never started), and add the x-swagger-router-controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant