Updated SDK Packages#27290
Conversation
WalkthroughThe pull request updates version pins for 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ghost/core/package.json`:
- Around line 76-77: The upgrade to `@tryghost/admin-api-schema` changed AJV error
shapes (dataPath → instancePath) and format handling; update the validator
utilities in json-schema.js (e.g., any function that builds ValidationError or
extracts the failing property) to normalize both AJV v6 and v8 shapes by reading
error.instancePath || error.dataPath and deriving the same "property" value for
nested paths, and ensure ajv-formats is registered with the AJV instance used in
build/validate functions; then update all call sites that consume
ValidationError.property (images, webhooks, posts, pages handlers) to use the
normalized property accessor (or a helper method you add in json-schema.js) so
both old and new error objects work consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b0184b23-c83b-46f0-945d-c1b3b36d7435
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (4)
apps/admin-x-settings/package.jsonapps/announcement-bar/package.jsonghost/admin/package.jsonghost/core/package.json
| "@tryghost/adapter-base-cache": "0.1.23", | ||
| "@tryghost/admin-api-schema": "4.7.2", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect direct call sites tied to bumped SDKs.
rg -nP "require\('@tryghost/admin-api-schema'\)|jsonSchema\.validate\s*\(" ghost/core -C3
rg -nP "require\('@tryghost/limit-service'\)|loadLimits\s*\(" ghost/core -C4
rg -nP "require\('@tryghost/string'\)|\{slugify\}\s*=\s*require\('@tryghost/string'\)" ghost/core -C3Repository: TryGhost/Ghost
Length of output: 16073
🌐 Web query:
What are the breaking or behavioral changes from @tryghost/admin-api-schema4.5.10 to 4.7.2 forvalidate(...), and from @tryghost/limit-service1.4.1 to 1.5.2 forloadLimits(...) options?
💡 Result:
@tryghost/admin-api-schema 4.5.10 → 4.7.2 (validate(...))
No breaking change in the validate({data, schema, definition}) signature itself (it still defaults definition to schema?.split('-')[0]). What did change is the validation engine behavior/output, due to an AJV upgrade and related wiring:
-
AJV error path field changed from
errors[0].dataPath(AJV v6-style) toerrors[0].instancePath(AJV v8-style). This affects how the library derives thekeyused in the thrownValidationError(propertyand the"Validation failed for X"message). In practice, you may see differentpropertyvalues for the same invalid payload, especially for nested paths.- 4.5.10 uses
dataPathand splits on.to get the last segment. [1] - 4.7.2 uses
instancePathand splits on/to get the last segment. [2]
- 4.5.10 uses
-
Format handling changed:
- 4.5.10 defines the custom
json-stringformat via the AJV constructorformatsoption. [1] - 4.7.2 registers formats via
ajv-formats, and registersjson-stringviaajv.addFormat(...). This can change which standard formats are recognized/validated (and thus what now fails validation). [2]
- 4.5.10 defines the custom
@tryghost/limit-service 1.4.1 → 1.5.2 (loadLimits(...) options)
No breaking or behavioral changes found in loadLimits({limits = {}, subscription, helpLink, db, errors}) options between these versions:
- Same parameter shape (including
limitsdefaulting to{}), same requirement thaterrorsmust be provided, and same behavior around requiringsubscriptionwhen usingmaxPeriodic. [3] [4]
Sources:
[1] @tryghost/admin-api-schema@4.5.10 json-schema.js (AJV setup + dataPath usage)
[2] @tryghost/admin-api-schema@4.7.2 json-schema.js (AJV setup + instancePath usage, ajv-formats)
[3] @tryghost/limit-service@1.4.1 LimitService.js (loadLimits(...) signature/options)
[4] @tryghost/limit-service@1.5.2 LimitService.js (loadLimits(...) signature/options)
Validate error handling for @tryghost/admin-api-schema upgrade (4.5.10 → 4.7.2)—breaking validation error path change detected.
The bump to @tryghost/admin-api-schema 4.7.2 introduces a breaking behavioral change: the validation error path field changed from dataPath (AJV v6 style) to instancePath (AJV v8 style). This affects the property field in ValidationError messages, especially for nested validation paths. Additionally, format validation changed from AJV constructor-based to ajv-formats registration, which may alter which custom formats are recognized.
Review error handling in ghost/core/core/server/api/endpoints/utils/validators/utils/json-schema.js and all call sites (images, webhooks, posts, pages) to ensure they do not depend on the previous error property structure. The @tryghost/limit-service and @tryghost/string upgrades are safe—no breaking changes detected.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ghost/core/package.json` around lines 76 - 77, The upgrade to
`@tryghost/admin-api-schema` changed AJV error shapes (dataPath → instancePath)
and format handling; update the validator utilities in json-schema.js (e.g., any
function that builds ValidationError or extracts the failing property) to
normalize both AJV v6 and v8 shapes by reading error.instancePath ||
error.dataPath and deriving the same "property" value for nested paths, and
ensure ajv-formats is registered with the AJV instance used in build/validate
functions; then update all call sites that consume ValidationError.property
(images, webhooks, posts, pages handlers) to use the normalized property
accessor (or a helper method you add in json-schema.js) so both old and new
error objects work consistently.
There was a problem hiding this comment.
Hey this is a false positive. The dataPath → instancePath change (AJV v6 → v8) is handled internally by the @tryghost/admin-api-schema package, the thrown ValidationError shape (message, property, errorDetails) is identical from the consumer's perspective.
Ghost's wrapper is a one-line pass-through that never inspects raw AJV errors. Verified: zero references to dataPath or instancePath anywhere in the Ghost codebase.
There was a problem hiding this comment.
@vershwal, you're absolutely right — I apologize for the noise. Since @tryghost/admin-api-schema fully encapsulates the AJV v6 → v8 migration internally and presents a stable ValidationError interface (message, property, errorDetails) to consumers, Ghost's pass-through wrapper requires no changes. I'll record this for future reviews.
✏️ Learnings added
Learnt from: vershwal
Repo: TryGhost/Ghost PR: 27290
File: ghost/core/package.json:76-77
Timestamp: 2026-04-09T09:44:26.783Z
Learning: In the TryGhost/Ghost monorepo, the `tryghost/admin-api-schema` package fully encapsulates AJV version differences (e.g., `dataPath` → `instancePath` from AJV v6 to v8) internally. The public `ValidationError` shape (`message`, `property`, `errorDetails`) is stable from the consumer's perspective. Ghost's wrapper code is a one-line pass-through and never inspects raw AJV error objects. There are zero references to `dataPath` or `instancePath` anywhere in the Ghost codebase. Future reviews should not flag AJV internal changes as issues for Ghost consumers of this package.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
f5e61d6 to
da53a7e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #27290 +/- ##
==========================================
- Coverage 73.45% 73.45% -0.01%
==========================================
Files 1545 1545
Lines 123666 123666
Branches 14958 14958
==========================================
- Hits 90839 90835 -4
- Misses 31830 31832 +2
- Partials 997 999 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
no issue Updated `@tryghost/*` SDK packages (from [TryGhost/SDK](https://github.com/TryGhost/SDK)) to their latest published versions across the monorepo. Also bumped `@tryghost/announcement-bar` to 1.1.15. ### Updated packages | Package | Previous | Updated | Changed in | |---|---|---|---| | `@tryghost/color-utils` | 0.2.10 | 0.2.16 | `ghost/core`, `ghost/admin`, `admin-x-settings` | | `@tryghost/config-url-helpers` | 1.0.17 | 1.0.23 | `ghost/core` | | `@tryghost/content-api` | 1.12.0 | 1.12.6 | `announcement-bar` | | `@tryghost/custom-fonts` | 1.0.2 | 1.0.8 | `ghost/core`, `admin-x-settings` | | `@tryghost/helpers` | 1.1.97 | 1.1.103 | `ghost/core`, `ghost/admin` | | `@tryghost/html-to-plaintext` | 1.0.4 | 1.0.8 | `ghost/core` | | `@tryghost/limit-service` | 1.4.1 | 1.5.2 | `ghost/core`, `ghost/admin`, `admin-x-settings` | | `@tryghost/members-csv` | 2.0.3 | 2.0.5 | `ghost/core`, `ghost/admin` | | `@tryghost/string` | 0.2.17 | 0.3.2 | `ghost/core`, `ghost/admin` | | `@tryghost/timezone-data` | 0.4.12 | 0.4.18 | `ghost/admin`, `admin-x-settings` |



Updated
@tryghost/*SDK packages (from TryGhost/SDK) to their latest published versions across the monorepo. Also bumped@tryghost/announcement-barto 1.1.15.Updated packages
@tryghost/color-utilsghost/core,ghost/admin,admin-x-settings@tryghost/config-url-helpersghost/core@tryghost/content-apiannouncement-bar@tryghost/custom-fontsghost/core,admin-x-settings@tryghost/helpersghost/core,ghost/admin@tryghost/html-to-plaintextghost/core@tryghost/limit-serviceghost/core,ghost/admin,admin-x-settings@tryghost/members-csvghost/core,ghost/admin@tryghost/stringghost/core,ghost/admin@tryghost/timezone-dataghost/admin,admin-x-settingsThe following SDK packages were already at their latest versions on
main(updated via #27264):adapter-base-cache,admin-api-schema,image-transform,referrer-parser,social-urls.Note
@tryghost/url-utilshas been intentionally excluded from this PR and will be updated separately.