Skip to content

Instantly share code, notes, and snippets.

@sandeshdamkondwar
Created December 22, 2023 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandeshdamkondwar/81d73eac1dadbeab62262794cba090db to your computer and use it in GitHub Desktop.
Save sandeshdamkondwar/81d73eac1dadbeab62262794cba090db to your computer and use it in GitHub Desktop.
adaptive ui protos
syntax = "proto3";
// Define a component which is a recursive structure
message Component {
string id = 1;
string description = 2;
string component_id = 3;
int32 component_seq = 4;
string component_type = 5;
repeated Component child_components = 6;
oneof component_metadata {
FieldMetadata field_metadata = 7;
DropdownMetadata dropdown_metadata = 8;
TableMetadata table_metadata = 9;
ChartMetadata chart_metadata = 10;
GraphMetadata graph_metadata = 11;
// Add other specific metadata types here
}
}
// Define a rule associated with a component
message Rule {
string id = 1;
string rule_expression = 2; // JSON/String/CEL
string rule_outcome = 3;
}
// Associating Components with Rules
message ComponentRule {
string component_id = 1;
repeated Rule rules = 2;
}
// Metadata types definitions
message FieldMetadata {
// Define specific fields for field metadata
}
message DropdownMetadata {
string name = 1;
string label = 2;
string default_value = 3;
string help_text = 4;
bool is_required = 5;
bool is_editable = 6;
string dropdown_type = 7; // Enum or String for single/multi-select
// Add options structure here
// static_data or data_url details
}
message InputFieldMetadata {
string name = 1;
string label = 2;
string placeholder = 3;
string default_value = 4;
string help_text = 5;
bool is_required = 6;
bool is_editable = 7;
string input_type = 8; // 'text' or 'textarea'
// Validation details here
}
message CheckboxFieldMetadata {
string name = 1;
string label = 2;
string default_value = 3;
string help_text = 4;
bool is_required = 5;
bool is_editable = 6;
// More details if necessary
}
message ButtonMetadata {
string name = 1;
string label = 2;
string click_url = 3; // Assuming URL is a string
}
message DateFieldMetadata {
string name = 1;
string label = 2;
string default_value = 3;
string help_text = 4;
bool is_required = 5;
string date_format = 6;
// Validation details for date range etc.
}
message TableCellMetadata {
string value = 1;
string render_url = 2; // Assuming URL is a string
}
message FilteredTableMetadata {
string name = 1;
string description = 2;
string heading = 3;
string subheading = 4;
repeated Component filters = 5;
repeated ComponentMetadata metadata = 6;
// Column details, rows, static_data, pagination etc.
}
// Define other necessary messages like TableMetadata, ChartMetadata, GraphMetadata, etc.
// Root Config Schema
message ConfigSchema {
string id = 1;
string description = 2;
Component root_component = 3;
repeated ComponentRule component_rules = 4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment