1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 23:11:50 +03:00
semantic/proto/semantic.proto
2019-02-11 14:27:22 -05:00

207 lines
3.7 KiB
Protocol Buffer

// This file was generated by proto-gen. Do not edit by hand.
syntax = "proto3";
package github.semantic;
option java_package = "com.github.semantic.analysis";
option go_package = "github.com/semantic/analysis/;analysis";
// Semantic's CodeAnalysis service provides endpoints for parsing, analyzing, and comparing source code.
service CodeAnalysis {
// Check health & status of the service.
rpc Ping (PingRequest) returns (PingResponse);
// Calculate c-tags like symbols for blobs.
rpc ParseTreeSymbols (ParseTreeRequest) returns (ParseTreeSymbolResponse);
// Parse trees in adjacency graph representation.
rpc ParseTreeGraph (ParseTreeRequest) returns (ParseTreeGraphResponse);
// Calculate table of contents style diff summaries.
rpc DiffTreeTOC (DiffTreeRequest) returns (DiffTreeTOCResponse);
// Tree diffs in adjacency graph representation.
rpc DiffTreeGraph (DiffTreeRequest) returns (DiffTreeGraphResponse);
}
message PingRequest {
string service = 1;
}
message PingResponse {
string status = 1;
string hostname = 2;
string timestamp = 3;
string sha = 4;
}
message ParseTreeRequest {
repeated Blob blobs = 1;
}
message ParseTreeSymbolResponse {
repeated File files = 1;
}
message ParseTreeGraphResponse {
repeated ParseTreeFileGraph files = 1;
}
message ParseTreeFileGraph {
string path = 1;
Language language = 2;
repeated TermVertex vertices = 3;
repeated TermEdge edges = 4;
repeated ParseError errors = 5;
}
message TermEdge {
int64 source = 1;
int64 target = 2;
}
message TermVertex {
int64 vertexId = 1;
string term = 2;
Span span = 3;
}
message ParseError {
string error = 1;
}
message DiffTreeRequest {
repeated BlobPair blobs = 1;
}
message DiffTreeTOCResponse {
repeated TOCSummaryFile files = 1;
}
message TOCSummaryFile {
string path = 1;
Language language = 2;
repeated TOCSummaryChange changes = 3;
repeated TOCSummaryError errors = 4;
}
message TOCSummaryChange {
string category = 1;
string term = 2;
Span span = 3;
ChangeType changeType = 4;
}
message TOCSummaryError {
string error = 1;
Span span = 2;
}
enum ChangeType {
NONE = 0;
ADDED = 1;
REMOVED = 2;
MODIFIED = 3;
}
message DiffTreeGraphResponse {
repeated DiffTreeFileGraph files = 1;
}
message DiffTreeFileGraph {
string path = 1;
Language language = 2;
repeated DiffTreeVertex vertices = 3;
repeated DiffTreeEdge edges = 4;
repeated ParseError errors = 5;
}
message DiffTreeEdge {
int64 source = 1;
int64 target = 2;
}
message DiffTreeVertex {
int64 diffVertexId = 1;
DiffTreeTerm diffTerm = 2;
}
message DiffTreeTerm {
oneof sum {
DeletedTerm deleted = 1;
InsertedTerm inserted = 2;
ReplacedTerm replaced = 3;
MergedTerm merged = 4;
}
}
message DeletedTerm {
string term = 1;
Span span = 2;
}
message InsertedTerm {
string term = 1;
Span span = 2;
}
message ReplacedTerm {
string beforeTerm = 1;
Span beforeSpan = 2;
string afterTerm = 3;
Span afterSpan = 4;
}
message MergedTerm {
string term = 1;
Span beforeSpan = 2;
Span afterSpan = 3;
}
enum Language {
UNKNOWN = 0;
GO = 1;
HASKELL = 2;
JAVA = 3;
JAVASCRIPT = 4;
JSON = 5;
JSX = 6;
MARKDOWN = 7;
PYTHON = 8;
RUBY = 9;
TYPESCRIPT = 10;
PHP = 11;
}
message Blob {
string content = 1;
string path = 2;
Language language = 3;
}
message BlobPair {
Blob before = 1;
Blob after = 2;
}
message File {
string path = 1;
Language language = 2;
repeated Symbol symbols = 3;
repeated ParseError errors = 4;
}
message Symbol {
string symbol = 1;
string kind = 2;
string line = 3;
Span span = 4;
}
message Position {
int64 line = 1;
int64 column = 2;
}
message Span {
Position start = 1;
Position end = 2;
}