Skip to content

pdcl-15166: fix ajv hoist issue for non-node environments#25

Draft
brenthosie wants to merge 1 commit into
masterfrom
fix-ajv-hoist-issue
Draft

pdcl-15166: fix ajv hoist issue for non-node environments#25
brenthosie wants to merge 1 commit into
masterfrom
fix-ajv-hoist-issue

Conversation

@brenthosie

@brenthosie brenthosie commented Jun 11, 2026

Copy link
Copy Markdown
Member

Description

ajv is already a regular dependency of reactor-validator (not a peer dep), npm guarantees it gets installed nested under node_modules/@adobe/reactor-validator/node_modules/ajv.

If validateSchema.js does require('ajv/dist/core') directly instead of going through ajv-draft-04, that require resolves relative to reactor-validator's own location — finding the nested ajv@8 correctly, regardless of what version of ajv the consumer has at their top level.

The indirection through ajv-draft-04 is what breaks things: it's a separately-hoisted package with its own (broken) resolution scope. Cutting it out means the ajv require never leaves reactor-validator's own module boundary.

Related Issue

https://jira.corp.adobe.com/browse/PDCL-15166

Motivation and Context

When attempting to integrate reactor-validator into Lens, the Lens project needed to install ajv8 as a direct dependency even though the project doesn't use it outside of calling reactor-validator.

How Has This Been Tested?

New tests added to test that we are draft 4 compliant in reactor-validator.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

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.

1 participant