This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrea Gunderson <agunde@bitwise.io>
- Loading branch information
Showing
2 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2019 Cargill Incorporated | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ----------------------------------------------------------------------------- | ||
|
||
syntax = "proto3"; | ||
|
||
import "schema_state.proto"; | ||
|
||
// SchemaPayload contains an action enum and the associated action payload. | ||
message SchemaPayload { | ||
enum Action { | ||
UNSET_ACTION = 0; | ||
SCHEMA_CREATE = 1; | ||
SCHEMA_UPDATE = 2; | ||
} | ||
|
||
Action action = 1; | ||
|
||
// The smart contract will read from just one of these fields | ||
// according to the Action. Only one of these should be set and must match | ||
// the corresponding Action. | ||
SchemaCreateAction schema_create = 2; | ||
SchemaUpdateAction schema_update = 3; | ||
} | ||
|
||
// SchemaCreateAction adds a new Schema to state. | ||
message SchemaCreateAction { | ||
// The name of the Schema. This is also the unique identifier for the | ||
// new Schema. | ||
string schema_name = 1; | ||
// An optional description of the schema. | ||
string description = 2; | ||
// The property definitions that make up the Schema; must not be empty. | ||
repeated PropertyDefinition properties = 10; | ||
} | ||
|
||
// SchemaUpdateAction updates an existing Schema. The new properties will | ||
// be added to the Schema definitions. | ||
message SchemaUpdateAction { | ||
// The name of the Schema to be updated. | ||
string schema_name = 1; | ||
// The property definitions to be added to the Schema; must not be empty. | ||
repeated PropertyDefinition properties = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright 2019 Cargill Incorporated | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ----------------------------------------------------------------------------- | ||
|
||
syntax = "proto3"; | ||
|
||
message PropertyDefinition { | ||
enum DataType { | ||
UNSET_DATA_TYPE = 0; | ||
BYTES = 1; | ||
BOOLEAN = 2; | ||
NUMBER = 3; | ||
STRING = 4; | ||
ENUM = 5; | ||
STRUCT = 6; | ||
} | ||
// The name of the property | ||
string name = 1; | ||
// The data type of the value; must not be set to UNSET_DATA_TYPE. | ||
DataType data_type = 2; | ||
// Indicates that this is a required property in the Schema | ||
bool required = 3; | ||
// An optional description of the field. | ||
string description = 4; | ||
// The exponent for a NUMBER property | ||
sint32 number_exponent = 10; | ||
// The list of values for an ENUM property; must not be empty/ for | ||
// properties of that type. | ||
repeated string enum_options = 11; | ||
// The list of property definitions for a STRUCT property; must not be | ||
// empty for properties of that type. | ||
repeated PropertyDefinition struct_properties = 12; | ||
} | ||
|
||
message Schema { | ||
// The name of the Schema. This is also the unique identifier for the | ||
// Schema. | ||
string name = 1; | ||
// An optional description of the schema. | ||
string description = 2; | ||
// The Pike organization that has rights to modify the schema. | ||
string owner = 3; | ||
// The property definitions that make up the Schema; must not be empty. | ||
repeated PropertyDefinition properties = 10; | ||
} | ||
|
||
message PropertyValue { | ||
// The name of the property value. Used to validate the property against a | ||
// Schema. | ||
string name = 1; | ||
// The data type of the property. Indicates which value field the actual | ||
// value may be found. Must not be set to `UNSET_DATA_TYPE`. | ||
PropertyDefinition.DataType data_type = 2; | ||
// The value fields for the possible data types. Only one of these will | ||
// contain a value, determined by the value of `data_type` | ||
bytes bytes_value = 10; | ||
bool boolean_value = 11; | ||
sint64 number_value = 12; | ||
string string_value = 13; | ||
uint32 enum_value = 14; | ||
repeated PropertyValue struct_values = 15; | ||
} |