okta / okta-sdk-golang

A Golang SDK for interacting with the Okta management API, enabling server-side code to manage Okta users, groups, applications, and more.
https://github.com/okta/okta-sdk-golang
Other
174 stars 143 forks source link

ListLogEvents fails to unmarshal the response due to wrong definiotn of `LogDebugContext.DebugData` and `LogTarget.DetailEntry` #482

Closed mikiberd closed 3 weeks ago

mikiberd commented 1 month ago

Describe the bug?

When calling ListLogEvents of the SystemLogAPI, errors are returned (one of the following, depends on the response): json: cannot unmarshal string into Go struct field _LogEvent.debugContext of type map[string]interface {} json: cannot unmarshal string into Go struct field _LogEvent.target of type map[string]interface {} json: cannot unmarshal string into Go struct field _LogEvent.transaction of type map[string]interface {} json: cannot unmarshal string into Go struct field _LogEvent.actor of type map[string]interface {}

In all cases, the error is due to the following fields being defined as map[string]map[string]interface{} instead of map[string]interface{}:

What is expected to happen?

The response should be unmarshalled correctly, returning a LogEvent object

What is the actual behavior?

An error is returned

Reproduction Steps?

Call ListLogEvents(), from the okta.SystemLogAPI client

Additional Information?

Some of the errors occurred in previous versions and have been fixed https://github.com/okta/okta-sdk-golang/issues/462 https://github.com/okta/okta-sdk-golang/issues/449

Can we kindly request that a test will be added? 🙏🏻

Golang Version

go version go1.22.3 darwin/arm64

SDK Version

v5.0.0

OS version

No response

duytiennguyen-okta commented 1 month ago

OKTA internal reference https://oktainc.atlassian.net/browse/OKTA-790273

mikiberd commented 1 month ago

Also LogTargetChangeDetails.From and LogTargetChangeDetails.To are defined with the wrong type.

duytiennguyen-okta commented 4 weeks ago

@mikiberd do you have the API response for LogTargetChangeDetails?