Skip to content

docs(data_classes): correct AppSync identity docstring for OPENID_CONNECT and pin the dispatch - #8705

Open
ShussMiao wants to merge 1 commit into
aws-powertools:developfrom
ShussMiao:docs/appsync-identity-openid-connect-dispatch
Open

ShussMiao wants to merge 1 commit into
aws-powertools:developfrom
ShussMiao:docs/appsync-identity-openid-connect-dispatch

Conversation

@ShussMiao

Copy link
Copy Markdown
Contributor

Issue number: closes #8704

Summary

Changes

AppSyncEventBase.identity documented OPENID_CONNECT as returning None. It cannot: get_identity_object returns None only when the identity mapping itself is None, and an OIDC identity always carries sub, so it resolves to AppSyncIdentityCognito — the class that already exposes the OIDC fields (claims, issuer, groups, default_auth_strategy).

The existing suite already relied on this: test_appsync_resolver_event.py:48 asserts isinstance(parsed_event.identity, AppSyncIdentityCognito) for appSyncResolverEvent.json, whose identity is OIDC-shaped. The docstring was the outlier, and carried a NEED TO TEST note.

  • Corrects the OPENID_CONNECT line and removes its NEED TO TEST note.
  • Fixes the typo in the line above (type of identify found → type of identity found).
  • Adds two tests that pin the dispatch: OIDC identity → AppSyncIdentityCognito with its fields reachable, and "only a None identity maps to None".
  • Leaves AWS_LAMBDA explicitly marked unverified rather than guessing, since its mapping is whatever the authorizer returns and there is no fixture for it.

User experience

No behavioural change — the docstring now matches what already happens, so anyone reading identity to decide which class to expect for an OIDC-authorized API no longer gets told it will be None.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

…ty dispatch

`AppSyncEventBase.identity` documented OPENID_CONNECT as returning None, but
`get_identity_object` only returns None when the identity mapping itself is
None, so an OIDC identity (which always carries `sub`) resolves to
`AppSyncIdentityCognito` — which already models the OIDC fields. The existing
test suite already asserted that; the docstring was the outlier.

Corrects the line, drops the two `NEED TO TEST` notes for the case that is now
settled, and adds tests pinning the dispatch so docstring and behaviour cannot
drift apart again. `AWS_LAMBDA` is left as explicitly unverified rather than
guessed at, since its mapping is whatever the authorizer returns.

Signed-off-by: ShussMiao <168898188+ShussMiao@users.noreply.github.com>
@ShussMiao
ShussMiao requested a review from a team as a code owner October 30, 2026 02:45
@boring-cyborg boring-cyborg Bot added the tests label Oct 30, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 30, 2026
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: AppSync identity docstring says OPENID_CONNECT returns None, but the dispatch has no such path

1 participant