File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 135135 "properties" : {
136136 "vendor" : {
137137 "type" : " string" ,
138+ "format" : " string" ,
138139 "title" : " Tool Vendor" ,
139140 "description" : " The date and time (timestamp) when the document was created."
140141 },
141142 "name" : {
142143 "type" : " string" ,
144+ "format" : " string" ,
143145 "title" : " Tool Name" ,
144146 "description" : " The date and time (timestamp) when the document was created."
145147 },
146148 "version" : {
147149 "type" : " string" ,
150+ "format" : " string" ,
148151 "title" : " Tool Version" ,
149152 "description" : " The date and time (timestamp) when the document was created."
150153 },
857860 "properties" : {
858861 "ref" : {
859862 "type" : " string" ,
863+ "format" : " string" ,
860864 "title" : " Reference" ,
861865 "description" : " References a component by the components bom-ref attribute"
862866 },
Original file line number Diff line number Diff line change 126126 "properties" : {
127127 "vendor" : {
128128 "type" : " string" ,
129+ "format" : " string" ,
129130 "title" : " Tool Vendor" ,
130131 "description" : " The date and time (timestamp) when the document was created."
131132 },
132133 "name" : {
133134 "type" : " string" ,
135+ "format" : " string" ,
134136 "title" : " Tool Name" ,
135137 "description" : " The date and time (timestamp) when the document was created."
136138 },
137139 "version" : {
138140 "type" : " string" ,
141+ "format" : " string" ,
139142 "title" : " Tool Version" ,
140143 "description" : " The date and time (timestamp) when the document was created."
141144 },
831834 "properties" : {
832835 "ref" : {
833836 "type" : " string" ,
837+ "format" : " string" ,
834838 "title" : " Reference" ,
835839 "description" : " References a component by the components bom-ref attribute"
836840 },
Original file line number Diff line number Diff line change @@ -72,10 +72,19 @@ for (const bomSchemaFile of bomSchemas) {
7272 console . log ( '> Skipped.' )
7373 continue
7474 }
75- const strict = [ Number ( v [ 1 ] ) , Number ( v [ 2 ] ) ] >= [ 1 , 5 ]
75+
76+ const cdxVersion = [ Number ( v [ 1 ] ) , Number ( v [ 2 ] ) ]
77+ const strict = cdxVersion >= [ 1 , 5 ]
7678 ? true
7779 : 'log'
7880 console . debug ( '> strict:' , strict )
81+ const ajv = getAjv ( strict )
82+
83+ if ( cdxVersion [ 0 ] === 1 && cdxVersion [ 1 ] === 2 ) {
84+ // CycloneDX 1.2 had a wrong undefined format `string`.
85+ // Let's ignore this format only for this special version.
86+ ajv . addFormat ( 'string' , true )
87+ }
7988
8089 let bomSchema
8190 try {
@@ -87,7 +96,7 @@ for (const bomSchemaFile of bomSchemas) {
8796 }
8897
8998 try {
90- getAjv ( strict ) . compile ( bomSchema )
99+ ajv . compile ( bomSchema )
91100 } catch ( err ) {
92101 ++ errCnt
93102 console . error ( `!!! SCHEMA ERROR: ${ err } ` )
You can’t perform that action at this time.
0 commit comments