Skip to content

Commit 7dd3c83

Browse files
committed
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.
1 parent d3797c4 commit 7dd3c83

4 files changed

Lines changed: 63 additions & 34 deletions

File tree

docs/OAuth2ClientJsonWebKeyECResponse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Name | Type | Description | Notes
88
------------ | ------------- | ------------- | -------------
99
**x** | **str** | The public x coordinate for the elliptic curve point |
1010
**y** | **str** | The public y coordinate for the elliptic curve point |
11-
**crv** | **str** | The cryptographic curve used with the key |
11+
**crv** | **str** | The cryptographic curve used with the key | [optional]
1212

1313
## Example
1414

okta/models/o_auth2_client_json_web_key_ec_response.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ class OAuth2ClientJsonWebKeyECResponse(OAuth2ClientJsonSigningKeyResponse):
4848
y: StrictStr = Field(
4949
description="The public y coordinate for the elliptic curve point"
5050
)
51-
crv: StrictStr = Field(description="The cryptographic curve used with the key")
51+
crv: Optional[StrictStr] = Field(
52+
default=None, description="The cryptographic curve used with the key"
53+
)
5254
__properties: ClassVar[List[str]] = [
5355
"id",
5456
"created",
@@ -59,11 +61,17 @@ class OAuth2ClientJsonWebKeyECResponse(OAuth2ClientJsonSigningKeyResponse):
5961
"kty",
6062
"alg",
6163
"use",
64+
"x",
65+
"y",
66+
"crv",
6267
]
6368

6469
@field_validator("crv")
6570
def crv_validate_enum(cls, value):
6671
"""Validates the enum"""
72+
if value is None:
73+
return value
74+
6775
if value not in set(["P-256", "P-384", "P-521"]):
6876
raise ValueError("must be one of enum values ('P-256', 'P-384', 'P-521')")
6977
return value
@@ -142,6 +150,11 @@ def to_dict(self) -> Dict[str, Any]:
142150
if self.use is None and "use" in self.model_fields_set:
143151
_dict["use"] = None
144152

153+
# set to None if crv (nullable) is None
154+
# and model_fields_set contains the field
155+
if self.crv is None and "crv" in self.model_fields_set:
156+
_dict["crv"] = None
157+
145158
return _dict
146159

147160
@classmethod
@@ -168,6 +181,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
168181
"kty": obj.get("kty"),
169182
"alg": obj.get("alg"),
170183
"use": obj.get("use"),
184+
"x": obj.get("x"),
185+
"y": obj.get("y"),
186+
"crv": obj.get("crv"),
171187
}
172188
)
173189
return _obj

okta/models/o_auth2_client_json_web_key_rsa_response.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class OAuth2ClientJsonWebKeyRsaResponse(OAuth2ClientJsonSigningKeyResponse):
5858
"kty",
5959
"alg",
6060
"use",
61+
"e",
62+
"n",
6163
]
6264

6365
model_config = ConfigDict(
@@ -134,6 +136,16 @@ def to_dict(self) -> Dict[str, Any]:
134136
if self.use is None and "use" in self.model_fields_set:
135137
_dict["use"] = None
136138

139+
# set to None if e (nullable) is None
140+
# and model_fields_set contains the field
141+
if self.e is None and "e" in self.model_fields_set:
142+
_dict["e"] = None
143+
144+
# set to None if n (nullable) is None
145+
# and model_fields_set contains the field
146+
if self.n is None and "n" in self.model_fields_set:
147+
_dict["n"] = None
148+
137149
return _dict
138150

139151
@classmethod
@@ -160,6 +172,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
160172
"kty": obj.get("kty"),
161173
"alg": obj.get("alg"),
162174
"use": obj.get("use"),
175+
"e": obj.get("e"),
176+
"n": obj.get("n"),
163177
}
164178
)
165179
return _obj

openapi/api.yaml

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -70404,26 +70404,25 @@ components:
7040470404
allOf:
7040570405
- $ref: '#/components/schemas/OAuth2ClientJsonSigningKeyResponse'
7040670406
- type: object
70407-
properties:
70408-
x:
70409-
type: string
70410-
description: The public x coordinate for the elliptic curve point
70411-
y:
70412-
type: string
70413-
description: The public y coordinate for the elliptic curve point
70414-
crv:
70415-
type: string
70416-
description: The cryptographic curve used with the key
70417-
example: P-256
70418-
nullable: false
70419-
enum:
70420-
- P-256
70421-
- P-384
70422-
- P-521
70423-
required:
70424-
- x
70425-
- y
70426-
- crv
70407+
properties:
70408+
x:
70409+
type: string
70410+
description: The public x coordinate for the elliptic curve point
70411+
y:
70412+
type: string
70413+
description: The public y coordinate for the elliptic curve point
70414+
crv:
70415+
type: string
70416+
description: The cryptographic curve used with the key
70417+
example: P-256
70418+
nullable: true
70419+
enum:
70420+
- P-256
70421+
- P-384
70422+
- P-521
70423+
required:
70424+
- x
70425+
- y
7042770426
OAuth2ClientJsonWebKeyRequestBase:
7042870427
type: object
7042970428
properties:
@@ -70538,18 +70537,18 @@ components:
7053870537
description: An RSA signing key
7053970538
allOf:
7054070539
- $ref: '#/components/schemas/OAuth2ClientJsonSigningKeyResponse'
70541-
type: object
70542-
properties:
70543-
e:
70544-
type: string
70545-
description: RSA key value (exponent) for key binding
70546-
example: AQAB
70547-
nullable: true
70548-
n:
70549-
type: string
70550-
description: RSA key value (modulus) for key binding
70551-
example: mkC6yAJVvFwUlmM9gKjb2d-YK5qHFt-mXSsbjWKKs4EfNm-BoQeeovBZtSACyaqLc8IYFTPEURFcbDQ9DkAL04uUIRD2gaHYY7uK0jsluEaXGq2RAIsmzAwNTzkiDw4q9pDL_q7n0f_SDt1TsMaMQayB6bU5jWsmqcWJ8MCRJ1aJMjZ16un5UVx51IIeCbe4QRDxEXGAvYNczsBoZxspDt28esSpq5W0dBFxcyGVudyl54Er3FzAguhgfMVjH-bUec9j2Tl40qDTktrYgYfxz9pfjm01Hl4WYP1YQxeETpSL7cQ5Ihz4jGDtHUEOcZ4GfJrPzrGpUrak8Qp5xcwCqQ
70552-
nullable: true
70540+
- type: object
70541+
properties:
70542+
e:
70543+
type: string
70544+
description: RSA key value (exponent) for key binding
70545+
example: AQAB
70546+
nullable: true
70547+
n:
70548+
type: string
70549+
description: RSA key value (modulus) for key binding
70550+
example: mkC6yAJVvFwUlmM9gKjb2d-YK5qHFt-mXSsbjWKKs4EfNm-BoQeeovBZtSACyaqLc8IYFTPEURFcbDQ9DkAL04uUIRD2gaHYY7uK0jsluEaXGq2RAIsmzAwNTzkiDw4q9pDL_q7n0f_SDt1TsMaMQayB6bU5jWsmqcWJ8MCRJ1aJMjZ16un5UVx51IIeCbe4QRDxEXGAvYNczsBoZxspDt28esSpq5W0dBFxcyGVudyl54Er3FzAguhgfMVjH-bUec9j2Tl40qDTktrYgYfxz9pfjm01Hl4WYP1YQxeETpSL7cQ5Ihz4jGDtHUEOcZ4GfJrPzrGpUrak8Qp5xcwCqQ
70551+
nullable: true
7055370552
OAuth2ClientSecret:
7055470553
type: object
7055570554
properties:

0 commit comments

Comments
 (0)