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

proptypes - don't let valid values break validation #110

Merged
merged 9 commits into from
Apr 17, 2019
Merged

Conversation

chriddyp
Copy link
Member

Currently users may be providing True or False for boolean properties or numbers for numeric properties. This is valid. With our previous propTypes, these would fail under validation as they are not string.

This PR enables those boolean & numeric properties.

There is a lot more we could do here for deeper validation (e.g. incorporate https://github.com/iandevlin/html-attributes/blob/master/enumerated-attributes.json) however I’d like to keep this PR focused on making sure that existing user’s code doesn’t break (even if it might not be technically valid under the HTML5 spec).

@chriddyp chriddyp requested a review from byronz April 17, 2019 04:59
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chriddyp - nice catch. 💃

I notice oneOfType doesn't get propagated to the Python docstrings - so these just look like booleans now from the python side. Probably better than string as boolean supports both states, and also probably not worth addressing right now since dash-component-system will fix this
https://github.com/plotly/dash-component-system/blob/a95fee96f0bb6804b5f110a561d18aed0010ec85/dash_component_system/_component.py#L97-L106

@byronz byronz merged commit cda20be into master Apr 17, 2019
@byronz byronz deleted the proptypes branch April 17, 2019 14:54
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.

3 participants