github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/proto/internal/developer/v1/developer.proto (about) 1 syntax = "proto3"; 2 package developer.v1; 3 4 import "authzed/api/v1/debug.proto"; 5 import "core/v1/core.proto"; 6 import "dispatch/v1/dispatch.proto"; 7 import "google/protobuf/struct.proto"; 8 import "validate/validate.proto"; 9 10 option go_package = "github.com/authzed/spicedb/pkg/proto/developer/v1"; 11 12 // DeveloperRequest is a single request made to the developer platform, containing zero or more 13 // operations to run. 14 message DeveloperRequest { 15 // context is the context for the developer request. 16 RequestContext context = 1; 17 18 // operations are the operations to be run as part of the developer request. 19 repeated Operation operations = 2; 20 } 21 22 // DeveloperResponse is the response to a single request made to the developer platform. 23 message DeveloperResponse { 24 // internal_error is the internal error that occurred when attempting to run this operation, if any. 25 string internal_error = 1; 26 27 // developer_errors are the developer error(s) returned in the operation, if any. 28 DeveloperErrors developer_errors = 2; 29 30 // operations_results holds the results of the operations, if any and no errors. 31 OperationsResults operations_results = 3; 32 } 33 34 // RequestContext is the context for setting up a development package environment for one or more 35 // operations. 36 message RequestContext { 37 // schema is the schema on which to run the developer request. 38 string schema = 1; 39 40 // relationships are the test data relationships for the developer request. 41 repeated core.v1.RelationTuple relationships = 2; 42 } 43 44 // Operation is a single operation to be processed by the development package. 45 message Operation { 46 CheckOperationParameters check_parameters = 1; 47 RunAssertionsParameters assertions_parameters = 2; 48 RunValidationParameters validation_parameters = 3; 49 FormatSchemaParameters format_schema_parameters = 4; 50 } 51 52 // OperationsResults holds the results for the operations, indexed by the operation. 53 message OperationsResults { 54 map<uint64, OperationResult> results = 1; 55 } 56 57 // OperationResult contains the result data given to the callback for an operation. 58 message OperationResult { 59 CheckOperationsResult check_result = 1; 60 RunAssertionsResult assertions_result = 2; 61 RunValidationResult validation_result = 3; 62 FormatSchemaResult format_schema_result = 4; 63 } 64 65 // DeveloperWarning represents a single warning raised by the development package. 66 message DeveloperWarning { 67 // message is the message for the developer warning. 68 string message = 1; 69 70 // line is the 1-indexed line for the developer warning. 71 uint32 line = 2; 72 73 // column is the 1-indexed column on the line for the developer warning. 74 uint32 column = 3; 75 } 76 77 // DeveloperError represents a single error raised by the development package. Unlike an internal 78 // error, it represents an issue with the entered information by the calling developer. 79 message DeveloperError { 80 enum Source { 81 UNKNOWN_SOURCE = 0; 82 SCHEMA = 1; 83 RELATIONSHIP = 2; 84 VALIDATION_YAML = 3; 85 CHECK_WATCH = 4; 86 ASSERTION = 5; 87 } 88 89 enum ErrorKind { 90 UNKNOWN_KIND = 0; 91 PARSE_ERROR = 1; 92 SCHEMA_ISSUE = 2; 93 DUPLICATE_RELATIONSHIP = 3; 94 MISSING_EXPECTED_RELATIONSHIP = 4; 95 EXTRA_RELATIONSHIP_FOUND = 5; 96 UNKNOWN_OBJECT_TYPE = 6; 97 UNKNOWN_RELATION = 7; 98 MAXIMUM_RECURSION = 8; 99 ASSERTION_FAILED = 9; 100 INVALID_SUBJECT_TYPE = 10; 101 } 102 103 string message = 1; 104 105 // line is the 1-indexed line for the developer error. 106 uint32 line = 2; 107 108 // column is the 1-indexed column on the line for the developer error. 109 uint32 column = 3; 110 111 // source is the source location of the error. 112 Source source = 4; 113 ErrorKind kind = 5; 114 115 repeated string path = 6; 116 117 // context holds the context for the error. For schema issues, this will be the 118 // name of the object type. For relationship issues, the full relationship string. 119 string context = 7; 120 121 // debug_information is the debug information for the dispatched check, if this error was raised 122 // due to an assertion failure. 123 dispatch.v1.DebugInformation check_debug_information = 8; 124 125 // resolved_debug_information is the V1 API debug information for the check, if this error was raised 126 // due to an assertion failure. 127 authzed.api.v1.DebugInformation check_resolved_debug_information = 9; 128 } 129 130 // DeveloperErrors represents the developer error(s) found after the run has completed. 131 message DeveloperErrors { 132 // input_errors are those error(s) in the schema, relationships, or assertions inputted by the developer. 133 repeated DeveloperError input_errors = 1; 134 } 135 136 // CheckOperationParameters are the parameters for a `check` operation. 137 message CheckOperationParameters { 138 core.v1.ObjectAndRelation resource = 1; 139 core.v1.ObjectAndRelation subject = 2; 140 141 /** caveat_context consists of any named values that are defined at write time for the caveat expression **/ 142 google.protobuf.Struct caveat_context = 3 [(validate.rules).message.required = false]; 143 } 144 145 // CheckOperationsResult is the result for a `check` operation. 146 message CheckOperationsResult { 147 enum Membership { 148 UNKNOWN = 0; 149 NOT_MEMBER = 1; 150 MEMBER = 2; 151 CAVEATED_MEMBER = 3; 152 } 153 154 Membership membership = 1; 155 156 // check_error is the error raised by the check, if any. 157 DeveloperError check_error = 2; 158 159 // debug_information is the debug information for the check. 160 dispatch.v1.DebugInformation debug_information = 3; 161 162 // partial_caveat_info holds information a partial evaluation of a caveat. 163 PartialCaveatInfo partial_caveat_info = 4; 164 165 // resolved_debug_information is the V1 API debug information for the check. 166 authzed.api.v1.DebugInformation resolved_debug_information = 5; 167 } 168 169 // PartialCaveatInfo carries information necessary for the client to take action 170 // in the event a response contains a partially evaluated caveat 171 message PartialCaveatInfo { 172 // missing_required_context is a list of one or more fields that were missing and prevented caveats 173 // from being fully evaluated 174 repeated string missing_required_context = 1 [(validate.rules).repeated.min_items = 1]; 175 } 176 177 // RunAssertionsParameters are the parameters for a `runAssertions` operation. 178 message RunAssertionsParameters { 179 // assertions_yaml are the assertions, in YAML form, to be run. 180 string assertions_yaml = 1; 181 } 182 183 // RunAssertionsResult is the result for a `runAssertions` operation. 184 message RunAssertionsResult { 185 // input_error is an error in the given YAML. 186 DeveloperError input_error = 1; 187 188 // validation_errors are the validation errors which occurred, if any. 189 repeated DeveloperError validation_errors = 2; 190 } 191 192 // RunValidationParameters are the parameters for a `runValidation` operation. 193 message RunValidationParameters { 194 // validation_yaml is the expected relations validation, in YAML form, to be run. 195 string validation_yaml = 1; 196 } 197 198 // RunValidationResult is the result for a `runValidation` operation. 199 message RunValidationResult { 200 // input_error is an error in the given YAML. 201 DeveloperError input_error = 1; 202 203 // updated_validation_yaml contains the generated and updated validation YAML for the expected 204 // relations tab. 205 string updated_validation_yaml = 2; 206 207 // validation_errors are the validation errors which occurred, if any. 208 repeated DeveloperError validation_errors = 3; 209 } 210 211 // FormatSchemaParameters are the parameters for a `formatSchema` operation. 212 message FormatSchemaParameters { 213 // empty 214 } 215 216 // FormatSchemaResult is the result of the `formatSchema` operation. 217 message FormatSchemaResult { 218 string formatted_schema = 1; 219 }