Skip to content

Support JSON Schema referencing in validation utils (by using fastjsonschema's handlers param) #4499

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

Closed
1 of 2 tasks
danieljnchen opened this issue Jun 13, 2024 · 8 comments · Fixed by #4508
Closed
1 of 2 tasks
Assignees
Labels
feature-request feature request

Comments

@danieljnchen
Copy link

Use case

fastjsonschema, which is used internally by aws-lambda-powertools' validation utilities, supports JSON Schema's schema referencing, but it by default launches an http request to the url provided. However, in the case that users don't want to launch an http request to fetch the referenced schemas (for example, because the references are stored locally), fastjsonschema also provides the handlers parameter to its validation methods (docs)

You can pass mapping from URI to function that should be used to retrieve remote schemes used in your definition in parameter handlers.

Solution/User Experience

Update aws-lambda-powertools' validation functions to support passing the handlers param to fastjsonschema's validate call. As far as I can tell, this would require adding the param to validate_data_against_schema and to the user-facing methods/decorators validate and validator

Alternative solutions

No response

Acknowledgment

@danieljnchen danieljnchen added feature-request feature request triage Pending triage from maintainers labels Jun 13, 2024
Copy link

boring-cyborg bot commented Jun 13, 2024

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@heitorlessa
Copy link
Contributor

heitorlessa commented Jun 13, 2024

hey @danieljnchen, thanks for taking the time to cut a feature request and the investigation -- it makes total sense we support it.

Would you be interested in creating a PR? we can guide it. We're currently focused on fixing a release pipeline issue and V3, which means we have no ETA when this would be looked at right now.

Edit: it'd be great to have an escape hatch where customers could provide additional keyword arguments so they're not blocked in the futur

@heitorlessa heitorlessa removed the triage Pending triage from maintainers label Jun 13, 2024
@danieljnchen
Copy link
Author

@heitorlessa Thanks for the quick response! I'd be happy to make a PR -- I'll look through the contributing docs and hopefully have something up shortly

@danieljnchen
Copy link
Author

@heitorlessa I've posted a draft PR: #4508

I had some difficulty getting the dev environment setup -- I used gitpod as directed in the Contributing guidelines, but make dev-gitpod failed, and I encountered a lot of missing dependencies when trying to run unit tests. What should I do to move this PR along?

@leandrodamascena leandrodamascena self-assigned this Jun 14, 2024
@leandrodamascena leandrodamascena moved this from Triage to Working on it in Powertools for AWS Lambda (Python) Jun 14, 2024
@leandrodamascena
Copy link
Contributor

@heitorlessa I've posted a draft PR: #4508

I had some difficulty getting the dev environment setup -- I used gitpod as directed in the Contributing guidelines, but make dev-gitpod failed, and I encountered a lot of missing dependencies when trying to run unit tests. What should I do to move this PR along?

Hi @danieljnchen, I'm seeing this comment now. Did you manage to resolve the problem with the environment?

@danieljnchen
Copy link
Author

@heitorlessa I've posted a draft PR: #4508
I had some difficulty getting the dev environment setup -- I used gitpod as directed in the Contributing guidelines, but make dev-gitpod failed, and I encountered a lot of missing dependencies when trying to run unit tests. What should I do to move this PR along?

Hi @danieljnchen, I'm seeing this comment now. Did you manage to resolve the problem with the environment?

Thanks for checking in! Unfortunately not; here's the error I'm getting when I run make-devgitpod:
image
image

@leandrodamascena
Copy link
Contributor

Hello @danieljnchen! Yes, I was able to reproduce this error and opened an issue to fix this. I'm working on it now and hope to finish it early next week.

#4530

@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (Python) Jun 19, 2024
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@leandrodamascena leandrodamascena moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request feature request
Projects
Status: Shipped
3 participants