-
Notifications
You must be signed in to change notification settings - Fork 141
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
Fix UserProfile Custom Attributes casing #341
Fix UserProfile Custom Attributes casing #341
Conversation
okta/api_response.py
Outdated
result.append( | ||
self._type( | ||
APIClient.form_response_body(item) | ||
) | ||
) | ||
result.append(self._type(item)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the call to re-format the response body in the next()
method which returns the paginated response
Also done like this in resource clients:
https://github.com/okta/okta-sdk-python/blob/master/okta/resource_clients/user_client.py#L112-L114
- To properly pick up $schema and _links in models that return them - Prevent overriding custom fields if in response
@@ -67,7 +67,7 @@ async def get_application_user_schema( | |||
|
|||
try: | |||
result = UserSchema( | |||
self.form_response_body(response.get_body()) | |||
response.get_body() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not formatting the response body before creating the response in order to not change any custom attributes which may come through in here
@@ -494,3 +495,8 @@ function isUrnGrantType(grantType) { | |||
function prefixUrnGrantType(grantType) { | |||
return URN_PREFIX + URN_SUFFIXES[grantType]; | |||
} | |||
|
|||
const RESPONSE_MODELS_WITH_CUSTOM_ATTRIBUTES = ['User', 'Group', 'UserSchema', 'GroupSchema']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applying logic to these models which have been reported to have issues with custom attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Paginated results was re-formatting results before creating an object out of them to return through the method - in the case of user profile and custom attributes, custom attributes with a variable name starting with a capital letter, it would make the first letter lowercase instead
This PR removes that reformatting call thus resolving the issue
Used following code snippet to test and verify custom attributes are printed correctly: