-
Notifications
You must be signed in to change notification settings - Fork 45
Adding a Parameter Type
Jonathan Stray edited this page Apr 1, 2019
·
10 revisions
Parameters have two aspects: data (DType) and field format (FType). data is what is passed to a module's render(): it loosely follows JSON. field format is what is displayed to the user: it loosely follows our React components.
For instance: if we're displaying a checkbox: FType=checkbox, DType=boolean.
To add an FType:
Server side:
- Add the type to
properties.parameters.items.properties.typeinserver/models/module_spec_schema.yaml - Add the type to the
ParamField.FTypeenum inserver/models/param_field.py - Add a case in
def dtype(self)for the newFType, mapping it to an existingDType - Test the new conversion in
server/tests/models/test_param_field.py
Client side:
- Create a new React component in a new file that renders the UI for the component
- Add a case to the lookup on component type in
Params.js - Jest tests for the above