Skip to content

fix(docs): clarified usage of validation with fine grained responses #4101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2024

Conversation

rubenfonseca
Copy link
Contributor

@rubenfonseca rubenfonseca commented Apr 10, 2024

Issue number: #4085

Summary

This pull request updates the documentation to clarify the usage of Response with data validation in the Event Handler utility.

Changes

Please provide a summary of what's being changed

  • Added a note in the "Fine grained responses" section to explain the requirement of specifying the concrete type for Response when using data validation.
  • Provided an example of how to use Response[Todo] to avoid validation errors.
image

User experience

Please share what the user experience looks like before and after this change

Before this change:

  • Users may encounter the error Unable to generate pydantic-core schema for <class 'aws_lambda_powertools.event_handler.api_gateway.Response'> when using Response with data validation without specifying the concrete type.
  • The documentation did not provide clear guidance on how to use Response with data validation.

After this change:

  • Users will have a clear understanding of how to use Response with data validation by specifying the concrete type, such as Response[Model].
  • The documentation provides an example and explains the error that users may encounter, helping them avoid potential issues.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

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.

@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Apr 10, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 10, 2024
@rubenfonseca rubenfonseca linked an issue Apr 10, 2024 that may be closed by this pull request
@github-actions github-actions bot added bug Something isn't working and removed documentation Improvements or additions to documentation labels Apr 10, 2024
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Apr 10, 2024
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Apr 10, 2024
@rubenfonseca rubenfonseca added the documentation Improvements or additions to documentation label Apr 10, 2024
@rubenfonseca rubenfonseca marked this pull request as ready for review April 10, 2024 10:02
@rubenfonseca rubenfonseca requested review from a team and leandrodamascena April 10, 2024 10:02
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Apr 10, 2024
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.

Hey @rubenfonseca! I've made a small suggestion to make the message more "active voice".

Co-authored-by: Leandro Damascena <[email protected]>
Signed-off-by: Ruben Fonseca <[email protected]>
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Apr 10, 2024
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Apr 10, 2024
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.

APPROVED!

@rubenfonseca rubenfonseca added the documentation Improvements or additions to documentation label Apr 10, 2024
@rubenfonseca rubenfonseca merged commit 0447eec into develop Apr 10, 2024
8 checks passed
@rubenfonseca rubenfonseca deleted the rf/4085 branch April 10, 2024 12:45
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working event_handlers size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot return bare Response when enable_validation=True
2 participants