Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

seems "nullable" is not understood by validator

See original GitHub issue

trying to use for OpenAPI3, validator wont understand

"responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {

So I have to bring “schema” up

oav = require('openapi-response-validator')
v = new oav.default({
    summary: "Sum",
    description: "Desc",
    parameters: [],
    responses: {
        "200": {
            description: "Ok",
            schema: {
                "type": "object",
                "properties": {
                    "msisdn": {
                        "type": "string"
                    "countryId": {
                        "type": "string",
                        "nullable": true
                "required": [

console.log(JSON.stringify(v.validateResponse('200', {"msisdn":"790000000000","countryId":null}), null, '  '))


  "message": "The response was not valid.",
  "errors": [
      "path": "countryId",
      "errorCode": "type.openapi.responseValidation",
      "message": "countryId should be string"

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

funduckcommented, Nov 29, 2018

just fixed it, will push to my fork soon. Just did what @jsdevel proposed

chadxzcommented, May 1, 2020

@jsdevel do you know if anything was ever pulled into the response validator to deal with nullable?

Edit: nevermind, I found it:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Validation error when field is nullable and consumer sends in ...
When an OpenAPI specification declares an enum, and specifies it as being nullable, the consumer can send the values: {... field: null ....
Read more >
Why is Express Validator not allowing null values in optional ...
On a hunch I tried reversing the method calls. This validator worked for me: body("date_field").isDate().optional({ nullable: true }),.
Read more >
Understanding JSON Schema
JSON Schema is a powerful tool for validating the structure of JSON data. However, learning to use it by reading its.
Read more >
Validation — oracle-tech
Hi all, I wish to add a validation to check on all items(text fields, select list, checkbox) and display that at least one...
Read more >
Validating form input - Angular
Async validators, Asynchronous functions that take a control instance and return a Promise or Observable that later emits a set of validation errors...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found