Markup2: Difference between revisions
mNo edit summary |
m (added proto schema) |
||
| Line 4: | Line 4: | ||
POST /api/public/markup/export | POST /api/public/markup/export | ||
POST /api/public/markup/copy | POST /api/public/markup/copy | ||
Разметка описывается посредством | Разметка описывается посредством protobuf схемы: | ||
// Represents exported review (review itself + comments) | |||
// Review is associated with invariant and has list of locations | |||
message Review { | |||
// Defines model for concrete location of the review | |||
message Location { | |||
string warnClass = 1; | |||
string file = 2; | |||
uint32 line = 3; | |||
string details = 4; | |||
string mtid = 5; | |||
string function = 10; | |||
bytes content_hash = 6; | |||
bytes trace_hash = 7; | |||
bytes marker_hash = 8; | |||
bytes line_hash = 9; | |||
string tool = 11; | |||
string lang = 12; | |||
} | |||
// Defines model for comment | |||
message Comment { | |||
string text = 1; | |||
optional string format = 2; | |||
google.protobuf.Timestamp create_ts = 3; | |||
optional google.protobuf.Timestamp update_ts = 4; | |||
string createdBy = 5; | |||
string origin_id = 6; | |||
optional uint64 review_id = 7; // refers to Review.id field | |||
optional string created_by_id = 8; | |||
} | |||
// Defines model for review itself | |||
message ReviewData { | |||
string status = 1; | |||
string severity = 2; | |||
string action = 3; | |||
string origin_id = 4; | |||
google.protobuf.Timestamp create_ts = 5; | |||
string created_by = 6; | |||
optional string created_by_id = 7; | |||
optional string created_from = 8; | |||
} | |||
// Invariant of the marker | |||
string invariant = 1; | |||
// Review information associated with markers having given invariant | |||
optional ReviewData review_data = 2; | |||
// List of comments associated with all markers having given invariant | |||
repeated Comment comments = 3; | |||
// List of locations associated with given invariant. Locations can be used to apply fuzzy matching of review with existing data when there is no invariant match | |||
repeated Location locations = 4; | |||
// Export-specific ID, comments can refer to this id if comment is associated with review operation | |||
uint64 id = 5; | |||
// Meta-information about export, when exporting to file field is initialized only for the first element | |||
optional ReviewExportMeta meta = 6; | |||
} | |||
// Defines meta-information about exported review | |||
message ReviewExportMeta { | |||
message Container { | |||
string id = 1; | |||
string name = 2; | |||
} | |||
google.protobuf.Timestamp create_ts = 1; // timestamp when export was produced (UTC) | |||
string created_by = 2; // user who triggered export | |||
string svacer_version = 3; // svacer version | |||
optional Container project = 4; // source container (project) | |||
optional Container branch = 5; // source container (branch) | |||
map<string,string> properties = 6; // extra properties | |||
} | |||
Revision as of 08:59, 15 November 2024
Public REST API для экспорта, импорта и копирования разметки
Релиз 10.х Svacer включает новый API предназначенный для экспорта, импорта и копирования разметки. API доступен по endpoint-ам
POST /api/public/markup/import POST /api/public/markup/export POST /api/public/markup/copy
Разметка описывается посредством protobuf схемы:
// Represents exported review (review itself + comments)
// Review is associated with invariant and has list of locations
message Review {
// Defines model for concrete location of the review
message Location {
string warnClass = 1;
string file = 2;
uint32 line = 3;
string details = 4;
string mtid = 5;
string function = 10;
bytes content_hash = 6;
bytes trace_hash = 7;
bytes marker_hash = 8;
bytes line_hash = 9;
string tool = 11;
string lang = 12;
}
// Defines model for comment
message Comment {
string text = 1;
optional string format = 2;
google.protobuf.Timestamp create_ts = 3;
optional google.protobuf.Timestamp update_ts = 4;
string createdBy = 5;
string origin_id = 6;
optional uint64 review_id = 7; // refers to Review.id field
optional string created_by_id = 8;
}
// Defines model for review itself
message ReviewData {
string status = 1;
string severity = 2;
string action = 3;
string origin_id = 4;
google.protobuf.Timestamp create_ts = 5;
string created_by = 6;
optional string created_by_id = 7;
optional string created_from = 8;
}
// Invariant of the marker
string invariant = 1;
// Review information associated with markers having given invariant
optional ReviewData review_data = 2;
// List of comments associated with all markers having given invariant
repeated Comment comments = 3;
// List of locations associated with given invariant. Locations can be used to apply fuzzy matching of review with existing data when there is no invariant match
repeated Location locations = 4;
// Export-specific ID, comments can refer to this id if comment is associated with review operation
uint64 id = 5;
// Meta-information about export, when exporting to file field is initialized only for the first element
optional ReviewExportMeta meta = 6;
}
// Defines meta-information about exported review
message ReviewExportMeta {
message Container {
string id = 1;
string name = 2;
}
google.protobuf.Timestamp create_ts = 1; // timestamp when export was produced (UTC)
string created_by = 2; // user who triggered export
string svacer_version = 3; // svacer version
optional Container project = 4; // source container (project)
optional Container branch = 5; // source container (branch)
map<string,string> properties = 6; // extra properties
}