Skip to content

Stop raising exceptions for optional discovery fields - #983

Merged
w-goog merged 10 commits into
masterfrom
codegen/rfc8414-optional-metadata-a
Oct 28, 2026
Merged

w-goog merged 10 commits into
masterfrom
codegen/rfc8414-optional-metadata-a

Conversation

@w-goog

@w-goog w-goog commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

This PR is the first half of fixing #380.

  • The nullable URL getters on OIDServiceDiscovery now check for a string before parsing, so a sloppy optional URL (unparseable, null, not a string) just reads as nil.
  • Validation only covers the nonnull ones (issuer, authorization_endpoint, token_endpoint, jwks_uri). They have to be present and parse, and a JSON null fails with OIDErrorCodeInvalidDiscoveryDocument instead of raising an exception. An authorization_endpoint that doesn't parse now fails the document too, like the other required URL fields.
  • Yay for re-enabling the two pendingTest... cases!! plus three for the sloppy-optional cases.

RFC 8414 documents that omit jwks_uri & co. still fail validation. The right fix is to mark those properties nullable, but that'd be source-breaking, so we'll do that in the 4.0 release.

Note for reviewers: I narrowed the URL check, since a provider's sloppy op_tos_uri shouldn't block a sign-in. Only the nonnull URL fields are validated. The nullable getters already returned nil for a bad URL, and now do the same for null or a non-string.

@w-goog
w-goog force-pushed the codegen/rfc8414-optional-metadata-a branch from 64bc32c to c1f51bd Compare October 21, 2026 22:03
@w-goog w-goog changed the title [Draft] Stop raising exceptions for optional discovery fields Stop raising exceptions for optional discovery fields Oct 22, 2026
@w-goog
w-goog requested a review from brnnmrls October 24, 2026 01:19
@w-goog
w-goog requested a review from brnnmrls October 27, 2026 20:55
Comment thread CHANGELOG.md Resolved
@w-goog
w-goog merged commit 812a9ac into master Oct 28, 2026
16 checks passed
@w-goog
w-goog deleted the codegen/rfc8414-optional-metadata-a branch October 28, 2026 21:52
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