Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions okta/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See: https://openapi-generator.tech/docs/customization/#ignore-file-format
#
# Files listed here are preserved across `make generate-files` runs.
#
# model_open_id_connect_application_settings_client.go contains a manual
# fix for issue #591: the generated UnmarshalJSON rejects valid GET
# responses that omit `grant_types` (e.g. preconfigured apps like
# okta_atspoke_iam_connector). Once the openapi-generator go template is
# updated to skip required-property validation on read for the
# unmarshal path (or the spec is split into request/response variants),
# this entry can be removed.
model_open_id_connect_application_settings_client.go
26 changes: 5 additions & 21 deletions okta/model_open_id_connect_application_settings_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ package okta

import (
"encoding/json"
"fmt"
)

// checks if the OpenIdConnectApplicationSettingsClient type satisfies the MappedNullable interface at compile time
Expand Down Expand Up @@ -1141,26 +1140,11 @@ func (o OpenIdConnectApplicationSettingsClient) ToMap() (map[string]interface{},
}

func (o *OpenIdConnectApplicationSettingsClient) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"grant_types",
}

allProperties := make(map[string]interface{})

err = json.Unmarshal(data, &allProperties)

if err != nil {
return err
}

for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
// No required-property pre-check on read: the Okta API legitimately
// returns settings.oauthClient without grant_types (e.g. the
// preconfigured app okta_atspoke_iam_connector). Write-side safety is
// preserved by NewOpenIdConnectApplicationSettingsClient(grantTypes)
// and by server-side validation on POST/PUT.

varOpenIdConnectApplicationSettingsClient := _OpenIdConnectApplicationSettingsClient{}

Expand Down