Skip to content

fix: make grant_types optional in OpenIdConnectApplicationSettingsClient#575

Open
alexander-vyh wants to merge 1 commit intookta:masterfrom
alexander-vyh:fix/oidc-grant-types-optional
Open

fix: make grant_types optional in OpenIdConnectApplicationSettingsClient#575
alexander-vyh wants to merge 1 commit intookta:masterfrom
alexander-vyh:fix/oidc-grant-types-optional

Conversation

@alexander-vyh
Copy link
Copy Markdown

obvious fix

Summary

The Okta API does not always return grant_types in OIDC app responses,
but the OpenAPI spec marks it as required. This causes UnmarshalJSON to
fail with:

no value given for required property grant_types

Applies the same fix pattern introduced in #559 to a field that PR did
not cover. Changes:

  • Remove grant_types from the required list in both spec YAML files
  • Regenerated Go model via make generate (working tree clean after)
  • No other files affected

Fixes #N/A

Type of PR

  • Bug Fix (non-breaking fixes to existing functionality)

Test Information

  • My PR required test updates

Go Version: go1.25.6 darwin/arm64
OS Version: macOS 15.7.2 (darwin/arm64)
OpenAPI Spec Version: openapi-generator-cli 7.15.0

Signoff

  • I have submitted a CLA for this PR
    (Claiming the obvious fix exception — this change removes an incorrectly
    required field with no new functionality added, following the same pattern
    already established in fix: Remove required fields that are optional in API responses #559. If this does not qualify, please let me know
    and I will sign the CLA promptly.)
  • Each commit message explains what the commit does
  • I have updated documentation to explain what my PR does
  • My code is covered by tests if required
  • I ran make fmt on my code
  • I did not edit any automatically generated files

Rebased onto master after v6.1.0 openapi spec regeneration.

The Okta API does not require grant_types when creating an OIDC
application client — it defaults to [authorization_code]. The
generated Go SDK incorrectly marks grant_types as a required property,
which forces callers to supply an empty array just to satisfy the
constructor signature and triggers a JSON unmarshal error on responses
where grant_types isn't present.

This change:
- Removes the required: [grant_types] entry from the two source
  OpenAPI spec files (.generator/*.yaml and okta/api/openapi.yaml)
- Regenerates the affected Go model:
  - GrantTypes json tag gains omitempty
  - NewOpenIdConnectApplicationSettingsClient no longer takes a
    grantTypes parameter
  - GetGrantTypes/GetGrantTypesOk handle nil GrantTypes
  - UnmarshalJSON drops the requiredProperties check for grant_types
  - ToMap skips grant_types when nil
@alexander-vyh alexander-vyh force-pushed the fix/oidc-grant-types-optional branch from f6b11e3 to 55dd075 Compare April 10, 2026 07:30
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.

1 participant