sailpoint-oss / python-sdk

MIT License
6 stars 3 forks source link

[Bug]: ManagedCluster Configurations model does not gracefully handle NoneType string values #25

Closed ianphilm closed 2 months ago

ianphilm commented 4 months ago

I believe the problem is here: configuration: Optional[Dict[str, StrictStr]] = Field(default=None, description="ManagedProcess configuration map")

I believe the presence of the "StrictStr" forces the model to throw when it's deserializing a ManagedCluster configurations dict that contains "NoneType" dict values. Full stacktrace below:

operationalSourceClusters = Paginator.paginate(BETA_MANAGED_CLUSTERS_API.get_managed_clusters, result_limit=MAX_RESULT_LIMIT, filters=sourceClusterFilter) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/sailpoint/paginator.py", line 33, in paginate results = T(*kwargs) ^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/pydantic/validate_call_decorator.py", line 59, in wrapper_function return validate_call_wrapper(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/pydantic/_internal/_validate_call.py", line 81, in call res = self.pydantic_validator.validate_python(pydantic_core.ArgsKwargs(args, kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/sailpoint/beta/api/managed_clusters_api.py", line 692, in get_managed_clusters return self.api_client.response_deserialize( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/sailpoint/beta/api_client.py", line 316, in response_deserialize return_data = self.deserialize(response_text, response_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/sailpoint/beta/api_client.py", line 392, in deserialize return self.deserialize(data, response_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/sailpoint/beta/api_client.py", line 408, in deserialize return [self.deserialize(sub_data, sub_kls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/sailpoint/beta/api_client.py", line 431, in deserialize return self.deserialize_model(data, klass) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/sailpoint/beta/api_client.py", line 733, in deserialize_model return klass.from_dict(data) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/sailpoint/beta/models/managed_cluster.py", line 161, in from_dict _obj = cls.model_validate({ ^^^^^^^^^^^^^^^^^^^^ File "/Users/imckenzie/code/corporate-identity-engineering/.venv/lib/python3.12/site-packages/pydantic/main.py", line 551, in model_validate return cls.__pydantic_validator__.validate_python( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pydantic_core._pydantic_core.ValidationError: 1 validation error for ManagedCluster configuration.debugTimestamp Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.7/v/string_type

From what I can tell, the api-specs repo representation of this object should not need to be changed: https://github.com/sailpoint-oss/api-specs/blob/main/idn/beta/schemas/ManagedCluster.yaml#L29

tyler-mairose-sp commented 2 months ago

Hey @ianphilm, this is fixed in https://github.com/sailpoint-oss/python-sdk/commit/af0ed6cfdcfc41afc5d7d492a61fe17782c1aa40 and will be in the next release.