Skip to content

chore: add an alias for ajv - #2445

Merged
vadyvas merged 2 commits into
Redocly:mainfrom
aklkv:copilot/fix-issue-2444
Jan 9, 2026
Merged

chore: add an alias for ajv#2445
vadyvas merged 2 commits into
Redocly:mainfrom
aklkv:copilot/fix-issue-2444

Conversation

@aklkv

@aklkv aklkv commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

What/Why/How?

Added ajv as a direct dependency to @redocly/respect-core package.

Why: The package uses better-ajv-errors which declares ajv as a peer dependency. Without ajv as a direct dependency, users encounter peer dependency warnings and installation failures when installing @redocly/respect-core.

How: Added "ajv": "npm:@redocly/ajv@8.17.1" to the dependencies in packages/respect-core/package.json, matching the version of @redocly/ajv already in use.

Reference

Fixes #2444

Testing

  • Verified ajv is now listed in dependencies
  • Version ^8.17.1 satisfies better-ajv-errors peer dependency requirement (4.11.8 - 8)
  • No breaking changes - ajv is already used transitively via @redocly/ajv

Screenshots (optional)

N/A

Check yourself

  • Code changed? - Tested with Redoc/Realm/Reunite (internal)
  • All new/updated code is covered by tests (no code changes, only dependency addition)
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update considered (no documentation changes needed)

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

@aklkv
aklkv requested a review from a team as a code owner December 5, 2025 09:50
@changeset-bot

changeset-bot Bot commented Dec 5, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b12dccc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vadyvas

vadyvas commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Hi @aklkv, thanks for the PR.
Could you please add a few details to the issue (or reply here—either is fine) so we can reproduce and confirm the fix?

@alario-tang

Copy link
Copy Markdown

The same issue also affects @redocly/openapi-core package.

ajv-formats@3.0.1 (a dependency of @redocly/openapi-core) declares ajv@^8.0.0 as a peer dependency. However, since @redocly/openapi-core uses @redocly/ajv instead of the standard ajv package, pnpm may incorrectly resolve ajv@6 (from other packages like eslint) for ajv-formats, causing:

Cannot find module 'ajv/dist/compile/codegen'

Could you also apply the same fix to packages/openapi-core/package.json?

"ajv": "npm:@redocly/ajv@8.17.1"

This would ensure both respect-core and openapi-core properly provide ajv for their transitive dependencies.

@aklkv

aklkv commented Jan 7, 2026

Copy link
Copy Markdown
Contributor Author

Sure thing I can do that, I can also add core-js as it seems to be a problem which I described in the issue

@aklkv
aklkv force-pushed the copilot/fix-issue-2444 branch 2 times, most recently from 524dfdb to 2cc9060 Compare January 7, 2026 08:29
@aklkv

aklkv commented Jan 7, 2026

Copy link
Copy Markdown
Contributor Author

after applying the patch here is how everything looks like:

❯ npm ls ajv

@redocly/cli@2.0.0 /Users/aklkv/Projects/github/redocly-cli
└─┬ @redocly/cli@2.14.3 -> ./packages/cli
  ├─┬ @redocly/openapi-core@2.14.3 -> ./packages/core
  │ └── ajv@npm:@redocly/ajv@8.17.1
  ├─┬ @redocly/respect-core@2.14.3 -> ./packages/respect-core
  │ ├── ajv@npm:@redocly/ajv@8.17.1
  │ └─┬ better-ajv-errors@1.2.0
  │   └── ajv@6.12.6
  └─┬ ajv-formats@3.0.1
    └── ajv@8.17.1

❯ npm ls @redocly/ajv

@redocly/cli@2.0.0 /Users/aklkv/Projects/github/redocly-cli
└─┬ @redocly/cli@2.14.3 -> ./packages/cli
  ├─┬ @redocly/openapi-core@2.14.3 -> ./packages/core
  │ └── @redocly/ajv@8.17.1
  ├─┬ @redocly/respect-core@2.14.3 -> ./packages/respect-core
  │ └── @redocly/ajv@8.17.1 deduped
  └─┬ redoc@2.5.1
    └─┬ @redocly/openapi-core@1.34.6
      └── @redocly/ajv@8.17.1 deduped

❯ npm ls core-js

@redocly/cli@2.0.0 /Users/aklkv/Projects/github/redocly-cli
└─┬ @redocly/cli@2.14.3 -> ./packages/cli
  ├── core-js@3.47.0
  └─┬ redoc@2.5.1
    └── core-js@3.47.0 deduped

@vadyvas

vadyvas commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

@aklkv thanks for the contribution

Could you please update packages/cli/package.json to include:
"ajv": "npm:@redocly/ajv@8.17.1"

Also, please remove core-js from this PR, we’ll handle that in a separate PR

@aklkv
aklkv force-pushed the copilot/fix-issue-2444 branch from 2cc9060 to bb9826d Compare January 8, 2026 18:23
@vadyvas

vadyvas commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

LGTM👍
Could you please resolve the conflicts so we can get this PR merged?

@vadyvas vadyvas changed the title add an alias for ajv chore: add an alias for ajv Jan 9, 2026
Copilot AI and others added 2 commits January 9, 2026 04:44
Co-authored-by: aklkv <312210+aklkv@users.noreply.github.com>
@aklkv
aklkv force-pushed the copilot/fix-issue-2444 branch from bb9826d to b12dccc Compare January 9, 2026 12:46
@vadyvas
vadyvas merged commit d36fed3 into Redocly:main Jan 9, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing peer dependency ajv in better-ajv-errors causes installation failures

4 participants