Skip to content

fix: drop UnmarshalJSON required-property pre-check on OIDC client settings - #592

Open
exitcode0 wants to merge 3 commits into
okta:masterfrom
exitcode0:fix/oidc-unmarshal-grant-types-not-required-on-read
Open

fix: drop UnmarshalJSON required-property pre-check on OIDC client settings#592
exitcode0 wants to merge 3 commits into
okta:masterfrom
exitcode0:fix/oidc-unmarshal-grant-types-not-required-on-read

Conversation

@exitcode0

@exitcode0 exitcode0 commented May 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #591.

The go generator's UnmarshalJSON rejects responses missing any spec-required field, but Okta returns OpenIdConnectApplicationSettingsClient without grant_types for preconfigured apps like okta_atspoke_iam_connector — making them unreadable through the typed SDK.

This drops the pre-check from the affected file and preserves it across regen via okta/.openapi-generator-ignore. Net diff: 2 files. Write-side safety is unchanged (typed constructor still requires grant_types; server still validates on POST/PUT).

Trade-off: the ignored file is now hand-maintained. The comment in .openapi-generator-ignore documents the exit criteria (upstream go template skipping required-property validation on read, like python-pydantic already does).

Branch history: commits 1+2 (0d3720fc, 7a5861e5) tried the broader template fix (~7500-line regen); commit 3 (76858ccb) reverts that and applies the scoped fix shipped here. Happy to drop commit 3 if you'd prefer the template approach.

exitcode0 added 3 commits May 25, 2026 15:27
The openapi-generator go template emits a generic-map decode + loop in
UnmarshalJSON that returns "no value given for required property X" for
any field marked `required` in the spec. This pre-check is over-strict
on read: the Okta API legitimately returns response bodies that omit
fields the spec marks required (e.g. settings.oauthClient.grant_types
on preconfigured apps such as okta_atspoke_iam_connector), which makes
those apps unreadable through the typed SDK path.

Write-side enforcement is unaffected: the typed constructor NewX(...)
still requires the spec-required fields, and server-side validation
continues to reject empty/missing values on POST/PUT.

Fixes okta#591
Reverts the template change and bulk regeneration; instead preserves
just `okta/model_open_id_connect_application_settings_client.go` from
regeneration via a new `.openapi-generator-ignore` entry, and applies
the same one-file fix (drop required-property pre-check + now-unused
`fmt` import) directly to that file.

This trades a smaller, more focused diff for an ongoing manual sync
burden: spec updates that touch `OpenIdConnectApplicationSettingsClient`
will need to be re-applied by hand to the preserved file. The ignore
comment documents this so the entry can be removed once the upstream
generator template is updated to skip required-property validation on
the read path.
@exitcode0 exitcode0 changed the title fix: drop required-property pre-check from generated UnmarshalJSON fix: drop UnmarshalJSON required-property pre-check on OIDC client settings May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v6: OpenIdConnectApplicationSettingsClient.UnmarshalJSON rejects real GET responses that omit grant_types

1 participant