Description
Expected behavior
When testing tools for the Orders API, I'd expect the tool name and the parameters to be validated.
Actual behavior (describe the problem)
When testing tools for the Orders API, only the tool name appears to be validated.
This seems to happen in the function _tool(). It looks like our tools get passed to _tool()
, which validates the tool name, but not the tool’s parameters.
For instance, for harmonize_tool() could get passed any sort of target sensor name and the test won’t fail, because it’s only looking to see if the tool name, ‘harmonize’, is a valid tool, not if the parameter, sensor_name
, is valid.
Related Issues
I created a ticket a month ago (#793), which sort of fixes this issue for harmonize_tool()
, but doesn’t really do so.
Workaround
None.
Minimum, Complete, Viable Code Sample
Current solution in planet.specs
:
def validate_tool(tool):
return _validate_field(tool, SUPPORTED_TOOLS, 'tool')
Proposed solution in planet.specs
:
def validate_tool_name(tool):
return _validate_field(tool, SUPPORTED_TOOLS, 'tool')
def validate_tool_parameter(parameter):
return _validate_field(parameter, SUPPORTED_PARAMS, 'parameter')
However, the issue here is that we'd be manually supplying SUPPORTED_PARAMS
, which is it's own issue, because we need to continually manually check these against the openAPI spec.