okta-sdk-golang icon indicating copy to clipboard operation
okta-sdk-golang copied to clipboard

Bug: Wrong type for `AppUser.Profile` in v4.0.0

Open erezrokah opened this issue 10 months ago • 11 comments

Describe the bug?

I believe the Profile type should be map[string]interface{} instead map[string]map[string]interface{}, see of https://github.com/okta/okta-sdk-golang/blob/v4.0.0/okta/model_app_user.go#L46

As a result JSON decoding of AppUser fails with cannot unmarshal string into Go struct field _AppUser.profile of type map[string]interface {}

What is expected to happen?

Listing application users should succeed

What is the actual behavior?

Listing application users fails

Reproduction Steps?

Use the ListApplicationUsersExecute API

Additional Information?

Example response from the API can be seen in https://developer.okta.com/docs/reference/api/apps/#response-example-32

Golang Version

go version go1.22.1 darwin/arm64

SDK Version

v4.0.0

OS version

Darwin ****-MBP-2 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64

erezrokah avatar Apr 05 '24 11:04 erezrokah

Could be related: https://github.com/OpenAPITools/openapi-generator/issues/15281 https://github.com/OpenAPITools/openapi-generator/issues/15582

erezrokah avatar Apr 05 '24 13:04 erezrokah

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

duytiennguyen-okta avatar Apr 05 '24 16:04 duytiennguyen-okta

@erezrokah Do you have the response that causes the error? for both AppUser.Profile and ApplicationGroupAssignment.Profile

duytiennguyen-okta avatar Apr 05 '24 16:04 duytiennguyen-okta

Thanks for the quick response @duytiennguyen-okta, there's an example response in https://github.com/cloudquery/cloudquery/issues/16836#issuecomment-2037535304 for ApplicationGroupAssignment.Profile but I was able to reproduce for AppUser.Profile

erezrokah avatar Apr 05 '24 16:04 erezrokah

Example response from the API can be seen in https://developer.okta.com/docs/reference/api/apps/#response-example-32

The response I got looks like the one in the REST API docs, copying the one from the docs so the issue has all the information:

[
  {
    "id": "00ui2sVIFZNCNKFFNBPM",
    "externalId": "005o0000000umnEAAQ",
    "created": "2014-08-15T18:59:43.000Z",
    "lastUpdated": "2014-08-15T18:59:48.000Z",
    "scope": "USER",
    "status": "PROVISIONED",
    "statusChanged": "2014-08-15T18:59:48.000Z",
    "passwordChanged": null,
    "syncState": "SYNCHRONIZED",
    "lastSync": "2014-08-15T18:59:48.000Z",
    "credentials": {
      "userName": "[email protected]"
    },
    "profile": {
      "secondEmail": null,
      "lastName": "McJanky",
      "mobilePhone": "415-555-555",
      "email": "[email protected]",
      "salesforceGroups": [],
      "role": "CEO",
      "firstName": "Karl",
      "profile": "Standard Platform User"
    },
    "_links": {
      "app": {
        "href": "https://{yourOktaDomain}/api/v1/apps/0oajiqIRNXPPJBNZMGYL"
      },
      "user": {
        "href": "https://{yourOktaDomain}/api/v1/users/00ui2sVIFZNCNKFFNBPM"
      }
    }
  },
  {
    "id": "00ujsgVNDRESKKXERBUJ",
    "externalId": "005o0000000uqJaAAI",
    "created": "2014-08-16T02:35:14.000Z",
    "lastUpdated": "2014-08-16T02:56:49.000Z",
    "scope": "USER",
    "status": "PROVISIONED",
    "statusChanged": "2014-08-16T02:56:49.000Z",
    "passwordChanged": null,
    "syncState": "SYNCHRONIZED",
    "lastSync": "2014-08-16T02:56:49.000Z",
    "credentials": {
      "userName": "[email protected]"
    },
    "profile": {
      "secondEmail": null,
      "lastName": "Jackson",
      "mobilePhone": null,
      "email": "[email protected]",
      "salesforceGroups": [
        "Employee"
      ],
      "role": "Developer",
      "firstName": "Saml",
      "profile": "Standard User"
    },
    "_links": {
      "app": {
        "href": "https://{yourOktaDomain}/api/v1/apps/0oajiqIRNXPPJBNZMGYL"
      },
      "user": {
        "href": "https://{yourOktaDomain}/api/v1/users/00ujsgVNDRESKKXERBUJ"
      }
    }
  }
]

erezrokah avatar Apr 05 '24 16:04 erezrokah

@erezrokah

  1. Please censored all the sensitive info.
  2. I am trying to resolve the issue at the root. Please wait a few days for a updated release

duytiennguyen-okta avatar Apr 05 '24 16:04 duytiennguyen-okta

Thanks! No sensitive info the response it is copied from your docs

erezrokah avatar Apr 05 '24 16:04 erezrokah

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

github-actions[bot] avatar Apr 20 '24 01:04 github-actions[bot]

Not stale

erezrokah avatar Apr 20 '24 05:04 erezrokah

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

github-actions[bot] avatar May 05 '24 01:05 github-actions[bot]

Not stale

erezrokah avatar May 05 '24 05:05 erezrokah