File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @astrojs/rss " : patch
3+ ---
4+
5+ Fixes ` rssSchema ` definition to allow calling standard zod object methods (like ` extend ` )
Original file line number Diff line number Diff line change 11import { z } from 'astro/zod' ;
22
3- const sharedSchema = z . object ( {
3+ export const rssSchema = z . object ( {
4+ title : z . string ( ) . optional ( ) ,
5+ description : z . string ( ) . optional ( ) ,
46 pubDate : z
57 . union ( [ z . string ( ) , z . number ( ) , z . date ( ) ] )
68 . optional ( )
@@ -20,19 +22,7 @@ const sharedSchema = z.object({
2022 . optional ( ) ,
2123 link : z . string ( ) . optional ( ) ,
2224 content : z . string ( ) . optional ( ) ,
23- } ) ;
24-
25- export const rssSchema = z . union ( [
26- z
27- . object ( {
28- title : z . string ( ) ,
29- description : z . string ( ) . optional ( ) ,
30- } )
31- . merge ( sharedSchema ) ,
32- z
33- . object ( {
34- title : z . string ( ) . optional ( ) ,
35- description : z . string ( ) ,
36- } )
37- . merge ( sharedSchema ) ,
38- ] ) ;
25+ } ) . refine ( val => val . title || val . description , {
26+ message : "At least title or description must be provided." ,
27+ path : [ "title" , "description" ]
28+ } )
You can’t perform that action at this time.
0 commit comments