Skip to content

fix: disable broken polymorphic resolution on 6 more discriminator schemas (GH issues deep-dive) - #1701

Merged
prachi-okta merged 2 commits into
masterfrom
fix/gh-issues-deep-dive
Jul 21, 2026
Merged

fix: disable broken polymorphic resolution on 6 more discriminator schemas (GH issues deep-dive)#1701
prachi-okta merged 2 commits into
masterfrom
fix/gh-issues-deep-dive

Conversation

@prachi-okta

@prachi-okta prachi-okta commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Issue(s)

Deep-dive triage of the remaining open GitHub issues (https://github.com/okta/okta-sdk-java/issues):

Description

Triage summary

#1693 - Already fixed on master (PR #1695 added the missing discriminator to IdentityProviderProtocol, and #1699 shipped further Jackson polymorphism fixes). Verified IdentityProviderProtocolDeserializerTest's 14 regression tests (SAML2/OIDC/OAuth2/MTLS round-trips) all pass on current master. No code change needed in this PR; the issue just needs to be closed once released.

#1664 - Already satisfied. The deprecated PaginationUtil/ApiClient#getResponseHeaders()/getAfter() methods are still present and functional (PaginationUtilTest passes), so the pre-25.0.0 "pass after yourself" workflow continues to work. No removal has happened; nothing to fix.

#1654 - No SAML-specific filtering exists anywhere in the SDK's listApplications path (ApplicationApi.listApplications is a plain generated call; Application's own @JsonSubTypes correctly maps SAML_2_0 -> SamlApplication via real Java inheritance). However, auditing the spec for the same defect class fixed in OKTA-1227472/#1699 (ListJwk200ResponseInner/SamlAttributeStatement: oneOf/anyOf + discriminator without allOf-based inheritance, causing Jackson's @JsonSubTypes to throw InvalidTypeIdException) turned up a very plausible mechanism: before that fix shipped, a SAML app with settings.signOn.attributeStatements populated would throw while being parsed as part of a listApplications response array. Depending on how a caller's error/pagination handling reacted to that exception, this could plausibly present as "SAML apps silently missing, only OIDC returned." Added a regression test (deserializeApplicationList_withMixedOidcAndSamlAttributeStatements_doesNotThrow) confirming a mixed OIDC/SAML list with attribute statements now deserializes cleanly. This is very likely already fixed as a side effect of #1699 - will comment on the issue asking the reporter to confirm on the latest release.

Bonus finding: 6 more instances of the same discriminator defect

Since OKTA-1227472 and #1693/#1695 were both "a oneOf/anyOf + discriminator pair whose subtypes don't actually extend the base via allOf," I audited every such pair in src/swagger/api.yaml for the same pattern. Found and fixed 6 more:

  • AgentJsonSigningKeyRequest / AgentJsonSigningKeyResponse (currently unreferenced by any operation in the spec, fixed for correctness/consistency anyway)
  • ManagedConnection / ManagedConnectionCreatable (reachable from managed-connection list endpoints)
  • PotentialConnection (reachable from potential-connection list endpoints)
  • OrgContactTypeObj - this one is live and reachable from the real, commonly-used listOrgContactTypes endpoint - any caller of that endpoint would hit InvalidTypeIdException today

Fixed the same way as the existing ListJwk200ResponseInner/SamlAttributeStatement mixins: @JsonTypeInfo(use = Id.NONE) registered on ApiClient's default ObjectMapper, disabling the broken polymorphic resolution. Added a regression test for OrgContactTypeObj (BILLING/TECHNICAL) confirming it no longer throws.

(Note: GroupProfile also has this same oneOf/discriminator pattern, but it's inert in practice - GroupProfileDeserializer is a hand-written custom deserializer that bypasses Jackson's annotation-based polymorphism entirely, so it was excluded from this fix as unnecessary.)

Category

  • Bugfix
  • Enhancement
  • New Feature
  • Library Upgrade
  • Configuration Change
  • Versioning Change
  • Unit or Integration Test(s)
  • Documentation

Signoff

  • I have submitted a CLA for this PR (N/A - internal Okta contributor)
  • 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 did not edit any automatically generated files

…tor schemas

Deep-dive into the still-open GitHub issues (#1654, #1664, #1693) led to
auditing every oneOf/anyOf + discriminator pair in the spec for the same
defect class as OKTA-1227472 (subtypes that don't actually extend the
declared base type via allOf, so Jackson's @JsonSubTypes throws
InvalidTypeIdException). Found and fixed 6 more instances:

- AgentJsonSigningKeyRequest / AgentJsonSigningKeyResponse (unreferenced
  in the spec today, but fixed for correctness/consistency)
- ManagedConnection / ManagedConnectionCreatable
- PotentialConnection
- OrgContactTypeObj - this one is live and reachable from the real
  listOrgContactTypes endpoint

Also adds a regression test confirming GH-1654's likely root cause: a
mixed OIDC/SAML Application list, where the SAML app's
settings.signOn.attributeStatements uses the SamlAttributeStatement type
fixed in OKTA-1227472/#1699, now deserializes without throwing. Before
that fix, an org with SAML apps using attribute statements could see
listApplications fail on those specific apps.

Co-Authored-By: Claude Code
…ixes

AgentJsonSigningKeyRequest, AgentJsonSigningKeyResponse, ManagedConnection,
ManagedConnectionCreatable, and PotentialConnection got the same
@JsonTypeInfo(Id.NONE) mixin fix as OrgContactTypeObj in the previous
commit, but only OrgContactTypeObj had a regression test. Add the
missing five.

Note: ManagedConnection/ManagedConnectionCreatable/PotentialConnection
have a separate, pre-existing quirk where their flattened
ConnectionTypeEnum only retains one oneOf branch's single-value enum
(STS_SERVICE_ACCOUNT) - every other connectionType value falls back to
UNKNOWN_DEFAULT_OPEN_API. That's harmless (no exception) but means
these tests only assert the polymorphism fix, not full enum fidelity;
fully fixing that would require reworking how the spec merges oneOf
branches, which is out of scope here.

Co-Authored-By: Claude Code

@aniket-okta aniket-okta left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@prachi-okta
prachi-okta merged commit 8176d82 into master Jul 21, 2026
5 of 7 checks passed
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.

2 participants