gratelets icon indicating copy to clipboard operation
gratelets copied to clipboard

new integration: json schema for data collections

Open lilnasy opened this issue 2 years ago • 2 comments

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.

lilnasy avatar Dec 30 '23 16:12 lilnasy

⚠️ No Changeset found

Latest commit: 8fc7ab66899c2dd7179a600fabbe7d3e9493b35e

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

changeset-bot[bot] avatar Dec 30 '23 16:12 changeset-bot[bot]

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()],
})

lilnasy avatar Dec 30 '23 16:12 lilnasy

T

lilnasy avatar Dec 03 '24 18:12 lilnasy