Em 21/05/2017 16:21, Slaven Rezic escreveu:
I once wrote a Kwalify schema for the reports data:
https://github.com/eserte/cpan-testers-matrix/blob/master/etc/testersdata_schema.yml
To use it, just install Kwalify from CPAN and do something like:
pkwalify -f testersdata_schema.yml $dist.json
Note: this is quite slow for large json files.
Thanks! Nowadays I think the JSON reports are not very large (besides
the report itself that occupies a single member value, but it is still
not very large) so that wouldn't be a problem, I guess.
Note also that some rare (or invalid?) os names are not listed in the schema, and would
case the validation to fail. And I just saw that there's a new (?) field named
"uploadid" which is not yet listed in the schema.
I wouldn't be able to find out a clear definition of that, but I pasted
a sample below (without the report itself on "textreport" to keep it
small) which doesn't include this field you're mentioning.
{
"success":"1",
"result":{
"metadata":{
"core":{
"resource":"cpan:///distfile/PREACTION/Statocles-0.083.tar.gz",
"valid":1,
"creation_time":"2017-04-08T00:36:45Z",
"update_time":"2017-04-08T00:36:45Z",
"type":"CPAN-Testers-Report",
"creator":"metabase:user:a0e144f2-373b-11e6-8edd-c6848980b093",
"schema_version":1,
"guid":"7185287a-1bf3-11e7-8a18-c6c6a528974d"
}
},
"content":[
{
"metadata":{
"core":{
"resource":"cpan:///distfile/PREACTION/Statocles-0.083.tar.gz",
"type":"CPAN-Testers-Fact-LegacyReport",
"update_time":"2017-04-08T00:36:45Z",
"creation_time":"2017-04-08T00:36:45Z",
"valid":1,
"creator":"metabase:user:a0e144f2-373b-11e6-8edd-c6848980b093",
"schema_version":1,
"guid":"71853306-1bf3-11e7-8a18-c6c6a528974d"
}
},
"content":{
"archname":"x86_64-linux-thread-multi",
"osname":"linux",
"osversion":"3.16.0-4-amd64",
"textreport":"<report goes here>",
"grade":"pass",
"perl_version":"v5.26.0"
}
},
{
"metadata":{
"core":{
"resource":"cpan:///distfile/PREACTION/Statocles-0.083.tar.gz",
"valid":1,
"update_time":"2017-04-08T00:36:45Z",
"type":"CPAN-Testers-Fact-TestSummary",
"creation_time":"2017-04-08T00:36:45Z",
"creator":"metabase:user:a0e144f2-373b-11e6-8edd-c6848980b093",
"schema_version":1,
"guid":"71853b58-1bf3-11e7-8a18-c6c6a528974d"
}
},
"content":{
"perl_version":"v5.26.0",
"grade":"pass",
"osname":"linux",
"osversion":"3.16.0-4-amd64",
"archname":"x86_64-linux-thread-multi"
}
}
]
}
}
Maybe the most interesting thing here to see is the duplication of data in the
report files. For example, the test state (pass, fail etc.) is expressed in
three fields. Probably the json files could be made smaller if there was some
normalization...
I agree, it seems that there are some duplications that could be
removed, but without a standard established it is difficult to change
anything.
The only thing I did change is the "success" and "valid" members, that
are clearly boolean but are not using the correct JSON values. I used
JSON::true and JSON::false to replace for the correct values, but that's
all.