File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -180,11 +180,10 @@ std::string SarifReport::serialize(std::string productName) const
180180 version.erase (version.find (' ' ), std::string::npos);
181181
182182 picojson::object doc;
183- doc[" version" ] = picojson::value (" 2.1.0" );
184183 doc[" $schema" ] = picojson::value (" https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json" );
185184 doc[" runs" ] = serializeRuns (productName, version);
186185
187- return picojson::value (doc).serialize (true );
186+ return " { \n \" version \" : \" 2.1.0 \" , " + picojson::value (doc).serialize (true ). substr ( 1 );
188187}
189188
190189std::string SarifReport::sarifSeverity (const ErrorMessage& errmsg)
Original file line number Diff line number Diff line change @@ -98,6 +98,10 @@ class TestSarifReport : public TestFixture
9898 ASSERT_EQUALS (" 2.1.0" , root.at (" version" ).get <std::string>());
9999 ASSERT (root.at (" $schema" ).get <std::string>().find (" sarif-schema-2.1.0" ) != std::string::npos);
100100
101+ // From SARIF specification (https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141790730):
102+ // Although the order in which properties appear in a JSON object value is not semantically significant, the version property SHOULD appear first.
103+ ASSERT_EQUALS (" {\n \" version\" : \" 2.1.0\" " , sarif.substr (0 ,22 ));
104+
101105 const picojson::array& runs = root.at (" runs" ).get <picojson::array>();
102106 ASSERT_EQUALS (1U , runs.size ());
103107
You can’t perform that action at this time.
0 commit comments