This is part of the "A Pleasant and Productive Developer Experience" objective ❤️
Currently, we don't do any validation on property values of components. So, if you pass in
propTypes.oneOfType([
PropTypes.string,
PropTypes.null,
PropTypes.number,
PropTypes.node,
PropTypes.arrayOf(
propTypes.oneOfType([
PropTypes.string,
PropTypes.null,
PropTypes.number,
PropTypes.node,
])
)
])
This is part of the "A Pleasant and Productive Developer Experience" objective ❤️
Currently, we don't do any validation on property values of components. So, if you pass in
instead of
Dash will not raise an error but instead silently fail in the front-end, sometimes but not always showing the notorious "Error loading dependencies" error message.
We have all of the prop-type values available in the component's
metadata.jsonfiles, extracted from the component'spropTypes.For example, here is the
Dropdown.react.jsprop types:https://github.com/plotly/dash-core-components/blob/7c2b102c680d9fe0cb9df61f1682feccfa3ddc05/src/components/Dropdown.react.js#L101-L180
and here is it's associated JSON types:
https://github.com/plotly/dash-core-components/blob/7c2b102c680d9fe0cb9df61f1682feccfa3ddc05/dash_core_components/metadata.json#L810-L946
So, implementing prop type checking would involve:
childrenaren't sufficiently described. For example,childrenis most explicitly:metadata.jsonproperty types to raise helpful error messages. I used the Cerberus package recently for type-checking and I think it's a really good fit for this project. It has a declarative structure for describing nested properties that is very similar to the structure inmetadata.json