dry-rb / dry-rb/dry-validation

JSON schema contract failing to recognise valid input

Open
#720 2 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
Ruby
Stars
1.4k
Forks
195
PR merge metrics
No merged PRs in 30d

Description

## Describe the bug

A json schema that is not picking up on valid input.

## To Reproduce

```
class TestContract < Dry::Validation::Contract
json do
required(:mykey?).value(:bool)
end
end

input = JSON.parse('{"mykey?": true }')

result = TestContract.new.call(input)
# #["is missing"]}>

result.to_h
# {}

result.errors
# #] options={}>
```

## Expected behavior

It should have picked up the input since it was conforming to the schema.

## My environment

- Affects my production application: **NO**
- Ruby version: 2.6.10
- OS: macOS 12.6

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.