@@ -33,7 +33,7 @@ export class TestCoverageEvaluationPlugin {
3333
3434 const schemaPath = fileURLToPath ( keywordLocation ) ;
3535 this . coverageMap [ schemaPath ] . s [ keywordLocation ] ++ ;
36- this . coverageMap [ schemaPath ] . b [ keywordLocation ] [ Number ( valid ) ] ++ ;
36+ this . coverageMap [ schemaPath ] . b [ keywordLocation ] [ Number ( ! valid ) ] ++ ;
3737 }
3838
3939 /** @type NonNullable<EvaluationPlugin["afterSchema"]> */
@@ -102,7 +102,7 @@ export class TestCoverageEvaluationPlugin {
102102 if ( Array . isArray ( ast [ schemaLocation ] ) ) {
103103 for ( const keywordNode of ast [ schemaLocation ] ) {
104104 if ( Array . isArray ( keywordNode ) ) {
105- const [ , keywordLocation ] = keywordNode ;
105+ const [ keywordUri , keywordLocation ] = keywordNode ;
106106
107107 if ( keywordLocation in this . coverageMap [ schemaPath ] . branchMap ) {
108108 continue ;
@@ -117,13 +117,23 @@ export class TestCoverageEvaluationPlugin {
117117 this . coverageMap [ schemaPath ] . s [ keywordLocation ] = 0 ;
118118
119119 // Create branch
120- this . coverageMap [ schemaPath ] . branchMap [ keywordLocation ] = {
121- line : range . start . line ,
122- type : "keyword" ,
123- loc : range ,
124- locations : [ range , range ]
125- } ;
126- this . coverageMap [ schemaPath ] . b [ keywordLocation ] = [ 0 , 0 ] ;
120+ if ( annotationKeywords . has ( keywordUri ) ) {
121+ this . coverageMap [ schemaPath ] . branchMap [ keywordLocation ] = {
122+ line : range . start . line ,
123+ type : "keyword" ,
124+ loc : range ,
125+ locations : [ range ]
126+ } ;
127+ this . coverageMap [ schemaPath ] . b [ keywordLocation ] = [ 0 ] ;
128+ } else {
129+ this . coverageMap [ schemaPath ] . branchMap [ keywordLocation ] = {
130+ line : range . start . line ,
131+ type : "keyword" ,
132+ loc : range ,
133+ locations : [ range , range ]
134+ } ;
135+ this . coverageMap [ schemaPath ] . b [ keywordLocation ] = [ 0 , 0 ] ;
136+ }
127137 }
128138 }
129139 }
@@ -138,3 +148,14 @@ const positionToRange = (position) => {
138148 end : { line : position . end . line , column : position . end . column - 1 }
139149 } ;
140150} ;
151+
152+ const annotationKeywords = new Set ( [
153+ "https://json-schema.org/keyword/title" ,
154+ "https://json-schema.org/keyword/description" ,
155+ "https://json-schema.org/keyword/default" ,
156+ "https://json-schema.org/keyword/deprecated" ,
157+ "https://json-schema.org/keyword/readOnly" ,
158+ "https://json-schema.org/keyword/writeOnly" ,
159+ "https://json-schema.org/keyword/examples" ,
160+ "https://json-schema.org/keyword/format"
161+ ] ) ;
0 commit comments