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.