Skip to content

Conversation

@matthewp
Copy link
Contributor

Changes

Emit console warning when collections are defined without a loader, signaling that they're using deprecated v4 backwards compatibility mode.

This helps users discover and migrate their legacy collections before upgrading to v6, where the escape hatch will require explicit opt-in with legacy.collectionsBackwardsCompat flag.

Testing

No changes

Docs

Not yet

Emit console warning when collections are defined without a loader,
signaling that they're using deprecated v4 backwards compatibility mode.

This helps users discover and migrate their legacy collections before
upgrading to v6, where the escape hatch will require explicit opt-in
with legacy.collectionsBackwardsCompat flag.

Warning only shows in dev mode (NODE_ENV !== 'production') to avoid
spam in production builds.
@changeset-bot
Copy link

changeset-bot bot commented Nov 28, 2025

⚠️ No Changeset found

Latest commit: 22e658a

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.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Nov 28, 2025
Emit console warning when collections are defined without a loader,
signaling that they're using deprecated v4 backwards compatibility mode.

This helps users discover and migrate their legacy collections before
upgrading to v6, where the escape hatch will require explicit opt-in
with legacy.collectionsBackwardsCompat flag.

Warning only shows in dev mode (NODE_ENV !== 'production') to avoid
spam in production builds.
Add actual enforcement of the contentCollectionsStrict experimental flag.
When enabled, throws an error if any collections use the deprecated v4 API
(type: 'content' or type: 'data') without a loader.

This allows users to test their migration in v5 by enabling strict mode
and getting immediate feedback on what needs to be fixed.
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 28, 2025

CodSpeed Performance Report

Merging #14928 will not alter performance

Comparing feat/v5-collections-deprecation-warnings (22e658a) with main (4bceeb0)

Summary

✅ 6 untouched

@HiDeoo
Copy link
Member

HiDeoo commented Dec 2, 2025

Just to get the ball rolling, I guess the idea would be in a first step to throw an error when any of the possible reasons why automatic backwards compatibility might be enabled are detected. Not sure yet which error/format would be best suited for this but I assume that's something we can figure out on the way.

Regarding the possible reasons, from my understanding, automatic backwards compatibility might be enabled based on the list of reasons we have gathered in the v6 upgrade guide so far:

  • a configuration file located at src/content/config.ts
  • a collection that does not define a loader
  • a collection that defines a collection type (type: 'content' or type: 'data')
  • legacy collection querying methods getDataEntryById() and getEntryBySlug()
  • legacy collection querying and rendering methods that depend on a slug property
  • content rendered using entry.render()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs pr pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants