Skip to content

Conversation

@ascorbic
Copy link
Contributor

@ascorbic ascorbic commented May 7, 2025

Changes

Adds schema parsing to live content collections.

  • parses the returned data from getCollection and getEntry
  • updates types so that if schema is defined, collections will be typed using that rather than the loader type
  • refactors error handling and adds more checks for the config and the data

Testing

Still needs tests

Docs

Added a new error

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) docs pr labels May 7, 2025
@changeset-bot
Copy link

changeset-bot bot commented May 7, 2025

⚠️ No Changeset found

Latest commit: 375d854

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

@ascorbic ascorbic force-pushed the live-loader-schema branch from 32750ec to 375d854 Compare May 7, 2025 10:24
@ascorbic ascorbic self-assigned this May 7, 2025
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Left few questions around the code. It would be great if the RFC would cover error handling


export function isAstroError(e: unknown): e is AstroError {
return e instanceof AstroError;
return e instanceof AstroError || AstroError.is(e);
Copy link
Member

Choose a reason for hiding this comment

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

Why the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the AstroError is thrown inside the content config it's not recognising it as an instance of the AstroError class, so isn't giving the nicely-formatted error messages

@ascorbic ascorbic merged commit c072818 into live-loaders May 7, 2025
14 checks passed
@ascorbic ascorbic deleted the live-loader-schema branch May 7, 2025 13:42
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.

2 participants