sailpoint-oss / python-sdk

MIT License
6 stars 3 forks source link

export_form_definitions_by_tenant(): ValidationError: 7 validation errors for FormElement #24

Closed scott-fehrman-sp closed 3 months ago

scott-fehrman-sp commented 4 months ago

run: python3 test_CustomForms.py

code:

from typing import List
import sailpoint.v3
import sailpoint.beta
import json
from sailpoint.configuration import Configuration
from pydantic import StrictStr

configuration: Configuration = None
results: List[sailpoint.beta.ExportFormDefinitionsByTenant200ResponseInner] = None
result: sailpoint.beta.ExportFormDefinitionsByTenant200ResponseInner = None
data: str = None

configuration = Configuration()

with sailpoint.beta.ApiClient(configuration) as api_client:
    results = sailpoint.beta.CustomFormsApi(api_client).export_form_definitions_by_tenant() # ERROR
    result = results[0]
    data = result.model_dump_json(by_alias=True, indent=4)
    print(data)

Output:

Traceback (most recent call last):
  File "test_CustomForms.py", line 16, in <module>
    results = sailpoint.beta.CustomFormsApi(api_client).export_form_definitions_by_tenant()
  File "Library/Python/3.9/lib/python/site-packages/pydantic/validate_call_decorator.py", line 59, in wrapper_function
    return validate_call_wrapper(*args, **kwargs)
  File "/Library/Python/3.9/lib/python/site-packages/pydantic/_internal/_validate_call.py", line 81, in __call__
    res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/api/custom_forms_api.py", line 1590, in export_form_definitions_by_tenant
    return self.api_client.response_deserialize(
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/api_client.py", line 316, in response_deserialize
    return_data = self.deserialize(response_text, response_type)
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/api_client.py", line 392, in deserialize
    return self.__deserialize(data, response_type)
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/api_client.py", line 408, in __deserialize
    return [self.__deserialize(sub_data, sub_kls)
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/api_client.py", line 408, in <listcomp>
    return [self.__deserialize(sub_data, sub_kls)
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/api_client.py", line 431, in __deserialize
    return self.__deserialize_model(data, klass)
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/api_client.py", line 733, in __deserialize_model
    return klass.from_dict(data)
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/models/export_form_definitions_by_tenant200_response_inner.py", line 91, in from_dict
    "object": FormDefinitionResponse.from_dict(obj.get("object")) if obj.get("object") is not None else None,
  File "Library/Python/3.9/lib/python/site-packages/sailpoint/beta/models/form_definition_response.py", line 136, in from_dict
    "formElements": [FormElement.from_dict(_item) for _item in obj.get("formElements")] if obj.get("formElements") is not None else None,
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/models/form_definition_response.py", line 136, in <listcomp>
    "formElements": [FormElement.from_dict(_item) for _item in obj.get("formElements")] if obj.get("formElements") is not None else None,
  File "/Library/Python/3.9/lib/python/site-packages/sailpoint/beta/models/form_element.py", line 98, in from_dict
    _obj = cls.model_validate({
  File "/Library/Python/3.9/lib/python/site-packages/pydantic/main.py", line 532, in model_validate
    return cls.__pydantic_validator__.validate_python(
pydantic_core._pydantic_core.ValidationError: 7 validation errors for FormElement
config.alignment
  Input should be a valid dictionary [type=dict_type, input_value='CENTER', input_type=str]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type
config.description
  Input should be a valid dictionary [type=dict_type, input_value='My Cool Form', input_type=str]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type
config.formElements
  Input should be a valid dictionary [type=dict_type, input_value=[], input_type=list]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type
config.label
  Input should be a valid dictionary [type=dict_type, input_value='Welcome', input_type=str]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type
config.labelStyle
  Input should be a valid dictionary [type=dict_type, input_value='h1', input_type=str]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type
config.showLabel
  Input should be a valid dictionary [type=dict_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type
validations
  Input should be a valid dictionary [type=dict_type, input_value=[], input_type=list]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type
tyler-mairose-sp commented 3 months ago

@scott-fehrman-sp This is fixed in https://github.com/sailpoint-oss/python-sdk/commit/66096956ea2c8568d62e8d6d4b89ffb6e232c8cf and will be in the next release.