| Crates.io | runar-schemas |
| lib.rs | runar-schemas |
| version | 0.1.0 |
| created_at | 2025-08-14 12:08:34.965973+00 |
| updated_at | 2025-08-14 12:08:34.965973+00 |
| description | Protobuf schema types for Runar (ServiceMetadata, etc.) |
| homepage | https://github.com/runar-labs/runar-rust |
| repository | https://github.com/runar-labs/runar-rust |
| max_upload_size | |
| id | 1794780 |
| size | 81,005 |
Shared schema and metadata types for the Runar framework (e.g., ServiceMetadata, ActionMetadata, FieldSchema).
[dependencies]
runar-schemas = "0.1"
use runar_schemas::{ServiceMetadata, ActionMetadata, FieldSchema};
let action = ActionMetadata {
name: "add".into(),
description: "Adds two numbers".into(),
input_schema: Some(FieldSchema::double("a")),
output_schema: Some(FieldSchema::double("result")),
};
let svc = ServiceMetadata {
network_id: "default".into(),
service_path: "math".into(),
name: "Math".into(),
version: "1.0.0".into(),
description: "Basic math ops".into(),
actions: vec![action],
registration_time: 0,
last_start_time: None,
};
ActionMetadata
SubscriptionMetadata
ServiceMetadata
NodeMetadata
SchemaDataType
FieldSchema
use runar_schemas::{FieldSchema, SchemaDataType};
use std::collections::HashMap;
// Primitives
let s = FieldSchema::string("name");
let i = FieldSchema::integer("age");
let l = FieldSchema::long("count");
let f = FieldSchema::float("ratio");
let d = FieldSchema::double("score");
let b = FieldSchema::boolean("active");
let t = FieldSchema::timestamp("created_at");
// Object with properties and required fields
let mut props = HashMap::new();
props.insert("id".into(), Box::new(FieldSchema::integer("id")));
props.insert("name".into(), Box::new(FieldSchema::string("name")));
let obj = FieldSchema::object("User", props, Some(vec!["id".into(), "name".into()]));
// Array of strings
let arr = FieldSchema::array("tags", Box::new(FieldSchema::string("tag")));
// Reference and union
let r = FieldSchema::reference("user", "User");
let u = FieldSchema::union("value", vec![SchemaDataType::String, SchemaDataType::Int32]);
Rust 1.70.0
MIT. See LICENSE.