From 6a51a8fa32bd8016db00717c1207fd58b33c1a70 Mon Sep 17 00:00:00 2001 From: BinoyOza-okta Date: Thu, 2 Apr 2026 13:20:03 +0530 Subject: [PATCH] fix: Remove minLength constraint from UserProfile.secondEmail to allow empty strings The Okta API returns empty strings ("") for users without a secondary email, but the secondEmail field had a minLength: 5 constraint that caused Pydantic validation to fail during deserialization of valid API responses. Changes: - openapi/api.yaml: Remove minLength: 5 from UserProfile.secondEmail - okta/models/user_profile.py: Remove min_length=5 from second_email field The upstream OpenAPI spec fix was approved and merged. This aligns the SDK with the corrected spec. Testing: Verified on live org by fetching a user with secondEmail set to "" (empty string). The user deserializes successfully without validation errors. Fixes: OKTA-1146937 Refs: okta/okta-sdk-python#477, okta/okta-sdk-python#481 --- okta/models/user_profile.py | 4 +--- openapi/api.yaml | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/okta/models/user_profile.py b/okta/models/user_profile.py index c3180205..03678d39 100644 --- a/okta/models/user_profile.py +++ b/okta/models/user_profile.py @@ -188,9 +188,7 @@ class UserProfile(BaseModel): "https://datatracker.ietf.org/doc/html/rfc1808).", alias="profileUrl", ) - second_email: Optional[ - Annotated[str, Field(min_length=5, strict=True, max_length=100)] - ] = Field( + second_email: Optional[Annotated[str, Field(strict=True, max_length=100)]] = Field( default=None, description="The secondary email address of the user typically used for account recovery. For validation, " "see [RFC 5322 Section 3.2.3](https://datatracker.ietf.org/doc/html/rfc5322#section-3.2.3).", diff --git a/openapi/api.yaml b/openapi/api.yaml index 4c093b7c..76d63172 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -82223,7 +82223,6 @@ components: type: string format: email description: The secondary email address of the user typically used for account recovery. For validation, see [RFC 5322 Section 3.2.3](https://datatracker.ietf.org/doc/html/rfc5322#section-3.2.3). - minLength: 5 maxLength: 100 nullable: true state: