Skip to content

Accept nullable parameter #472

@ronildosouzafb

Description

@ronildosouzafb

current behavior

schema = {
  "type": "object",
  "properties": {
      "github_url": { "type": "string", "nullable": true }
    }
}

# => The property '#/github_url' of type null did not match the following type: string
JSON::Validator.validate!(schema, { "github_url" => null })

expected behavior

schema = {
  "type": "object",
  "properties": {
      "github_url": { "type": "string", "nullable": true }
    }
}

# => true
JSON::Validator.validate!(schema, { "github_url" => null })

also, without nullable attribute

schema = {
  "type": "object",
  "properties": {
      "github_url": { "type": "string" }
    }
}

# => The property '#/github_url' of type null did not match the following type: string
JSON::Validator.validate!(schema, { "github_url" => null })

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions