While chasing down pydantic validation issues, I ran into this one which appears to be internal. If one attempts to call list_policies(type="ACCESS_POLICY"), it immediately triggers a pydantic validation exception before returning anything.
Organization Name: This is a bug, not a support request.
Paid Customer: yes
Traceback (most recent call last):
File "/./script.py", line 333, in <module>
asyncio.run(main())
~~~~~~~~~~~^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.11/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.11/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.11/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/./script.py", line 218, in main
await okta_client.list_policies(type="ACCESS_POLICY")
File "/venv/lib/python3.13/site-packages/pydantic/_internal/_validate_call.py", line 35, in wrapper_function
return await wrapper(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.13/site-packages/okta/api/policy_api.py", line 2487, in list_policies
resp = self.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
File "/venv/lib/python3.13/site-packages/okta/api_client.py", line 369, in response_deserialize
return_data = self.deserialize(response_text, response_type)
File "/venv/lib/python3.13/site-packages/okta/api_client.py", line 448, in deserialize
return self.__deserialize(data, response_type)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.13/site-packages/okta/api_client.py", line 466, in __deserialize
return [self.__deserialize(sub_data, sub_kls) for sub_data in data]
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.13/site-packages/okta/api_client.py", line 491, in __deserialize
return self.__deserialize_model(data, klass)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/venv/lib/python3.13/site-packages/okta/api_client.py", line 828, in __deserialize_model
return klass.from_dict(data)
~~~~~~~~~~~~~~~^^^^^^
File "/venv/lib/python3.13/site-packages/okta/models/policy.py", line 218, in from_dict
return models.AccessPolicy.from_dict(obj)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "/venv/lib/python3.13/site-packages/okta/models/access_policy.py", line 122, in from_dict
_obj = cls.model_validate(
{
...<16 lines>...
}
)
File "/venv/lib/python3.13/site-packages/pydantic/main.py", line 732, in model_validate
return cls.__pydantic_validator__.validate_python(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
obj,
^^^^
...<5 lines>...
by_name=by_name,
^^^^^^^^^^^^^^^^
)
^
pydantic_core._pydantic_core.ValidationError: 1 validation error for AccessPolicy
_embedded.resourceType
Input should be a valid dictionary [type=dict_type, input_value='APP', input_type=str]
For further information visit https://errors.pydantic.dev/2.13/v/dict_type
That this would return the list-of-dicts of access policies and not fail validating itself
It hits the above exception when calling the method.
Community Note
While chasing down pydantic validation issues, I ran into this one which appears to be internal. If one attempts to call
list_policies(type="ACCESS_POLICY"), it immediately triggers a pydantic validation exception before returning anything.Python Version & Okta SDK Version(s)
Python v3.13.11
okta 3.4.4
Affected Class/Method(s)
AccessPolicy.from_dict
Customer Information
Organization Name: This is a bug, not a support request.
Paid Customer: yes
Code Snippet
Debug Output / Traceback
Expected Behavior
That this would return the list-of-dicts of access policies and not fail validating itself
Actual Behavior
It hits the above exception when calling the method.
Steps to reproduce
References
No response