Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Handling of integer value of zero #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

amitsrivastava
Copy link

Integer value of zero is being set to blank in React due to improper handling of these values. I add a function in objectUtils.js though I am not sure if that's the best place to keep it.

I had to revert a validation changes and it was throwing exception for me. You may ignore that revert if things are looking good to you.

@amitsrivastava
Copy link
Author

The commit "Validate properties from oneOf (86979b6)" is throwing me the following exception and that is why I had to revert it.

Uncaught TypeError: validator[type] is not a function

@ismaelga
Copy link
Owner

I can't replicate your issue. In http://ismaelga.github.io/react-json-editor/ 0 is parsed correctly both with number and integer types.

Use this schema to test it yourself

{
  "type": "object",
  "properties": {
    "integer": {
      "title": "Integer",
      "type": "integer"
    },
    "number": {
      "title": "Number",
      "type": "number"
     }
  }
}

@amitsrivastava
Copy link
Author

Strange. I tried the schema you just provided and fields show up as blank for me. I am passing {"integer": 0, "number": 0.0} as value.

@ismaelga
Copy link
Owner

Oh ok. I was testing it in a different way. I will try that later

On 29 Jan 2016, at 21:25, Amit Srivastava [email protected] wrote:

Strange. I tried the schema you just provided and fields show up as blank for me. I am passing {"integer": 0, "number": 0.0} as value.


Reply to this email directly or view it on GitHub #16 (comment).

@ismaelga
Copy link
Owner

ismaelga commented Feb 1, 2016

Can you send a new PR without the "Revert "Validate properties from oneOf"? I will fix it before merging

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

Successfully merging this pull request may close these issues.

2 participants