Add $schema prop to drc/erc

This commit is contained in:
Marek Roszko 2024-02-13 19:03:22 -05:00
parent 7e89d9dee2
commit f73d45b0cf
5 changed files with 13 additions and 2 deletions

View File

@ -115,6 +115,7 @@ bool ERC_REPORT::WriteJsonReport( const wxString& aFullFileName )
RC_JSON::ERC_REPORT reportHead;
wxFileName fn( m_sch->GetFileName() );
reportHead.$schema = "https://schemas.kicad.org/erc.v1.json";
reportHead.source = fn.GetFullName();
reportHead.date = GetISO8601CurrentDateTime();
reportHead.kicad_version = GetMajorMinorPatchVersion();

View File

@ -78,6 +78,7 @@ inline void from_json( const nlohmann::json& aJson, VIOLATION& aViolation )
struct REPORT_BASE
{
wxString $schema;
wxString source;
wxString date;
wxString kicad_version;
@ -94,7 +95,7 @@ struct DRC_REPORT : REPORT_BASE
std::vector<VIOLATION> schematic_parity;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( DRC_REPORT, source, date, kicad_version, violations,
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( DRC_REPORT, $schema, source, date, kicad_version, violations,
unconnected_items, schematic_parity, coordinate_units )
struct ERC_SHEET
@ -113,7 +114,7 @@ struct ERC_REPORT : REPORT_BASE
std::vector<ERC_SHEET> sheets;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( ERC_REPORT, source, date, kicad_version, sheets,
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( ERC_REPORT, $schema, source, date, kicad_version, sheets,
coordinate_units )
} // namespace RC_JSON

View File

@ -123,6 +123,7 @@ bool DRC_REPORT::WriteJsonReport( const wxString& aFullFileName )
RC_JSON::DRC_REPORT reportHead;
wxFileName fn( m_board->GetFileName() );
reportHead.$schema = "https://schemas.kicad.org/drc.v1.json";
reportHead.source = fn.GetFullName();
reportHead.date = GetISO8601CurrentDateTime();
reportHead.kicad_version = GetMajorMinorPatchVersion();

View File

@ -6,6 +6,10 @@
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string",
"description": "JSON schema reference"
},
"source": {
"type": "string",
"description": "Source file path"

View File

@ -6,6 +6,10 @@
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string",
"description": "JSON schema reference"
},
"source": {
"type": "string",
"description": "Source file path"