Skip to content
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

feat(open-payments): make schema validation in the open-payments client behind a flag #467

Merged
merged 45 commits into from
May 2, 2024

Conversation

mkurapov
Copy link
Contributor

@mkurapov mkurapov commented Apr 29, 2024

Changes proposed in this pull request

Context

This change adds validateResponses flag to open payments client initialization function. This allows bypassing runtime response validation against the Open Payments OpenAPI specs.

This is particularly useful for the WM extension use case since the openapi validator libraries we use under the hood in @interledger/openapi use ajv schema validation during runtime, which uses unsafe eval , and as a result, prevents us from running it in the extension for manifest v3: ajv-validator/ajv#406.

Fixes #454

… disable openapi schema validation"

This reverts commit b5f986a.

# Conflicts:
#	packages/open-payments/src/client/requests.test.ts
#	packages/open-payments/src/client/requests.ts
# Conflicts:
#	.github/workflows/env-setup/action.yaml
Copy link

changeset-bot bot commented Apr 29, 2024

🦋 Changeset detected

Latest commit: 3ec839d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@interledger/open-payments Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mkurapov mkurapov changed the title 454/mk/optional schema validation feat(open-payments): make schema validation in the open-payments client behind a flag Apr 29, 2024
@@ -129,6 +130,7 @@ const parseKey = (

const createUnauthenticatedDeps = async ({
useHttp = false,
validateResponses = true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the main change here: the addition of optional validateResponses flag when creating the open payments clients.

@mkurapov mkurapov marked this pull request as ready for review April 29, 2024 14:39
@mkurapov mkurapov linked an issue Apr 29, 2024 that may be closed by this pull request
3 tasks
Base automatically changed from 454/mk/use-ky to main April 29, 2024 19:46
Copy link

netlify bot commented Apr 29, 2024

Deploy Preview for openpayments-preview canceled.

Name Link
🔨 Latest commit 3ec839d
🔍 Latest deploy log https://app.netlify.com/sites/openpayments-preview/deploys/66321e8bb44cb90008d0e216

# Conflicts:
#	packages/open-payments/src/client/requests.ts
@mkurapov mkurapov force-pushed the 454/mk/optional-schema-validation branch from 80c0037 to 28805f9 Compare April 29, 2024 21:48
@mkurapov mkurapov force-pushed the 454/mk/optional-schema-validation branch from 1f74dc9 to 865b6c5 Compare May 1, 2024 10:15
Copy link
Contributor

@BlairCurrey BlairCurrey left a comment

Choose a reason for hiding this comment

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

I think you're waiting on Radu for a test in the browser, but it looks good to me

@mkurapov
Copy link
Contributor Author

mkurapov commented May 2, 2024

Tested in the browser with the extension, I do not see any errors related to the client initialization.

@mkurapov mkurapov merged commit 1bf703c into main May 2, 2024
10 checks passed
@mkurapov mkurapov deleted the 454/mk/optional-schema-validation branch May 2, 2024 15:06
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.

Prepare @interledger/open-payments lib for use with manifest V3
2 participants