diff --git a/proto/code_analysis.proto b/proto/code_analysis.proto new file mode 100644 index 000000000..fc8d81408 --- /dev/null +++ b/proto/code_analysis.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; +import "types.proto"; +package github.semantic.v1alpha1; + +// Semanic's CodeAnalysis service provides endpoints for parsing, analyzing, and +// comparing source code. +service CodeAnalysis { + // Parsing + // + // Parse source code and return abstract syntax trees. + rpc Parse (ParseTreeRequest) returns (ParseTreeResponse); + + // Diffing + // + // Summary of an AST diff of two source blobs. + rpc SummarizeDiff (SummarizeDiffRequest) returns (SummarizeDiffResponse); + // AST diff of two source blobs + // rpc Diff (DiffRequest) returns (DiffResponse) {} + + // Analyzing + // + // Calculate an import graph for a project. + // rpc GraphImports (ImportGraphRequest) returns (ImportGraphResponse); + // rpc GraphCalls (CallGraphRequest) returns (CallGraphResponse); + + // Basic server health status check. + rpc CheckHealth (HealthCheckRequest) returns (HealthCheckResponse); +} + +message ParseTreeRequest { + repeated Blob blobs = 1; +} + +message ParseTreeResponse { + bytes json_tree = 1; + repeated ParseError errors = 2; +} + +message SummarizeDiffRequest { + repeated BlobPair blobPairs = 1; +} + +message SummarizeDiffResponse { + repeated DiffSummary changes = 1; + repeated ParseError errors = 2; +} + +message BlobPair { + Blob before = 1; + Blob after = 2; +} + +message DiffSummary { + string term = 1; + string name = 2; + Span span = 3; + string change = 4; +} + +message ParseError { + string error = 1; + Span span = 2; + string language = 3; +} + +message HealthCheckRequest { + string service = 1; +} + +message HealthCheckResponse { + enum ServingStatus { + UNKNOWN = 0; + SERVING = 1; + NOT_SERVING = 2; + } + ServingStatus status = 1; +} diff --git a/types.proto b/proto/types.proto similarity index 91% rename from types.proto rename to proto/types.proto index 7d586835e..8ed05d5bc 100644 --- a/types.proto +++ b/proto/types.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package semantic; +package github.semantic.v1alpha1; enum Language {Unknown = 0; Go = 1; Haskell = 2; @@ -28,14 +28,14 @@ message Boolean { bool booleanContent = 1; } message Hash { repeated Term hashElements = 1; } -message Float { bytes floatContent = 1; +message Float { string floatContent = 1; } message KeyValue { Term key = 1; Term value = 2; } message Null { } -message TextElement { bytes textElementContent = 1; +message TextElement { string textElementContent = 1; } message Term { oneof syntax {Array array = 1; Boolean boolean = 2; diff --git a/semantic.proto b/semantic.proto deleted file mode 100644 index 68bad2620..000000000 --- a/semantic.proto +++ /dev/null @@ -1,58 +0,0 @@ -syntax = "proto3"; -import "types.proto"; -package semantic; - -message HealthCheckRequest { - string service = 1; -} - -message HealthCheckResponse { - enum ServingStatus { - UNKNOWN = 0; - SERVING = 1; - NOT_SERVING = 2; - } - ServingStatus status = 1; -} - -service SemanticAPI { - rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse); - rpc FetchSummaries (SummariesRequest) returns (SummariesResponse) {} - rpc ParseBlobs (ParseRequest) returns (ParseResponse) {} -} - -message SummariesRequest { - repeated BlobPair blobPairs = 1; -} - -message ParseRequest { - repeated Blob source = 1; -} - -message BlobPair { - Blob before = 1; - Blob after = 2; -} - -message SummariesResponse { - repeated Summary changes = 1; - repeated Error errors = 2; -} - -message ParseResponse { - bytes json_tree = 1; - repeated Error errors = 2; -} - -message Summary { - string categoryName = 1; - string termName = 2; - Span span = 3; - string changeType = 4; -} - -message Error { - string error = 1; - Span span = 2; - string language = 3; -}