Set an excluded property in json reports for erc/drc

This commit is contained in:
Marek Roszko 2024-02-13 18:38:12 -05:00
parent b86bf19328
commit 6db6e85161
4 changed files with 28 additions and 1 deletions

View File

@ -165,6 +165,7 @@ void RC_ITEM::GetJsonViolation( RC_JSON::VIOLATION& aViolation, UNITS_PROVIDER*
aViolation.severity = severity;
aViolation.description = GetErrorMessage();
aViolation.type = GetSettingsKey();
aViolation.excluded = ( m_parent && m_parent->IsExcluded() );
EDA_ITEM* mainItem = nullptr;
EDA_ITEM* auxItem = nullptr;

View File

@ -54,9 +54,27 @@ struct VIOLATION
wxString description;
wxString severity;
std::vector<AFFECTED_ITEM> items;
bool excluded;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( VIOLATION, type, description, severity, items )
inline void to_json( nlohmann::json& aJson, const VIOLATION& aViolation )
{
aJson["type"] = aViolation.type;
aJson["description"] = aViolation.description;
aJson["severity"] = aViolation.severity;
aJson["items"] = aViolation.items;
if( aViolation.excluded )
aJson["excluded"] = aViolation.excluded;
}
inline void from_json( const nlohmann::json& aJson, VIOLATION& aViolation )
{
aJson.at( "type" ).get_to( aViolation.type );
aJson.at( "description" ).get_to( aViolation.description );
aJson.at( "severity" ).get_to( aViolation.severity );
aJson.at( "items" ).get_to( aViolation.items );
aJson.at( "excluded" ).get_to( aViolation.excluded );
}
struct REPORT_BASE
{

View File

@ -78,6 +78,10 @@
"items": {
"$ref": "#/definitions/AffectedItem"
}
},
"excluded": {
"type": "boolean",
"default": false
}
},
"required": [

View File

@ -87,6 +87,10 @@
"items": {
"$ref": "#/definitions/AffectedItem"
}
},
"excluded": {
"type": "boolean",
"default": false
}
},
"required": [