Skip to content

Added missing model fields #288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

marraes
Copy link

@marraes marraes commented Jul 27, 2025

Description

Some models in this library were out-to-date compared with API Reference. This PR is just normalizing this lib with the follow items according to the documentation

User

Added the fields external id and metadata.

Organization

Added the fields stripe customer id, external id and metadata.

Password Reset

Fixed password reset call in UserManagementApi, which was throwing a parse exception due to inconsistency in the json returned in the response (the user object returns inside a property called "user")

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR brings the WorkOS Kotlin SDK up to date with the official API Reference by adding missing fields to User and Organization models and fixing a JSON parsing issue in the password reset functionality.

User Model Updates: The User model now includes externalId (String) and metadata (Map<String, String>) fields. These changes cascade through the entire user management system including CreateUserOptions, UpdateUserOptions, and their respective builder classes, maintaining consistency across all user-related operations.

Organization Model Updates: Similarly, the Organization model gains three new fields: stripeCustomerId, externalId, and metadata. These additions are reflected in both CreateOrganizationOptions and UpdateOrganizationOptions classes with proper builder pattern support.

Password Reset Fix: A critical parsing issue in the resetPassword method has been resolved by introducing a UserResponse wrapper model. The WorkOS API returns user data wrapped in a 'user' property for this endpoint, but the previous implementation tried to deserialize directly to a User object, causing exceptions.

All new fields are nullable with appropriate default values, ensuring backward compatibility. The changes follow established patterns in the codebase with proper Jackson JSON annotations, comprehensive documentation, and updated test coverage.

PR Description Notes:

  • Minor typo: "follow items" should be "following items"

Confidence score: 2/5

  • This PR has a critical issue that could cause runtime exceptions for existing users
  • The User model's metadata field is marked as non-nullable while related classes treat it as nullable, creating a deserialization mismatch
  • Files that need immediate attention: src/main/kotlin/com/workos/usermanagement/models/User.kt

12 files reviewed, 3 comments

Edit Code Review Bot Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant