From d3797c4512bbc8a47017cc42855474693ea2bbd2 Mon Sep 17 00:00:00 2001 From: BinoyOza-okta Date: Tue, 17 Mar 2026 12:49:57 +0530 Subject: [PATCH 1/4] fix: handle nullable discriminator fields in JWKS models Fixes deserialization failures when Okta API returns null values for discriminator fields in JWKS (JSON Web Key) responses. Changes: - Updated OpenAPI spec to mark JWKS fields as nullable (created, lastUpdated, kty, alg, use, e, n) - Added null discriminator handling in model_generic.mustache template - Updated documentation to reflect nullable fields All changes are template-based to survive SDK regeneration. Resolves customer-reported issues where list_applications() failed with "ValueError: Failed to lookup data type from the field `use`" when JWKS keys contained null values. --- docs/OAuth2ClientJsonSigningKeyResponse.md | 10 ++-- docs/OAuth2ClientJsonWebKeyRsaResponse.md | 4 +- okta/models/action_provider.py | 5 ++ okta/models/app_config.py | 5 ++ okta/models/application_feature.py | 5 ++ okta/models/authenticator_base.py | 5 ++ okta/models/authenticator_method_base.py | 5 ++ ...cator_method_with_verifiable_properties.py | 5 ++ okta/models/authenticator_simple.py | 5 ++ okta/models/available_action_provider.py | 5 ++ okta/models/behavior_rule.py | 5 ++ okta/models/device_assurance.py | 5 ++ ...lment_policy_authenticator_grace_period.py | 5 ++ okta/models/inline_hook_channel.py | 5 ++ okta/models/inline_hook_channel_create.py | 5 ++ okta/models/log_stream.py | 5 ++ okta/models/log_stream_put_schema.py | 5 ++ okta/models/network_zone.py | 5 ++ ..._auth2_client_json_signing_key_response.py | 57 ++++++++++++++++--- ...o_auth2_client_json_web_key_ec_response.py | 25 ++++++++ ..._auth2_client_json_web_key_rsa_response.py | 33 ++++++++++- okta/models/policy.py | 5 ++ okta/models/policy_rule.py | 5 ++ okta/models/privileged_resource.py | 5 ++ okta/models/push_provider.py | 5 ++ .../registration_inline_hook_request.py | 5 ++ okta/models/service_account.py | 5 ++ okta/models/user_factor.py | 5 ++ okta/models/user_factor_push_transaction.py | 5 ++ okta/models/user_risk_get_response.py | 5 ++ okta/models/validation_detail_provider.py | 5 ++ okta/models/verification_method.py | 5 ++ openapi/api.yaml | 22 +++---- openapi/templates/model_generic.mustache | 5 ++ 34 files changed, 260 insertions(+), 31 deletions(-) diff --git a/docs/OAuth2ClientJsonSigningKeyResponse.md b/docs/OAuth2ClientJsonSigningKeyResponse.md index 249892c2..6292a6b1 100644 --- a/docs/OAuth2ClientJsonSigningKeyResponse.md +++ b/docs/OAuth2ClientJsonSigningKeyResponse.md @@ -7,14 +7,14 @@ A [JSON Web Key (JWK)](https://tools.ietf.org/html/rfc7517) is a JSON representa Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | The unique ID of the OAuth Client JSON Web Key | [readonly] -**created** | **str** | Timestamp when the OAuth 2.0 client JSON Web Key was created | [readonly] -**last_updated** | **str** | Timestamp when the OAuth 2.0 client JSON Web Key was updated | [readonly] +**created** | **str** | Timestamp when the OAuth 2.0 client JSON Web Key was created | [optional] [readonly] +**last_updated** | **str** | Timestamp when the OAuth 2.0 client JSON Web Key was updated | [optional] [readonly] **links** | [**OAuthClientSecretLinks**](OAuthClientSecretLinks.md) | | [optional] **kid** | **str** | Unique identifier of the JSON Web Key in the OAuth 2.0 client's JWKS | [optional] **status** | **str** | Status of the OAuth 2.0 client JSON Web Key | [optional] -**kty** | **str** | Cryptographic algorithm family for the certificate's key pair | -**alg** | **str** | Algorithm used in the key | -**use** | **str** | Acceptable use of the JSON Web Key | +**kty** | **str** | Cryptographic algorithm family for the certificate's key pair | [optional] +**alg** | **str** | Algorithm used in the key | [optional] +**use** | **str** | Acceptable use of the JSON Web Key | [optional] ## Example diff --git a/docs/OAuth2ClientJsonWebKeyRsaResponse.md b/docs/OAuth2ClientJsonWebKeyRsaResponse.md index 4d2aa5e6..a200fba0 100644 --- a/docs/OAuth2ClientJsonWebKeyRsaResponse.md +++ b/docs/OAuth2ClientJsonWebKeyRsaResponse.md @@ -6,8 +6,8 @@ An RSA signing key Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**e** | **str** | RSA key value (exponent) for key binding | -**n** | **str** | RSA key value (modulus) for key binding | +**e** | **str** | RSA key value (exponent) for key binding | [optional] +**n** | **str** | RSA key value (modulus) for key binding | [optional] ## Example diff --git a/okta/models/action_provider.py b/okta/models/action_provider.py index 415fdc1c..9fd3ae55 100644 --- a/okta/models/action_provider.py +++ b/okta/models/action_provider.py @@ -112,6 +112,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[Union[WorkflowActionProvider """Create an instance of ActionProvider from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "WorkflowActionProvider": diff --git a/okta/models/app_config.py b/okta/models/app_config.py index 35267377..1204e49b 100644 --- a/okta/models/app_config.py +++ b/okta/models/app_config.py @@ -107,6 +107,11 @@ def from_dict( """Create an instance of AppConfig from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AppConfigActiveDirectory": diff --git a/okta/models/application_feature.py b/okta/models/application_feature.py index a21b61d2..0bb62d60 100644 --- a/okta/models/application_feature.py +++ b/okta/models/application_feature.py @@ -140,6 +140,11 @@ def from_dict( """Create an instance of ApplicationFeature from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "InboundProvisioningApplicationFeature": diff --git a/okta/models/authenticator_base.py b/okta/models/authenticator_base.py index b7a99dd5..0a06cfe3 100644 --- a/okta/models/authenticator_base.py +++ b/okta/models/authenticator_base.py @@ -227,6 +227,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of AuthenticatorBase from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AuthenticatorKeyCustomApp": diff --git a/okta/models/authenticator_method_base.py b/okta/models/authenticator_method_base.py index 6df59a40..648802dc 100644 --- a/okta/models/authenticator_method_base.py +++ b/okta/models/authenticator_method_base.py @@ -176,6 +176,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of AuthenticatorMethodBase from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AuthenticatorMethodWithVerifiableProperties": diff --git a/okta/models/authenticator_method_with_verifiable_properties.py b/okta/models/authenticator_method_with_verifiable_properties.py index f157b6a4..3e1ef88e 100644 --- a/okta/models/authenticator_method_with_verifiable_properties.py +++ b/okta/models/authenticator_method_with_verifiable_properties.py @@ -180,6 +180,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of AuthenticatorMethodWithVerifiableProperties from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AuthenticatorMethodWithVerifiableProperties": diff --git a/okta/models/authenticator_simple.py b/okta/models/authenticator_simple.py index aa461df4..690e830f 100644 --- a/okta/models/authenticator_simple.py +++ b/okta/models/authenticator_simple.py @@ -192,6 +192,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of AuthenticatorSimple from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AuthenticatorKeyCustomApp": diff --git a/okta/models/available_action_provider.py b/okta/models/available_action_provider.py index 4affa78e..dece095b 100644 --- a/okta/models/available_action_provider.py +++ b/okta/models/available_action_provider.py @@ -121,6 +121,11 @@ def from_dict( """Create an instance of AvailableActionProvider from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "WorkflowAvailableActionProvider": diff --git a/okta/models/behavior_rule.py b/okta/models/behavior_rule.py index 31a93a71..23fe7ef4 100644 --- a/okta/models/behavior_rule.py +++ b/okta/models/behavior_rule.py @@ -177,6 +177,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of BehaviorRule from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "BehaviorRuleASN": diff --git a/okta/models/device_assurance.py b/okta/models/device_assurance.py index 1103f849..0a5896d6 100644 --- a/okta/models/device_assurance.py +++ b/okta/models/device_assurance.py @@ -218,6 +218,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of DeviceAssurance from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "DeviceAssuranceAndroidPlatform": diff --git a/okta/models/enrollment_policy_authenticator_grace_period.py b/okta/models/enrollment_policy_authenticator_grace_period.py index 7a2ab2b0..733c9eca 100644 --- a/okta/models/enrollment_policy_authenticator_grace_period.py +++ b/okta/models/enrollment_policy_authenticator_grace_period.py @@ -122,6 +122,11 @@ def from_dict( """Create an instance of EnrollmentPolicyAuthenticatorGracePeriod from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "ByDateTimeAuthenticatorGracePeriodExpiry": diff --git a/okta/models/inline_hook_channel.py b/okta/models/inline_hook_channel.py index 49ddc1b9..3160040e 100644 --- a/okta/models/inline_hook_channel.py +++ b/okta/models/inline_hook_channel.py @@ -117,6 +117,11 @@ def from_dict( """Create an instance of InlineHookChannel from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "InlineHookChannelHttp": diff --git a/okta/models/inline_hook_channel_create.py b/okta/models/inline_hook_channel_create.py index 7ce093b3..5679549a 100644 --- a/okta/models/inline_hook_channel_create.py +++ b/okta/models/inline_hook_channel_create.py @@ -119,6 +119,11 @@ def from_dict( """Create an instance of InlineHookChannelCreate from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "InlineHookChannelHttpCreate": diff --git a/okta/models/log_stream.py b/okta/models/log_stream.py index 3ac575d5..1a5de6f7 100644 --- a/okta/models/log_stream.py +++ b/okta/models/log_stream.py @@ -159,6 +159,11 @@ def from_dict( """Create an instance of LogStream from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "LogStreamAws": diff --git a/okta/models/log_stream_put_schema.py b/okta/models/log_stream_put_schema.py index 6d159736..ff0e01df 100644 --- a/okta/models/log_stream_put_schema.py +++ b/okta/models/log_stream_put_schema.py @@ -114,6 +114,11 @@ def from_dict( """Create an instance of LogStreamPutSchema from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "LogStreamAwsPutSchema": diff --git a/okta/models/network_zone.py b/okta/models/network_zone.py index f28bdf64..a1e32bf8 100644 --- a/okta/models/network_zone.py +++ b/okta/models/network_zone.py @@ -172,6 +172,11 @@ def from_dict( """Create an instance of NetworkZone from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "DynamicNetworkZone": diff --git a/okta/models/o_auth2_client_json_signing_key_response.py b/okta/models/o_auth2_client_json_signing_key_response.py index c36cb201..be456587 100644 --- a/okta/models/o_auth2_client_json_signing_key_response.py +++ b/okta/models/o_auth2_client_json_signing_key_response.py @@ -51,10 +51,12 @@ class OAuth2ClientJsonSigningKeyResponse(BaseModel): """ # noqa: E501 id: StrictStr = Field(description="The unique ID of the OAuth Client JSON Web Key") - created: StrictStr = Field( - description="Timestamp when the OAuth 2.0 client JSON Web Key was created" + created: Optional[StrictStr] = Field( + default=None, + description="Timestamp when the OAuth 2.0 client JSON Web Key was created", ) - last_updated: StrictStr = Field( + last_updated: Optional[StrictStr] = Field( + default=None, description="Timestamp when the OAuth 2.0 client JSON Web Key was updated", alias="lastUpdated", ) @@ -66,11 +68,16 @@ class OAuth2ClientJsonSigningKeyResponse(BaseModel): status: Optional[StrictStr] = Field( default=None, description="Status of the OAuth 2.0 client JSON Web Key" ) - kty: StrictStr = Field( - description="Cryptographic algorithm family for the certificate's key pair" + kty: Optional[StrictStr] = Field( + default=None, + description="Cryptographic algorithm family for the certificate's key pair", + ) + alg: Optional[StrictStr] = Field( + default=None, description="Algorithm used in the key" + ) + use: Optional[StrictStr] = Field( + default=None, description="Acceptable use of the JSON Web Key" ) - alg: StrictStr = Field(description="Algorithm used in the key") - use: StrictStr = Field(description="Acceptable use of the JSON Web Key") __properties: ClassVar[List[str]] = [ "id", "created", @@ -96,6 +103,9 @@ def status_validate_enum(cls, value): @field_validator("kty") def kty_validate_enum(cls, value): """Validates the enum""" + if value is None: + return value + if value not in set(["RSA", "EC"]): raise ValueError("must be one of enum values ('RSA', 'EC')") return value @@ -103,6 +113,9 @@ def kty_validate_enum(cls, value): @field_validator("use") def use_validate_enum(cls, value): """Validates the enum""" + if value is None: + return value + if value not in set(["sig"]): raise ValueError("must be one of enum values ('sig')") return value @@ -182,11 +195,36 @@ def to_dict(self) -> Dict[str, Any]: else: _dict["_links"] = self.links + # set to None if created (nullable) is None + # and model_fields_set contains the field + if self.created is None and "created" in self.model_fields_set: + _dict["created"] = None + + # set to None if last_updated (nullable) is None + # and model_fields_set contains the field + if self.last_updated is None and "last_updated" in self.model_fields_set: + _dict["lastUpdated"] = None + # set to None if kid (nullable) is None # and model_fields_set contains the field if self.kid is None and "kid" in self.model_fields_set: _dict["kid"] = None + # set to None if kty (nullable) is None + # and model_fields_set contains the field + if self.kty is None and "kty" in self.model_fields_set: + _dict["kty"] = None + + # set to None if alg (nullable) is None + # and model_fields_set contains the field + if self.alg is None and "alg" in self.model_fields_set: + _dict["alg"] = None + + # set to None if use (nullable) is None + # and model_fields_set contains the field + if self.use is None and "use" in self.model_fields_set: + _dict["use"] = None + return _dict @classmethod @@ -198,6 +236,11 @@ def from_dict( """Create an instance of OAuth2ClientJsonSigningKeyResponse from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "OAuth2ClientJsonWebKeyECResponse": diff --git a/okta/models/o_auth2_client_json_web_key_ec_response.py b/okta/models/o_auth2_client_json_web_key_ec_response.py index c7c8e415..dacd03b8 100644 --- a/okta/models/o_auth2_client_json_web_key_ec_response.py +++ b/okta/models/o_auth2_client_json_web_key_ec_response.py @@ -112,11 +112,36 @@ def to_dict(self) -> Dict[str, Any]: else: _dict["_links"] = self.links + # set to None if created (nullable) is None + # and model_fields_set contains the field + if self.created is None and "created" in self.model_fields_set: + _dict["created"] = None + + # set to None if last_updated (nullable) is None + # and model_fields_set contains the field + if self.last_updated is None and "last_updated" in self.model_fields_set: + _dict["lastUpdated"] = None + # set to None if kid (nullable) is None # and model_fields_set contains the field if self.kid is None and "kid" in self.model_fields_set: _dict["kid"] = None + # set to None if kty (nullable) is None + # and model_fields_set contains the field + if self.kty is None and "kty" in self.model_fields_set: + _dict["kty"] = None + + # set to None if alg (nullable) is None + # and model_fields_set contains the field + if self.alg is None and "alg" in self.model_fields_set: + _dict["alg"] = None + + # set to None if use (nullable) is None + # and model_fields_set contains the field + if self.use is None and "use" in self.model_fields_set: + _dict["use"] = None + return _dict @classmethod diff --git a/okta/models/o_auth2_client_json_web_key_rsa_response.py b/okta/models/o_auth2_client_json_web_key_rsa_response.py index 7afdf55d..0db57b2c 100644 --- a/okta/models/o_auth2_client_json_web_key_rsa_response.py +++ b/okta/models/o_auth2_client_json_web_key_rsa_response.py @@ -42,8 +42,12 @@ class OAuth2ClientJsonWebKeyRsaResponse(OAuth2ClientJsonSigningKeyResponse): An RSA signing key """ # noqa: E501 - e: StrictStr = Field(description="RSA key value (exponent) for key binding") - n: StrictStr = Field(description="RSA key value (modulus) for key binding") + e: Optional[StrictStr] = Field( + default=None, description="RSA key value (exponent) for key binding" + ) + n: Optional[StrictStr] = Field( + default=None, description="RSA key value (modulus) for key binding" + ) __properties: ClassVar[List[str]] = [ "id", "created", @@ -100,11 +104,36 @@ def to_dict(self) -> Dict[str, Any]: else: _dict["_links"] = self.links + # set to None if created (nullable) is None + # and model_fields_set contains the field + if self.created is None and "created" in self.model_fields_set: + _dict["created"] = None + + # set to None if last_updated (nullable) is None + # and model_fields_set contains the field + if self.last_updated is None and "last_updated" in self.model_fields_set: + _dict["lastUpdated"] = None + # set to None if kid (nullable) is None # and model_fields_set contains the field if self.kid is None and "kid" in self.model_fields_set: _dict["kid"] = None + # set to None if kty (nullable) is None + # and model_fields_set contains the field + if self.kty is None and "kty" in self.model_fields_set: + _dict["kty"] = None + + # set to None if alg (nullable) is None + # and model_fields_set contains the field + if self.alg is None and "alg" in self.model_fields_set: + _dict["alg"] = None + + # set to None if use (nullable) is None + # and model_fields_set contains the field + if self.use is None and "use" in self.model_fields_set: + _dict["use"] = None + return _dict @classmethod diff --git a/okta/models/policy.py b/okta/models/policy.py index 40ce2db0..afcc5485 100644 --- a/okta/models/policy.py +++ b/okta/models/policy.py @@ -209,6 +209,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of Policy from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AccessPolicy": diff --git a/okta/models/policy_rule.py b/okta/models/policy_rule.py index 9b45192d..d4b2a33d 100644 --- a/okta/models/policy_rule.py +++ b/okta/models/policy_rule.py @@ -215,6 +215,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of PolicyRule from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AccessPolicyRule": diff --git a/okta/models/privileged_resource.py b/okta/models/privileged_resource.py index 3ac01531..7d219117 100644 --- a/okta/models/privileged_resource.py +++ b/okta/models/privileged_resource.py @@ -170,6 +170,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of PrivilegedResource from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "PrivilegedResourceAccountAppRequest": diff --git a/okta/models/push_provider.py b/okta/models/push_provider.py index 08dbf9f4..fe0ba3cc 100644 --- a/okta/models/push_provider.py +++ b/okta/models/push_provider.py @@ -146,6 +146,11 @@ def from_dict( """Create an instance of PushProvider from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "APNSPushProvider": diff --git a/okta/models/registration_inline_hook_request.py b/okta/models/registration_inline_hook_request.py index 128d3f49..3924bce4 100644 --- a/okta/models/registration_inline_hook_request.py +++ b/okta/models/registration_inline_hook_request.py @@ -129,6 +129,11 @@ def from_dict( """Create an instance of RegistrationInlineHookRequest from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "RegistrationInlineHookPPData": diff --git a/okta/models/service_account.py b/okta/models/service_account.py index 62429a4c..51841b65 100644 --- a/okta/models/service_account.py +++ b/okta/models/service_account.py @@ -203,6 +203,11 @@ def from_dict( """Create an instance of ServiceAccount from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "ServiceAccountDetailsAppAccount": diff --git a/okta/models/user_factor.py b/okta/models/user_factor.py index 03ba4997..d60da106 100644 --- a/okta/models/user_factor.py +++ b/okta/models/user_factor.py @@ -220,6 +220,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of UserFactor from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "UserFactorCall": diff --git a/okta/models/user_factor_push_transaction.py b/okta/models/user_factor_push_transaction.py index 7d5a7530..43973641 100644 --- a/okta/models/user_factor_push_transaction.py +++ b/okta/models/user_factor_push_transaction.py @@ -162,6 +162,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of UserFactorPushTransaction from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "UserFactorPushTransactionRejected": diff --git a/okta/models/user_risk_get_response.py b/okta/models/user_risk_get_response.py index eb137f06..e901540d 100644 --- a/okta/models/user_risk_get_response.py +++ b/okta/models/user_risk_get_response.py @@ -134,6 +134,11 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of UserRiskGetResponse from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "UserRiskLevelExists": diff --git a/okta/models/validation_detail_provider.py b/okta/models/validation_detail_provider.py index da833cb6..d07646a5 100644 --- a/okta/models/validation_detail_provider.py +++ b/okta/models/validation_detail_provider.py @@ -117,6 +117,11 @@ def from_dict( """Create an instance of ValidationDetailProvider from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "WorkflowsValidationDetailProvider": diff --git a/okta/models/verification_method.py b/okta/models/verification_method.py index 8ea7ab46..c9e7f7ec 100644 --- a/okta/models/verification_method.py +++ b/okta/models/verification_method.py @@ -123,6 +123,11 @@ def from_dict( """Create an instance of VerificationMethod from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AssuranceMethod": diff --git a/openapi/api.yaml b/openapi/api.yaml index 66fe4dde..e1ce842a 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -70314,13 +70314,13 @@ components: description: Timestamp when the OAuth 2.0 client JSON Web Key was created example: '2023-02-21T20:08:24.000Z' readOnly: true - nullable: false + nullable: true lastUpdated: type: string description: Timestamp when the OAuth 2.0 client JSON Web Key was updated example: '2023-02-21T20:08:24.000Z' readOnly: true - nullable: false + nullable: true _links: $ref: '#/components/schemas/OAuthClientSecretLinks' readOnly: true @@ -70340,7 +70340,7 @@ components: type: string description: Cryptographic algorithm family for the certificate's key pair example: RSA - nullable: false + nullable: true enum: - RSA - EC @@ -70348,12 +70348,12 @@ components: type: string description: Algorithm used in the key example: RS256 - nullable: false + nullable: true use: type: string description: Acceptable use of the JSON Web Key example: sig - nullable: false + nullable: true enum: - sig discriminator: @@ -70363,11 +70363,6 @@ components: EC: '#/components/schemas/OAuth2ClientJsonWebKeyECResponse' required: - id - - created - - lastUpdated - - kty - - alg - - use OAuth2ClientJsonWebKeyECRequest: title: EC Signing Key description: An EC signing key @@ -70549,15 +70544,12 @@ components: type: string description: RSA key value (exponent) for key binding example: AQAB - nullable: false + nullable: true n: type: string description: RSA key value (modulus) for key binding example: mkC6yAJVvFwUlmM9gKjb2d-YK5qHFt-mXSsbjWKKs4EfNm-BoQeeovBZtSACyaqLc8IYFTPEURFcbDQ9DkAL04uUIRD2gaHYY7uK0jsluEaXGq2RAIsmzAwNTzkiDw4q9pDL_q7n0f_SDt1TsMaMQayB6bU5jWsmqcWJ8MCRJ1aJMjZ16un5UVx51IIeCbe4QRDxEXGAvYNczsBoZxspDt28esSpq5W0dBFxcyGVudyl54Er3FzAguhgfMVjH-bUec9j2Tl40qDTktrYgYfxz9pfjm01Hl4WYP1YQxeETpSL7cQ5Ihz4jGDtHUEOcZ4GfJrPzrGpUrak8Qp5xcwCqQ - nullable: false - required: - - e - - n + nullable: true OAuth2ClientSecret: type: object properties: diff --git a/openapi/templates/model_generic.mustache b/openapi/templates/model_generic.mustache index 7a5d79e8..f954b31a 100644 --- a/openapi/templates/model_generic.mustache +++ b/openapi/templates/model_generic.mustache @@ -266,6 +266,11 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#discriminator}} # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) + + # Handle null discriminator by returning base class instance + if object_type is None: + return cls.model_validate(obj) + # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("{{packageName}}.models") {{#mappedModels}} From 7dd3c830d42ef34381db0051f5c65b08426f7a47 Mon Sep 17 00:00:00 2001 From: BinoyOza-okta Date: Wed, 18 Mar 2026 14:11:25 +0530 Subject: [PATCH 2/4] fix: add missing JWKS subclass fields to serialization - Added e, n fields to OAuth2ClientJsonWebKeyRsaResponse __properties and from_dict() - Added x, y, crv fields to OAuth2ClientJsonWebKeyECResponse __properties and from_dict() - Marked crv as optional (nullable) per API specification (x, y remain required) - Added null preservation for e, n, crv in to_dict() methods This ensures RSA and EC JWKS keys properly serialize/deserialize all subclass-specific fields. --- docs/OAuth2ClientJsonWebKeyECResponse.md | 2 +- ...o_auth2_client_json_web_key_ec_response.py | 18 +++++- ..._auth2_client_json_web_key_rsa_response.py | 14 +++++ openapi/api.yaml | 63 +++++++++---------- 4 files changed, 63 insertions(+), 34 deletions(-) diff --git a/docs/OAuth2ClientJsonWebKeyECResponse.md b/docs/OAuth2ClientJsonWebKeyECResponse.md index a3bf5301..5632774a 100644 --- a/docs/OAuth2ClientJsonWebKeyECResponse.md +++ b/docs/OAuth2ClientJsonWebKeyECResponse.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **x** | **str** | The public x coordinate for the elliptic curve point | **y** | **str** | The public y coordinate for the elliptic curve point | -**crv** | **str** | The cryptographic curve used with the key | +**crv** | **str** | The cryptographic curve used with the key | [optional] ## Example diff --git a/okta/models/o_auth2_client_json_web_key_ec_response.py b/okta/models/o_auth2_client_json_web_key_ec_response.py index dacd03b8..b9f520fd 100644 --- a/okta/models/o_auth2_client_json_web_key_ec_response.py +++ b/okta/models/o_auth2_client_json_web_key_ec_response.py @@ -48,7 +48,9 @@ class OAuth2ClientJsonWebKeyECResponse(OAuth2ClientJsonSigningKeyResponse): y: StrictStr = Field( description="The public y coordinate for the elliptic curve point" ) - crv: StrictStr = Field(description="The cryptographic curve used with the key") + crv: Optional[StrictStr] = Field( + default=None, description="The cryptographic curve used with the key" + ) __properties: ClassVar[List[str]] = [ "id", "created", @@ -59,11 +61,17 @@ class OAuth2ClientJsonWebKeyECResponse(OAuth2ClientJsonSigningKeyResponse): "kty", "alg", "use", + "x", + "y", + "crv", ] @field_validator("crv") def crv_validate_enum(cls, value): """Validates the enum""" + if value is None: + return value + if value not in set(["P-256", "P-384", "P-521"]): raise ValueError("must be one of enum values ('P-256', 'P-384', 'P-521')") return value @@ -142,6 +150,11 @@ def to_dict(self) -> Dict[str, Any]: if self.use is None and "use" in self.model_fields_set: _dict["use"] = None + # set to None if crv (nullable) is None + # and model_fields_set contains the field + if self.crv is None and "crv" in self.model_fields_set: + _dict["crv"] = None + return _dict @classmethod @@ -168,6 +181,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "kty": obj.get("kty"), "alg": obj.get("alg"), "use": obj.get("use"), + "x": obj.get("x"), + "y": obj.get("y"), + "crv": obj.get("crv"), } ) return _obj diff --git a/okta/models/o_auth2_client_json_web_key_rsa_response.py b/okta/models/o_auth2_client_json_web_key_rsa_response.py index 0db57b2c..d4ca588e 100644 --- a/okta/models/o_auth2_client_json_web_key_rsa_response.py +++ b/okta/models/o_auth2_client_json_web_key_rsa_response.py @@ -58,6 +58,8 @@ class OAuth2ClientJsonWebKeyRsaResponse(OAuth2ClientJsonSigningKeyResponse): "kty", "alg", "use", + "e", + "n", ] model_config = ConfigDict( @@ -134,6 +136,16 @@ def to_dict(self) -> Dict[str, Any]: if self.use is None and "use" in self.model_fields_set: _dict["use"] = None + # set to None if e (nullable) is None + # and model_fields_set contains the field + if self.e is None and "e" in self.model_fields_set: + _dict["e"] = None + + # set to None if n (nullable) is None + # and model_fields_set contains the field + if self.n is None and "n" in self.model_fields_set: + _dict["n"] = None + return _dict @classmethod @@ -160,6 +172,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "kty": obj.get("kty"), "alg": obj.get("alg"), "use": obj.get("use"), + "e": obj.get("e"), + "n": obj.get("n"), } ) return _obj diff --git a/openapi/api.yaml b/openapi/api.yaml index e1ce842a..77114966 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -70404,26 +70404,25 @@ components: allOf: - $ref: '#/components/schemas/OAuth2ClientJsonSigningKeyResponse' - type: object - properties: - x: - type: string - description: The public x coordinate for the elliptic curve point - y: - type: string - description: The public y coordinate for the elliptic curve point - crv: - type: string - description: The cryptographic curve used with the key - example: P-256 - nullable: false - enum: - - P-256 - - P-384 - - P-521 - required: - - x - - y - - crv + properties: + x: + type: string + description: The public x coordinate for the elliptic curve point + y: + type: string + description: The public y coordinate for the elliptic curve point + crv: + type: string + description: The cryptographic curve used with the key + example: P-256 + nullable: true + enum: + - P-256 + - P-384 + - P-521 + required: + - x + - y OAuth2ClientJsonWebKeyRequestBase: type: object properties: @@ -70538,18 +70537,18 @@ components: description: An RSA signing key allOf: - $ref: '#/components/schemas/OAuth2ClientJsonSigningKeyResponse' - type: object - properties: - e: - type: string - description: RSA key value (exponent) for key binding - example: AQAB - nullable: true - n: - type: string - description: RSA key value (modulus) for key binding - example: mkC6yAJVvFwUlmM9gKjb2d-YK5qHFt-mXSsbjWKKs4EfNm-BoQeeovBZtSACyaqLc8IYFTPEURFcbDQ9DkAL04uUIRD2gaHYY7uK0jsluEaXGq2RAIsmzAwNTzkiDw4q9pDL_q7n0f_SDt1TsMaMQayB6bU5jWsmqcWJ8MCRJ1aJMjZ16un5UVx51IIeCbe4QRDxEXGAvYNczsBoZxspDt28esSpq5W0dBFxcyGVudyl54Er3FzAguhgfMVjH-bUec9j2Tl40qDTktrYgYfxz9pfjm01Hl4WYP1YQxeETpSL7cQ5Ihz4jGDtHUEOcZ4GfJrPzrGpUrak8Qp5xcwCqQ - nullable: true + - type: object + properties: + e: + type: string + description: RSA key value (exponent) for key binding + example: AQAB + nullable: true + n: + type: string + description: RSA key value (modulus) for key binding + example: mkC6yAJVvFwUlmM9gKjb2d-YK5qHFt-mXSsbjWKKs4EfNm-BoQeeovBZtSACyaqLc8IYFTPEURFcbDQ9DkAL04uUIRD2gaHYY7uK0jsluEaXGq2RAIsmzAwNTzkiDw4q9pDL_q7n0f_SDt1TsMaMQayB6bU5jWsmqcWJ8MCRJ1aJMjZ16un5UVx51IIeCbe4QRDxEXGAvYNczsBoZxspDt28esSpq5W0dBFxcyGVudyl54Er3FzAguhgfMVjH-bUec9j2Tl40qDTktrYgYfxz9pfjm01Hl4WYP1YQxeETpSL7cQ5Ihz4jGDtHUEOcZ4GfJrPzrGpUrak8Qp5xcwCqQ + nullable: true OAuth2ClientSecret: type: object properties: From 0733553e21d098eba95aaac83a426bde1ca79831 Mon Sep 17 00:00:00 2001 From: BinoyOza-okta Date: Wed, 18 Mar 2026 14:36:38 +0530 Subject: [PATCH 3/4] - Removed the support of handling null discriminator, as the changes was not necessary with respect to the scope of current requirements. --- okta/models/action_provider.py | 5 ----- okta/models/app_config.py | 5 ----- okta/models/application_feature.py | 5 ----- okta/models/authenticator_base.py | 5 ----- okta/models/authenticator_method_base.py | 5 ----- .../authenticator_method_with_verifiable_properties.py | 5 ----- okta/models/authenticator_simple.py | 5 ----- okta/models/available_action_provider.py | 5 ----- okta/models/behavior_rule.py | 5 ----- okta/models/device_assurance.py | 5 ----- okta/models/enrollment_policy_authenticator_grace_period.py | 5 ----- okta/models/inline_hook_channel.py | 5 ----- okta/models/inline_hook_channel_create.py | 5 ----- okta/models/log_stream.py | 5 ----- okta/models/log_stream_put_schema.py | 5 ----- okta/models/network_zone.py | 5 ----- okta/models/o_auth2_client_json_signing_key_response.py | 5 ----- okta/models/policy.py | 5 ----- okta/models/policy_rule.py | 5 ----- okta/models/privileged_resource.py | 5 ----- okta/models/push_provider.py | 5 ----- okta/models/registration_inline_hook_request.py | 5 ----- okta/models/service_account.py | 5 ----- okta/models/user_factor.py | 5 ----- okta/models/user_factor_push_transaction.py | 5 ----- okta/models/user_risk_get_response.py | 5 ----- okta/models/validation_detail_provider.py | 5 ----- okta/models/verification_method.py | 5 ----- openapi/templates/model_generic.mustache | 5 ----- 29 files changed, 145 deletions(-) diff --git a/okta/models/action_provider.py b/okta/models/action_provider.py index 9fd3ae55..415fdc1c 100644 --- a/okta/models/action_provider.py +++ b/okta/models/action_provider.py @@ -112,11 +112,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[Union[WorkflowActionProvider """Create an instance of ActionProvider from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "WorkflowActionProvider": diff --git a/okta/models/app_config.py b/okta/models/app_config.py index 1204e49b..35267377 100644 --- a/okta/models/app_config.py +++ b/okta/models/app_config.py @@ -107,11 +107,6 @@ def from_dict( """Create an instance of AppConfig from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AppConfigActiveDirectory": diff --git a/okta/models/application_feature.py b/okta/models/application_feature.py index 0bb62d60..a21b61d2 100644 --- a/okta/models/application_feature.py +++ b/okta/models/application_feature.py @@ -140,11 +140,6 @@ def from_dict( """Create an instance of ApplicationFeature from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "InboundProvisioningApplicationFeature": diff --git a/okta/models/authenticator_base.py b/okta/models/authenticator_base.py index 0a06cfe3..b7a99dd5 100644 --- a/okta/models/authenticator_base.py +++ b/okta/models/authenticator_base.py @@ -227,11 +227,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of AuthenticatorBase from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AuthenticatorKeyCustomApp": diff --git a/okta/models/authenticator_method_base.py b/okta/models/authenticator_method_base.py index 648802dc..6df59a40 100644 --- a/okta/models/authenticator_method_base.py +++ b/okta/models/authenticator_method_base.py @@ -176,11 +176,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of AuthenticatorMethodBase from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AuthenticatorMethodWithVerifiableProperties": diff --git a/okta/models/authenticator_method_with_verifiable_properties.py b/okta/models/authenticator_method_with_verifiable_properties.py index 3e1ef88e..f157b6a4 100644 --- a/okta/models/authenticator_method_with_verifiable_properties.py +++ b/okta/models/authenticator_method_with_verifiable_properties.py @@ -180,11 +180,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of AuthenticatorMethodWithVerifiableProperties from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AuthenticatorMethodWithVerifiableProperties": diff --git a/okta/models/authenticator_simple.py b/okta/models/authenticator_simple.py index 690e830f..aa461df4 100644 --- a/okta/models/authenticator_simple.py +++ b/okta/models/authenticator_simple.py @@ -192,11 +192,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of AuthenticatorSimple from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AuthenticatorKeyCustomApp": diff --git a/okta/models/available_action_provider.py b/okta/models/available_action_provider.py index dece095b..4affa78e 100644 --- a/okta/models/available_action_provider.py +++ b/okta/models/available_action_provider.py @@ -121,11 +121,6 @@ def from_dict( """Create an instance of AvailableActionProvider from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "WorkflowAvailableActionProvider": diff --git a/okta/models/behavior_rule.py b/okta/models/behavior_rule.py index 23fe7ef4..31a93a71 100644 --- a/okta/models/behavior_rule.py +++ b/okta/models/behavior_rule.py @@ -177,11 +177,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of BehaviorRule from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "BehaviorRuleASN": diff --git a/okta/models/device_assurance.py b/okta/models/device_assurance.py index 0a5896d6..1103f849 100644 --- a/okta/models/device_assurance.py +++ b/okta/models/device_assurance.py @@ -218,11 +218,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of DeviceAssurance from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "DeviceAssuranceAndroidPlatform": diff --git a/okta/models/enrollment_policy_authenticator_grace_period.py b/okta/models/enrollment_policy_authenticator_grace_period.py index 733c9eca..7a2ab2b0 100644 --- a/okta/models/enrollment_policy_authenticator_grace_period.py +++ b/okta/models/enrollment_policy_authenticator_grace_period.py @@ -122,11 +122,6 @@ def from_dict( """Create an instance of EnrollmentPolicyAuthenticatorGracePeriod from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "ByDateTimeAuthenticatorGracePeriodExpiry": diff --git a/okta/models/inline_hook_channel.py b/okta/models/inline_hook_channel.py index 3160040e..49ddc1b9 100644 --- a/okta/models/inline_hook_channel.py +++ b/okta/models/inline_hook_channel.py @@ -117,11 +117,6 @@ def from_dict( """Create an instance of InlineHookChannel from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "InlineHookChannelHttp": diff --git a/okta/models/inline_hook_channel_create.py b/okta/models/inline_hook_channel_create.py index 5679549a..7ce093b3 100644 --- a/okta/models/inline_hook_channel_create.py +++ b/okta/models/inline_hook_channel_create.py @@ -119,11 +119,6 @@ def from_dict( """Create an instance of InlineHookChannelCreate from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "InlineHookChannelHttpCreate": diff --git a/okta/models/log_stream.py b/okta/models/log_stream.py index 1a5de6f7..3ac575d5 100644 --- a/okta/models/log_stream.py +++ b/okta/models/log_stream.py @@ -159,11 +159,6 @@ def from_dict( """Create an instance of LogStream from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "LogStreamAws": diff --git a/okta/models/log_stream_put_schema.py b/okta/models/log_stream_put_schema.py index ff0e01df..6d159736 100644 --- a/okta/models/log_stream_put_schema.py +++ b/okta/models/log_stream_put_schema.py @@ -114,11 +114,6 @@ def from_dict( """Create an instance of LogStreamPutSchema from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "LogStreamAwsPutSchema": diff --git a/okta/models/network_zone.py b/okta/models/network_zone.py index a1e32bf8..f28bdf64 100644 --- a/okta/models/network_zone.py +++ b/okta/models/network_zone.py @@ -172,11 +172,6 @@ def from_dict( """Create an instance of NetworkZone from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "DynamicNetworkZone": diff --git a/okta/models/o_auth2_client_json_signing_key_response.py b/okta/models/o_auth2_client_json_signing_key_response.py index be456587..c0813018 100644 --- a/okta/models/o_auth2_client_json_signing_key_response.py +++ b/okta/models/o_auth2_client_json_signing_key_response.py @@ -236,11 +236,6 @@ def from_dict( """Create an instance of OAuth2ClientJsonSigningKeyResponse from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "OAuth2ClientJsonWebKeyECResponse": diff --git a/okta/models/policy.py b/okta/models/policy.py index afcc5485..40ce2db0 100644 --- a/okta/models/policy.py +++ b/okta/models/policy.py @@ -209,11 +209,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of Policy from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AccessPolicy": diff --git a/okta/models/policy_rule.py b/okta/models/policy_rule.py index d4b2a33d..9b45192d 100644 --- a/okta/models/policy_rule.py +++ b/okta/models/policy_rule.py @@ -215,11 +215,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of PolicyRule from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AccessPolicyRule": diff --git a/okta/models/privileged_resource.py b/okta/models/privileged_resource.py index 7d219117..3ac01531 100644 --- a/okta/models/privileged_resource.py +++ b/okta/models/privileged_resource.py @@ -170,11 +170,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of PrivilegedResource from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "PrivilegedResourceAccountAppRequest": diff --git a/okta/models/push_provider.py b/okta/models/push_provider.py index fe0ba3cc..08dbf9f4 100644 --- a/okta/models/push_provider.py +++ b/okta/models/push_provider.py @@ -146,11 +146,6 @@ def from_dict( """Create an instance of PushProvider from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "APNSPushProvider": diff --git a/okta/models/registration_inline_hook_request.py b/okta/models/registration_inline_hook_request.py index 3924bce4..128d3f49 100644 --- a/okta/models/registration_inline_hook_request.py +++ b/okta/models/registration_inline_hook_request.py @@ -129,11 +129,6 @@ def from_dict( """Create an instance of RegistrationInlineHookRequest from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "RegistrationInlineHookPPData": diff --git a/okta/models/service_account.py b/okta/models/service_account.py index 51841b65..62429a4c 100644 --- a/okta/models/service_account.py +++ b/okta/models/service_account.py @@ -203,11 +203,6 @@ def from_dict( """Create an instance of ServiceAccount from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "ServiceAccountDetailsAppAccount": diff --git a/okta/models/user_factor.py b/okta/models/user_factor.py index d60da106..03ba4997 100644 --- a/okta/models/user_factor.py +++ b/okta/models/user_factor.py @@ -220,11 +220,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of UserFactor from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "UserFactorCall": diff --git a/okta/models/user_factor_push_transaction.py b/okta/models/user_factor_push_transaction.py index 43973641..7d5a7530 100644 --- a/okta/models/user_factor_push_transaction.py +++ b/okta/models/user_factor_push_transaction.py @@ -162,11 +162,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of UserFactorPushTransaction from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "UserFactorPushTransactionRejected": diff --git a/okta/models/user_risk_get_response.py b/okta/models/user_risk_get_response.py index e901540d..eb137f06 100644 --- a/okta/models/user_risk_get_response.py +++ b/okta/models/user_risk_get_response.py @@ -134,11 +134,6 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[ """Create an instance of UserRiskGetResponse from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "UserRiskLevelExists": diff --git a/okta/models/validation_detail_provider.py b/okta/models/validation_detail_provider.py index d07646a5..da833cb6 100644 --- a/okta/models/validation_detail_provider.py +++ b/okta/models/validation_detail_provider.py @@ -117,11 +117,6 @@ def from_dict( """Create an instance of ValidationDetailProvider from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "WorkflowsValidationDetailProvider": diff --git a/okta/models/verification_method.py b/okta/models/verification_method.py index c9e7f7ec..8ea7ab46 100644 --- a/okta/models/verification_method.py +++ b/okta/models/verification_method.py @@ -123,11 +123,6 @@ def from_dict( """Create an instance of VerificationMethod from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("okta.models") if object_type == "AssuranceMethod": diff --git a/openapi/templates/model_generic.mustache b/openapi/templates/model_generic.mustache index f954b31a..7a5d79e8 100644 --- a/openapi/templates/model_generic.mustache +++ b/openapi/templates/model_generic.mustache @@ -266,11 +266,6 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#discriminator}} # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) - - # Handle null discriminator by returning base class instance - if object_type is None: - return cls.model_validate(obj) - # Import from okta.models to ensure class identity consistency with lazy imports models = import_module("{{packageName}}.models") {{#mappedModels}} From 35a3da45f2b926f452ac706eec856f8e6a2d7f94 Mon Sep 17 00:00:00 2001 From: BinoyOza-okta Date: Thu, 19 Mar 2026 18:57:07 +0530 Subject: [PATCH 4/4] - Reverted the change of making kty as optional. --- docs/OAuth2ClientJsonSigningKeyResponse.md | 2 +- .../o_auth2_client_json_signing_key_response.py | 13 ++----------- .../o_auth2_client_json_web_key_ec_response.py | 5 ----- .../o_auth2_client_json_web_key_rsa_response.py | 5 ----- openapi/api.yaml | 2 +- 5 files changed, 4 insertions(+), 23 deletions(-) diff --git a/docs/OAuth2ClientJsonSigningKeyResponse.md b/docs/OAuth2ClientJsonSigningKeyResponse.md index 6292a6b1..36481ed3 100644 --- a/docs/OAuth2ClientJsonSigningKeyResponse.md +++ b/docs/OAuth2ClientJsonSigningKeyResponse.md @@ -12,7 +12,7 @@ Name | Type | Description | Notes **links** | [**OAuthClientSecretLinks**](OAuthClientSecretLinks.md) | | [optional] **kid** | **str** | Unique identifier of the JSON Web Key in the OAuth 2.0 client's JWKS | [optional] **status** | **str** | Status of the OAuth 2.0 client JSON Web Key | [optional] -**kty** | **str** | Cryptographic algorithm family for the certificate's key pair | [optional] +**kty** | **str** | Cryptographic algorithm family for the certificate's key pair | **alg** | **str** | Algorithm used in the key | [optional] **use** | **str** | Acceptable use of the JSON Web Key | [optional] diff --git a/okta/models/o_auth2_client_json_signing_key_response.py b/okta/models/o_auth2_client_json_signing_key_response.py index c0813018..8eaca3f3 100644 --- a/okta/models/o_auth2_client_json_signing_key_response.py +++ b/okta/models/o_auth2_client_json_signing_key_response.py @@ -68,9 +68,8 @@ class OAuth2ClientJsonSigningKeyResponse(BaseModel): status: Optional[StrictStr] = Field( default=None, description="Status of the OAuth 2.0 client JSON Web Key" ) - kty: Optional[StrictStr] = Field( - default=None, - description="Cryptographic algorithm family for the certificate's key pair", + kty: StrictStr = Field( + description="Cryptographic algorithm family for the certificate's key pair" ) alg: Optional[StrictStr] = Field( default=None, description="Algorithm used in the key" @@ -103,9 +102,6 @@ def status_validate_enum(cls, value): @field_validator("kty") def kty_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(["RSA", "EC"]): raise ValueError("must be one of enum values ('RSA', 'EC')") return value @@ -210,11 +206,6 @@ def to_dict(self) -> Dict[str, Any]: if self.kid is None and "kid" in self.model_fields_set: _dict["kid"] = None - # set to None if kty (nullable) is None - # and model_fields_set contains the field - if self.kty is None and "kty" in self.model_fields_set: - _dict["kty"] = None - # set to None if alg (nullable) is None # and model_fields_set contains the field if self.alg is None and "alg" in self.model_fields_set: diff --git a/okta/models/o_auth2_client_json_web_key_ec_response.py b/okta/models/o_auth2_client_json_web_key_ec_response.py index b9f520fd..6ef3087d 100644 --- a/okta/models/o_auth2_client_json_web_key_ec_response.py +++ b/okta/models/o_auth2_client_json_web_key_ec_response.py @@ -135,11 +135,6 @@ def to_dict(self) -> Dict[str, Any]: if self.kid is None and "kid" in self.model_fields_set: _dict["kid"] = None - # set to None if kty (nullable) is None - # and model_fields_set contains the field - if self.kty is None and "kty" in self.model_fields_set: - _dict["kty"] = None - # set to None if alg (nullable) is None # and model_fields_set contains the field if self.alg is None and "alg" in self.model_fields_set: diff --git a/okta/models/o_auth2_client_json_web_key_rsa_response.py b/okta/models/o_auth2_client_json_web_key_rsa_response.py index d4ca588e..3f33b6ee 100644 --- a/okta/models/o_auth2_client_json_web_key_rsa_response.py +++ b/okta/models/o_auth2_client_json_web_key_rsa_response.py @@ -121,11 +121,6 @@ def to_dict(self) -> Dict[str, Any]: if self.kid is None and "kid" in self.model_fields_set: _dict["kid"] = None - # set to None if kty (nullable) is None - # and model_fields_set contains the field - if self.kty is None and "kty" in self.model_fields_set: - _dict["kty"] = None - # set to None if alg (nullable) is None # and model_fields_set contains the field if self.alg is None and "alg" in self.model_fields_set: diff --git a/openapi/api.yaml b/openapi/api.yaml index 77114966..5e59e27c 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -70340,7 +70340,6 @@ components: type: string description: Cryptographic algorithm family for the certificate's key pair example: RSA - nullable: true enum: - RSA - EC @@ -70363,6 +70362,7 @@ components: EC: '#/components/schemas/OAuth2ClientJsonWebKeyECResponse' required: - id + - kty OAuth2ClientJsonWebKeyECRequest: title: EC Signing Key description: An EC signing key