33 descriptionSchema ,
44 docsUrlSchema ,
55 generalFilePathSchema ,
6+ packageVersionSchema ,
67 positiveIntSchema ,
78 scorableSchema ,
89 slugSchema ,
@@ -18,22 +19,26 @@ import {
1819} from './implementation/utils' ;
1920
2021// Define Zod schema for the PluginMetadata type
21- export const pluginMetadataSchema = z . object (
22- {
23- slug : slugSchema ( ) ,
24- name : z
25- . string ( {
26- description : 'Display name' ,
27- } )
28- . max ( 128 ) ,
29- icon : z . union ( [ z . unknown ( ) , z . string ( ) ] , {
30- description : 'Icon from VSCode Material Icons extension' ,
31- } ) ,
32- docsUrl : docsUrlSchema ( 'Plugin documentation site' ) ,
33- } ,
34- {
35- description : 'Plugin metadata' ,
36- } ,
22+ export const pluginMetadataSchema = packageVersionSchema ( {
23+ optional : true ,
24+ } ) . merge (
25+ z . object (
26+ {
27+ slug : slugSchema ( ) ,
28+ name : z
29+ . string ( {
30+ description : 'Display name' ,
31+ } )
32+ . max ( 128 ) ,
33+ icon : z . union ( [ z . unknown ( ) , z . string ( ) ] , {
34+ description : 'Icon from VSCode Material Icons extension' ,
35+ } ) ,
36+ docsUrl : docsUrlSchema ( 'Plugin documentation site' ) ,
37+ } ,
38+ {
39+ description : 'Plugin metadata' ,
40+ } ,
41+ ) ,
3742) ;
3843
3944// Define Zod schema for the RunnerConfig type
@@ -54,11 +59,6 @@ const runnerConfigSchema = z.object(
5459export const auditMetadataSchema = z . object (
5560 {
5661 slug : slugSchema ( 'ID (unique within plugin)' ) ,
57- label : z
58- . string ( {
59- description : 'Abbreviated name' ,
60- } )
61- . max ( 128 ) ,
6262 title : titleSchema ( 'Descriptive name' ) ,
6363 description : descriptionSchema ( 'Description (Markdown)' ) ,
6464 docsUrl : docsUrlSchema ( 'Link to documentation (rationale)' ) ,
@@ -138,27 +138,6 @@ export const pluginConfigSchema = z
138138
139139export type PluginConfig = z . infer < typeof pluginConfigSchema > ;
140140
141- /**
142- * Define Zod schema for the SourceFileLocation type.
143- *
144- * @example
145- *
146- * // Example data for the RunnerOutput type
147- * const runnerOutputData = {
148- * audits: [
149- * // ... populate with example audit data ...
150- * ],
151- * };
152- *
153- * // Validate the data against the schema
154- * const validationResult = runnerOutputSchema.safeParse(runnerOutputData);
155- *
156- * if (validationResult.success) {
157- * console.log('Valid runner output:', validationResult.data);
158- * } else {
159- * console.error('Invalid runner output:', validationResult.error);
160- * }
161- */
162141const sourceFileLocationSchema = z . object (
163142 {
164143 file : unixFilePathSchema ( 'Relative path to source file in Git repo' ) ,
0 commit comments