Skip to content

Conversation

dcabib
Copy link
Contributor

@dcabib dcabib commented Sep 5, 2025

Issue number: #7122

Summary

Enhances the AppSync parser models with field descriptions and examples using Pydantic's Field() functionality. This improvement provides better documentation and metadata for AppSync event parsing, following the pattern established in previous PRs.

Changes

  • Added Field() descriptions and examples to all AppSync parser model classes:

      • IAM authentication with AWS account details and identity provider information
      • Cognito User Pool authentication with JWT claims and group membership
      • OpenID Connect provider authentication with claims and issuer details
      • Lambda authorizer custom context functionality
      • HTTP request context including headers and custom domains
      • GraphQL query details with selection sets, variables, and field information
      • Pipeline resolver previous operation results
      • Complete resolver event with all context fields
      • Channel path and segments information
      • Channel namespace details
      • Complete channel operation information
      • Individual event with ID and payload details
      • Complete events operation context with error handling
  • All field descriptions are based on official AWS AppSync documentation

  • Examples sourced from actual test events and AWS documentation

  • Maintains 100% backward compatibility - no breaking changes to type annotations or validation logic

  • Follows best practices from successful PRs (default=None pattern for Optional fields)

User experience

Customers will be able to see examples and descriptions when using AppSync parser models, providing:

  • Rich IntelliSense with field descriptions and realistic examples
  • Self-documenting code without needing external AWS documentation
  • Professional API documentation via .model_json_schema()
  • Faster development with immediate reference for acceptable values
  • Clear understanding of different authentication types and event structures

Checklist

  • ✅ Meet tenets criteria
  • ✅ I have performed a self-review of this change
  • ✅ Changes have been tested (all existing tests pass)
  • ✅ Changes are documented (via Field descriptions)
  • ✅ PR title follows conventional commit semantics

Is this a breaking change? No


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.

Closes #7122

Enhances the AppSync parser models with field descriptions and examples using Pydantic's Field() functionality. This improvement provides better documentation and metadata for AppSync event parsing, following the pattern established in previous PRs.

All field descriptions are based on official AWS AppSync documentation and include realistic examples from actual test events.

Closes aws-powertools#7122
@dcabib dcabib requested a review from a team as a code owner September 5, 2025 11:17
@dcabib dcabib requested a review from hjgraca September 5, 2025 11:17
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 5, 2025
- Sanitize JWT token examples to use generic placeholders
- Remove authorization header from examples to avoid hardcoded credentials
- Replace sensitive UUIDs with generic placeholders
- Address SonarQube security hotspots while maintaining example clarity
…spots

- Remove token_use and auth_time fields from JWT claims examples
- Sanitize OIDC subject identifier examples
- Address remaining SonarCloud security concerns while maintaining example clarity
…hotspots

- Simplify JWT claims examples to minimal required fields
- Remove complex nested authentication data
- Keep examples clear but security-compliant
- Final resolution of SonarCloud security concerns
…tspots

- Remove JWT claims examples that trigger security hotspots
- Keep comprehensive field descriptions for developer guidance
- Maintain functionality while ensuring security compliance
- Final resolution of all SonarCloud security concerns
- Replace all hardcoded IP addresses with localhost and private network examples
- Use 127.0.0.1 and 10.0.0.x addresses to avoid SonarCloud security hotspots
- Addresses SonarCloud security concerns about hardcoded IP addresses
- Final resolution of all security hotspots
…tspots

- Remove all IP address examples from sourceIp fields and headers
- Keep comprehensive field descriptions for developer guidance
- Maintain functionality while ensuring complete security compliance
- Final resolution of all SonarCloud security hotspots
dcabib and others added 2 commits September 5, 2025 13:21
- Format appsync.py file according to project standards using Ruff
- Fix 13 additional linting issues automatically
- Ensure all 1167 files pass formatting checks
- Resolves GitHub Actions workflow failure in PR aws-powertools#7330
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

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

@dcabib thanks for working on this. I left some feedback and please run make format to fix the problems.

Copy link

sonarqubecloud bot commented Sep 9, 2025

Copy link

codecov bot commented Sep 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.36%. Comparing base (439638c) to head (6a99c5d).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7330   +/-   ##
========================================
  Coverage    96.36%   96.36%           
========================================
  Files          275      275           
  Lines        13007    13007           
  Branches       968      968           
========================================
  Hits         12534    12534           
  Misses         366      366           
  Partials       107      107           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leandrodamascena leandrodamascena merged commit 3014dc6 into aws-powertools:develop Sep 9, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tech debt: Improve documentation of Event model fields in AppSync parser models
3 participants