Skip to content

not throwing error when optional input with no default#221

Open
grallewellyn wants to merge 1 commit intodevelopfrom
bug/optional-inputs
Open

not throwing error when optional input with no default#221
grallewellyn wants to merge 1 commit intodevelopfrom
bug/optional-inputs

Conversation

@grallewellyn
Copy link
Copy Markdown
Member

Only raise an error when no default and not optional. If optional and no default, don't pass anything
Also, show optional when listing information about params

I didn't get a reply to this on slack:

The code was originally written so that the parameter is assigned to it’s input value if it is passed: https://github.com/MAAP-Project/maap-api-nasa/blame/main/api/utils/hysds_util.py#L592

I.e. the current code
"inputs": {
}
will use the default if applicable, if not throw error

but then
"inputs": {
"bbox": ""
}
Will pass bbox as an empty string into HySDS even if bbox has a default value

Should I change the line to count an empty string as no input (i.e. would use the default if possible)?
Because for users using the UI, Marjorie could not pass the API the bbox argument if they left it empty
But technical users could override the default optional problem by passing bbox: “” to use nothing (this might cause problems for the user though if the input can’t be a string like Chuck said)

But I think we should keep as is and @marjo-luc should not pass the argument to the API if the user leaves it blank
If the user is technical and submitting their job from maap-py or the API, they should have the option to override the optional with a default problem by passing an empty string for the argument they actually want to leave empty
Also, we should keep the existing functionality that users have come to know

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant