@@ -47,13 +47,13 @@ export const slugSchema = z
4747 . max ( MAX_SLUG_LENGTH , {
4848 message : `The slug can be max ${ MAX_SLUG_LENGTH } characters long` ,
4949 } )
50- . describe ( 'Unique ID (human-readable, URL-safe)' ) ;
50+ . meta ( { description : 'Unique ID (human-readable, URL-safe)' } ) ;
5151
5252/** Schema for a general description property */
5353export const descriptionSchema = z
5454 . string ( )
5555 . max ( MAX_DESCRIPTION_LENGTH )
56- . describe ( 'Description (markdown)' )
56+ . meta ( { description : 'Description (markdown)' } )
5757 . optional ( ) ;
5858
5959/* Schema for a URL */
@@ -79,20 +79,20 @@ export const docsUrlSchema = urlSchema
7979 }
8080 throw new ZodError ( ctx . error . issues ) ;
8181 } )
82- . describe ( 'Documentation site' ) ;
82+ . meta ( { description : 'Documentation site' } ) ;
8383
8484/** Schema for a title of a plugin, category and audit */
8585export const titleSchema = z
8686 . string ( )
8787 . max ( MAX_TITLE_LENGTH )
88- . describe ( 'Descriptive name' ) ;
88+ . meta ( { description : 'Descriptive name' } ) ;
8989
9090/** Schema for score of audit, category or group */
9191export const scoreSchema = z
9292 . number ( )
9393 . min ( 0 )
9494 . max ( 1 )
95- . describe ( 'Value between 0 and 1' ) ;
95+ . meta ( { description : 'Value between 0 and 1' } ) ;
9696
9797/** Schema for a property indicating whether an entity is filtered out */
9898export const isSkippedSchema = z . boolean ( ) . optional ( ) ;
@@ -153,9 +153,10 @@ export const globPathSchema = z
153153 message :
154154 'The path must be a valid file path or glob pattern (supports *, **, {}, [], !, ?)' ,
155155 } )
156- . describe (
157- 'Schema for a glob pattern (supports wildcards like *, **, {}, !, etc.)' ,
158- ) ;
156+ . meta ( {
157+ description :
158+ 'Schema for a glob pattern (supports wildcards like *, **, {}, !, etc.)' ,
159+ } ) ;
159160
160161/** Schema for a fileNameSchema */
161162export const fileNameSchema = z
@@ -176,16 +177,16 @@ export function packageVersionSchema<
176177> ( options ?: { versionDescription ?: string ; required ?: TRequired } ) {
177178 const { versionDescription = 'NPM version of the package' , required } =
178179 options ?? { } ;
179- const packageSchema = z . string ( ) . describe ( 'NPM package name' ) ;
180- const versionSchema = z . string ( ) . describe ( versionDescription ) ;
180+ const packageSchema = z . string ( ) . meta ( { description : 'NPM package name' } ) ;
181+ const versionSchema = z . string ( ) . meta ( { description : versionDescription } ) ;
181182 return z
182183 . object ( {
183184 packageName : required ? packageSchema : packageSchema . optional ( ) ,
184185 version : required ? versionSchema : versionSchema . optional ( ) ,
185186 } )
186- . describe (
187- 'NPM package name and version of a published package' ,
188- ) as ZodObject < {
187+ . meta ( {
188+ description : 'NPM package name and version of a published package' ,
189+ } ) as ZodObject < {
189190 packageName : TRequired extends true ? ZodString : ZodOptional < ZodString > ;
190191 version : TRequired extends true ? ZodString : ZodOptional < ZodString > ;
191192 } > ;
@@ -194,24 +195,27 @@ export function packageVersionSchema<
194195/** Schema for a binary score threshold */
195196export const scoreTargetSchema = nonnegativeNumberSchema
196197 . max ( 1 )
197- . describe ( 'Pass/fail score threshold (0-1)' )
198+ . meta ( { description : 'Pass/fail score threshold (0-1)' } )
198199 . optional ( ) ;
199200
200201/** Schema for a weight */
201- export const weightSchema = nonnegativeNumberSchema . describe (
202- 'Coefficient for the given score (use weight 0 if only for display)' ,
203- ) ;
202+ export const weightSchema = nonnegativeNumberSchema . meta ( {
203+ description :
204+ 'Coefficient for the given score (use weight 0 if only for display)' ,
205+ } ) ;
204206
205207export function weightedRefSchema (
206208 description : string ,
207209 slugDescription : string ,
208210) {
209211 return z
210212 . object ( {
211- slug : slugSchema . describe ( slugDescription ) ,
212- weight : weightSchema . describe ( 'Weight used to calculate score' ) ,
213+ slug : slugSchema . meta ( { description : slugDescription } ) ,
214+ weight : weightSchema . meta ( {
215+ description : 'Weight used to calculate score' ,
216+ } ) ,
213217 } )
214- . describe ( description ) ;
218+ . meta ( { description } ) ;
215219}
216220
217221export type WeightedRef = z . infer < ReturnType < typeof weightedRefSchema > > ;
@@ -223,7 +227,9 @@ export function scorableSchema<T extends ReturnType<typeof weightedRefSchema>>(
223227) {
224228 return z
225229 . object ( {
226- slug : slugSchema . describe ( 'Human-readable unique ID, e.g. "performance"' ) ,
230+ slug : slugSchema . meta ( {
231+ description : 'Human-readable unique ID, e.g. "performance"' ,
232+ } ) ,
227233 refs : z
228234 . array ( refSchema )
229235 . min ( 1 , { message : 'In a category, there has to be at least one ref' } )
@@ -239,7 +245,7 @@ export function scorableSchema<T extends ReturnType<typeof weightedRefSchema>>(
239245
240246export const materialIconSchema = z
241247 . enum ( MATERIAL_ICONS )
242- . describe ( 'Icon from VSCode Material Icons extension' ) ;
248+ . meta ( { description : 'Icon from VSCode Material Icons extension' } ) ;
243249export type MaterialIcon = z . infer < typeof materialIconSchema > ;
244250
245251type Ref = { weight : number } ;
@@ -250,9 +256,11 @@ function hasNonZeroWeightedRef(refs: Ref[]) {
250256
251257export const filePositionSchema = z
252258 . object ( {
253- startLine : positiveIntSchema . describe ( 'Start line' ) ,
254- startColumn : positiveIntSchema . describe ( 'Start column' ) . optional ( ) ,
255- endLine : positiveIntSchema . describe ( 'End line' ) . optional ( ) ,
256- endColumn : positiveIntSchema . describe ( 'End column' ) . optional ( ) ,
259+ startLine : positiveIntSchema . meta ( { description : 'Start line' } ) ,
260+ startColumn : positiveIntSchema
261+ . meta ( { description : 'Start column' } )
262+ . optional ( ) ,
263+ endLine : positiveIntSchema . meta ( { description : 'End line' } ) . optional ( ) ,
264+ endColumn : positiveIntSchema . meta ( { description : 'End column' } ) . optional ( ) ,
257265 } )
258- . describe ( 'Location in file' ) ;
266+ . meta ( { description : 'Location in file' } ) ;
0 commit comments