AppliedMathematicsANU / plexus-form

A dynamic form component for react using JSON-Schema.
MIT License
134 stars 31 forks source link

Parse typed values from enum #18

Closed martijnvermaat closed 9 years ago

martijnvermaat commented 9 years ago

Enum fields can have a type, for example set to integer, but are currently always being submitted as strings.

This fix just mirrors the parsing and normalizing logic from other type of fields. Actually, since the values can never be entered by the user, parsing shouldn't be necessary (but I left it in for symmetry).

An alternative way of fixing this would be to do a type-agnostic lookup in the enumerated values from the schema, and return that one (it should have the proper type). But I like the submitted fix better.

odf commented 9 years ago

Good idea! Thanks for that!