umccr / libica

:snake: Python SDK for Illumina Connected Analytics (ICA) :dragon:
MIT License
6 stars 4 forks source link

project_pipeline get_project_pipeline_configuration_parameters endpoint fails oneOf schema for settings attribute #129

Closed alexiswl closed 8 months ago

alexiswl commented 8 months ago

# Standard imports
from os import environ

# Local imports
from libica.openapi.v2 import Configuration
from libica.openapi.v2 import ApiClient, ApiException
from libica.openapi.v2.api.project_pipeline_api import ProjectPipelineApi
from libica.openapi.v2.model.pipeline_configuration_parameter_list import PipelineConfigurationParameterList

# Set configuration
icav2_configuration = Configuration(
    host=environ['ICAV2_BASE_URL'], 
    access_token=environ['ICAV2_ACCESS_TOKEN']
)

# Set variables
pipeline_id = "fdef5902-3f50-4ee7-ae17-15d38d4b489c"
project_id = "7595e8f2-32d3-4c76-a324-c6a85dae87b5"

# Enter a context with an instance of the API client
with ApiClient(icav2_configuration) as api_client:
    # Create an instance of the API class
    api_instance = ProjectPipelineApi(api_client)

    try:
        # Retrieve input parameters for a project pipeline.
        api_response: PipelineConfigurationParameterList = api_instance.get_project_pipeline_configuration_parameters(
            project_id, pipeline_id
        )
    except ApiException as e:
        raise ApiException("Exception when calling ProjectPipelineApi->get_project_pipeline_input_parameters: %s\n" % e)

print(api_response.items)

Has the following traceback

Traceback (most recent call last):
  File "/tmp/tmp.lVG7B2CW31/test.py", line 27, in <module>
    api_response: PipelineConfigurationParameterList = api_instance.get_project_pipeline_configuration_parameters(
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/api/project_pipeline_api.py", line 1829, in get_project_pipeline_configuration_parameters
    return self.get_project_pipeline_configuration_parameters_endpoint.call_with_http_info(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/api_client.py", line 854, in call_with_http_info
    return self.api_client.call_api(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/api_client.py", line 409, in call_api
    return self.__call_api(resource_path, method,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/api_client.py", line 224, in __call_api
    return_data = self.deserialize(
                  ^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/api_client.py", line 325, in deserialize
    deserialized_data = validate_and_convert_types(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1570, in validate_and_convert_types
    converted_instance = attempt_convert_item(
                         ^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1463, in attempt_convert_item
    raise conversion_exc
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1454, in attempt_convert_item
    return deserialize_model(input_value, valid_class,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1374, in deserialize_model
    return model_class._new_from_openapi_data(**kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 46, in wrapped_init
    return fn(_self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 370, in _new_from_openapi_data
    return cls._from_openapi_data(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 46, in wrapped_init
    return fn(_self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model/pipeline_configuration_parameter_list.py", line 173, in _from_openapi_data
    self.items = items
    ^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 185, in __setattr__
    self[attr] = value
    ~~~~^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 510, in __setitem__
    self.set_attribute(name, value)
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 157, in set_attribute
    value = validate_and_convert_types(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1620, in validate_and_convert_types
    input_value[index] = validate_and_convert_types(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1570, in validate_and_convert_types
    converted_instance = attempt_convert_item(
                         ^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1463, in attempt_convert_item
    raise conversion_exc
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1454, in attempt_convert_item
    return deserialize_model(input_value, valid_class,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1374, in deserialize_model
    return model_class._new_from_openapi_data(**kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 46, in wrapped_init
    return fn(_self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 370, in _new_from_openapi_data
    return cls._from_openapi_data(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 46, in wrapped_init
    return fn(_self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model/pipeline_configuration_parameter.py", line 200, in _from_openapi_data
    setattr(self, var_name, var_value)
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 185, in __setattr__
    self[attr] = value
    ~~~~^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 510, in __setitem__
    self.set_attribute(name, value)
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 157, in set_attribute
    value = validate_and_convert_types(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1570, in validate_and_convert_types
    converted_instance = attempt_convert_item(
                         ^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1463, in attempt_convert_item
    raise conversion_exc
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1454, in attempt_convert_item
    return deserialize_model(input_value, valid_class,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1374, in deserialize_model
    return model_class._new_from_openapi_data(**kw_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 46, in wrapped_init
    return fn(_self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 370, in _new_from_openapi_data
    return cls._from_openapi_data(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 46, in wrapped_init
    return fn(_self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model/settings.py", line 183, in _from_openapi_data
    composed_info = validate_get_composed_info(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1996, in validate_get_composed_info
    oneof_instance = get_oneof_instance(self.__class__, model_args, constant_args)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/UMCCR/GitHub/orcabus/.bssh_manager_venv/lib/python3.11/site-packages/libica/openapi/v2/model_utils.py", line 1879, in get_oneof_instance
    raise ApiValueError(
libica.openapi.v2.exceptions.ApiValueError: Invalid inputs given to generate an instance of Settings. Multiple oneOf schemas matched the inputs, but a max of one is allowed.
victorskl commented 8 months ago

Basically... to what I understood; the API spec say must be oneOf the values. However, the actual value/data on backend server the response say .. here got multiple i.e. anyOf. I could be wrong... 🤷

Anyhow made a quick fix with PR #132 to fast tack for us..!