Skir is a powerful declarative language that shares the same goals as Protobuf but does a few things better, for example: polymorphism (via Rust-like enums), GitHub imports, built-in compatibility checks, a first-in-class DX.
Skir is a modern declarative language designed for defining data types, constants, and APIs, providing a streamlined alternative to Protocol Buffers. By utilizing a .skir file for schema definitions, users can generate idiomatic, type-safe code across multiple programming languages such as TypeScript, Python, Java, Go, C++, and more.
[User|user_id].Below is a simple example of a schema definition in Skir:
struct Point {
x: int32;
y: int32;
label: string;
}
struct Shape {
points: [Point];
/// A short string describing this shape.
label: string;
}
const TOP_RIGHT_CORNER: Point = {
x: 600,
y: 400,
label: "top-right corner",
};
/// Returns true if no part of the shape's boundary curves inward.
method IsConvex(Shape): bool = 12345;
The above definitions compile into native, type-safe code that can be utilized in various projects. For example, in Python:
# my_project.py
from skirout.shapes_skir import Point # Python module generated by Skir
point = Point(x=3, y=4, label="P")
# Round-trip serialization to JSON
point_json = Point.serializer.to_json(point)
restored = Point.serializer.from_json(point_json)
assert(restored == point)
Skir supports various programming languages with comprehensive documentation and examples:
| Language | Documentation | Example |
|---|---|---|
| 🟦 TypeScript | Documentation | Example |
| 🐍 Python | Documentation | Example |
| ⚡ C++ | Documentation | Example |
| ☕ Java | Documentation | Example |
| 💜 Kotlin | Documentation | Example |
| 🦀 Rust | Documentation | Example |
| 🐹 Go | Documentation | Example |
| 🎯 Dart | Documentation | Example |
| 🐦 Swift | Documentation | Example |
For more detailed information about getting started, refer to the documentation.
Explore Skir for an efficient and type-safe approach to data definition and serialization.
No comments yet.
Sign in to be the first to comment.