Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new integration: json schema for data collections #48

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lilnasy
Copy link
Owner

@lilnasy lilnasy commented Dec 30, 2023

Intro

  • Reads content/config.ts for data collections every time astro sync runs.
  • Converts the zod schema to json schema using zod-to-json-schema
  • Writes each schema to <root>/.astro/<collection>.schema.json where <root> is the directory where package.json and astro.config.mjs usually go, and <collection> is the name of the data collection as read from the exported collections value.

Copy link

changeset-bot bot commented Dec 30, 2023

⚠️ No Changeset found

Latest commit: 8fc7ab6

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

@lilnasy
Copy link
Owner Author

lilnasy commented Dec 30, 2023

To preview, either download this package and add it manually: astro-json-schema-0.0.0.tgz

or run this command:
npm i https://github.com/lilnasy/gratelets/files/13798701/astro-json-schema-0.0.0.tgz

And add the integration to astro config:

import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import jsonSchema from 'astro-json-schema';

// https://astro.build/config
export default defineConfig({
	site: 'https://example.com',
	integrations: [mdx(), sitemap(), jsonSchema()],
})

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.

None yet

1 participant