Skip to content

UserType response model discards all fields except id #535

@jychp

Description

@jychp

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
    Before submitting a bug report, we ask that you first search existing issues and pull requests to see if someone else may have experienced the same issue or may have already submitted a fix for it.

Python Version & Okta SDK Version(s)

  • okta==3.4.2
  • pydantic==2.12.5
  • Python 3.13

Affected Class/Method(s)

  • UserTypeApi.list_user_types()
  • UserTypeApi.get_user_type()
  • UserTypeApi.create_user_type()
  • UserTypeApi.replace_user_type()
  • UserTypeApi.update_user_type()

Customer Information

Organization Name: subimage
Paid Customer: yes

Code Snippet

  import asyncio
  from okta.client import Client as OktaClient

  async def main():
      client = OktaClient({"orgUrl": "https://<org>.okta.com", "token": "<token>"})
      user_types, resp, err = await client.list_user_types()
      assert err is None

      ut = user_types[0]
      print(ut.id)            # OK
      print(ut.name)          # AttributeError
      print(ut.display_name)  # AttributeError

  asyncio.run(main())

Debug Output / Traceback

https://gist.github.com/jychp/509b2997dd5341ea5597dac53876737a

Expected Behavior

The User Types endpoints should return typed objects exposing the full resource fields documented for GET /api/v1/meta/types/user, including:

  • id
  • name
  • displayName
  • description
  • default
  • createdBy
  • created
  • lastUpdatedBy
  • lastUpdated

Actual Behavior

client.list_user_types() returns UserType objects that only expose id.

Fields returned by the User Types API such as name, displayName, description, default, created, createdBy, lastUpdated, and lastUpdatedBy are dropped during deserialization and are not accessible on the returned Python object. Attempting to
access them raises AttributeError.

This appears to happen because okta.models.user_type.UserType only defines id, and UserType.from_dict() explicitly validates only:

{"id": obj.get("id")}

Steps to reproduce

  1. Install okta==3.4.2.
  2. Use an Okta org and API token that can call GET /api/v1/meta/types/user.
  3. Run the snippet
  4. Observe that only id is available on the returned UserType object.
  5. Compare with the raw HTTP response from the same endpoint, which includes fields such as name, displayName, description, default, created, createdBy, lastUpdated, and lastUpdatedBy.

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions