Fix optional inputs with None/empty string values in job submissions #44651
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Optional string inputs with
Noneor empty string values fail with "The Value field is required" error when submitting AzureML jobs, despite being marked asoptional=Truein component definitions.Root Cause
to_rest_dataset_literal_inputs()was creatingLiteralJobInputobjects forNoneand empty string values, violating REST API constraints (valuerequired, min_length=1).Changes
azure/ai/ml/entities/_job/_input_output_helpers.pyNonevalues to REST request{"value": None}and{"value": ""}tests/command_job/unittests/test_command_job_entity.pyCHANGELOG.mdExample
Backward compatible - only affects previously failing cases.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
pypi.org/home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.9/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-gea9m53z/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=40.8.0 /aio/operations/bash /aio/operations/--norc /aio/operations/--noprofile /aio/operations/_featurestore_entity_versions_operations.py(dns block)scanning-api.github.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>Bug: Optional
commandComponent Input Not Working—Fails When Argument Not Passed or Empty (AzureML SDK v2)</issue_title><issue_description>- Package Name:
azure-ai-mlDescribe the bug
When defining a
commandcomponent in AzureML SDK v2, a string input marked asoptional=Truewith a default value (or not) does not behave as expected.If I either omit the input or pass an empty string (""), I receive a
Request is invalid and/or missing fields. The Value field is required.error, even though the documentation states this is supported.To Reproduce
Steps to reproduce the behavior:
"tags"ininputs_run, or set"tags": "".Click for full error