3forges / pesto-api

The Pesto REST API
0 stars 0 forks source link

What defines an Astro content type #9

Open Jean-Baptiste-Lasselle opened 6 months ago

Jean-Baptiste-Lasselle commented 6 months ago

It's very clear, it is collections, or more precisely cwhat astro calls "content collections" :

https://docs.astro.build/en/guides/content-collections/

image

image

there also is the equivalent of hugo's draft: true : if the content file name begins with an underscore, it is excluded from the astro build.

Jean-Baptiste-Lasselle commented 6 months ago

image

Jean-Baptiste-Lasselle commented 6 months ago

Now very important, from an example :

image

Above :

So basically, if i want pesto to generate Content Types for Astro, I need to be able to generate a Zod Schema, from a typescript interface :

So basically, the question is about generating a zod schema from a not too complex typescript interface, and apprently, that's possible according the very interesting issue https://github.com/colinhacks/zod/issues/53

see also https://transform.tools/typescript-to-zod