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

Json schema validation multipleof - not working #223

Closed
VimalKumarS opened this issue Dec 17, 2018 · 1 comment
Closed

Json schema validation multipleof - not working #223

VimalKumarS opened this issue Dec 17, 2018 · 1 comment
Labels

Comments

@VimalKumarS
Copy link

Using golang version 1.11
have json schema as follow
{
"$id": "table1__1",
"type": "object",
"title": "table1__1",
"$schema": "http://json-schema.org/draft-07/schame#",
"required": [
],
"properties": {
"col2": {
"type": "number",
"default": "",
"multipleOf": .001
}
},
"additionalProperties": false
}

for input json
{
"col2": 2.001
}

  • Returns error Must be multiple of 0.001
@johandorland
Copy link
Collaborator

Ok, turns out I should've read the go docs better and used big.Rat instead of big.Float. big.Float solved most peoples multipleOf issues before, but they are not arbitrary precision as I assumed, whereas big.Rat are as they use fractions.

The solution seems pretty easy so I'll have a fix up soon.

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

No branches or pull requests

2 participants