skir 1.2.18 → 1.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -31
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<h1>Skir</h1>
|
|
3
|
-
<p><strong>
|
|
3
|
+
<p><strong>Protobuf reimagined for today</strong></p>
|
|
4
4
|
|
|
5
5
|
<p>
|
|
6
6
|
<a href="https://skir.build/"><b>skir.build</b></a>
|
|
@@ -12,52 +12,52 @@
|
|
|
12
12
|
|
|
13
13
|
<br />
|
|
14
14
|
|
|
15
|
-
**Skir** is a declarative language for
|
|
16
|
-
Write
|
|
15
|
+
**Skir** is a modern declarative schema language for data models and APIs.
|
|
16
|
+
Write once in a `.skir` file - instantly generate clean, idiomatic, and fully type-safe code in TypeScript, Python, Java, Go, C++, and more languages.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Quick demo
|
|
19
19
|
|
|
20
20
|

|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Features
|
|
23
23
|
|
|
24
|
-
- 🧩 **One schema,
|
|
24
|
+
- 🧩 **One schema, 10+ languages, zero headaches** - One YAML config, one command, and watch mode that refreshes generated code on every change.
|
|
25
25
|
- 🛡️ **End-to-end type safety** - Shared method and type definitions keep client/server contracts aligned before runtime.
|
|
26
26
|
- ⚡ **SkirRPC + Studio** - Lightweight HTTP RPC with a built-in Studio app for browsing and testing methods.
|
|
27
27
|
- 📦 **GitHub imports** - Import types directly from GitHub repositories to share data structures across projects.
|
|
28
28
|
- 🔁 **Serialization modes** - Dense JSON for APIs/DBs, readable JSON for debugging, and binary for raw performance.
|
|
29
|
-
- 🕰️ **Safe schema evolution** - Built-in checks and clear rules so old and new data remain deserializable.
|
|
30
29
|
- 🧬 **Polymorphism done right** - Sum types let variants be constants or carry typed payloads for clean, explicit polymorphism.
|
|
30
|
+
- 🕰️ **Safe schema evolution** - Built-in checks and clear rules so old and new data remain deserializable.
|
|
31
31
|
- 🔒 **Prioritizes immutability** - Skir generates deeply immutable types with all fields required at construction time.
|
|
32
32
|
- 🗂️ **Key-indexed arrays** - Declare arrays like `[User|user_id]` and get fast key-based lookup APIs.
|
|
33
33
|
- 🛠️ **First-class tooling** - VS Code extension + LSP with validation, completion, and auto-formatting.
|
|
34
34
|
- 🧱 **Easy to extend** - Generators are regular NPM modules, so custom generators plug in cleanly.
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Syntax example
|
|
37
37
|
|
|
38
38
|
```d
|
|
39
|
-
//
|
|
39
|
+
// robot.skir
|
|
40
|
+
|
|
41
|
+
enum RobotAction {
|
|
42
|
+
wave;
|
|
43
|
+
say: string;
|
|
44
|
+
move: Point;
|
|
45
|
+
}
|
|
40
46
|
|
|
41
47
|
struct Point {
|
|
42
48
|
x: int32;
|
|
43
49
|
y: int32;
|
|
44
|
-
label: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
struct Shape {
|
|
48
|
-
points: [Point];
|
|
49
|
-
/// A short string describing this shape.
|
|
50
|
-
label: string;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
const GREET_ACTIONS: [RobotAction] = [
|
|
53
|
+
"wave",
|
|
54
|
+
{
|
|
55
|
+
kind: "say",
|
|
56
|
+
value: "Hi!",
|
|
57
|
+
},
|
|
58
|
+
];
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
method IsConvex(Shape): bool = 12345;
|
|
60
|
+
method PerformAction(RobotAction): bool = 12345;
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Skir compiles these definitions into native, type-safe code you can use in your project:
|
|
@@ -65,18 +65,21 @@ Skir compiles these definitions into native, type-safe code you can use in your
|
|
|
65
65
|
```python
|
|
66
66
|
# my_project.py
|
|
67
67
|
|
|
68
|
-
from skirout.
|
|
68
|
+
from skirout.robot_skir import Point, RobotAction
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
wave = RobotAction.WAVE
|
|
71
|
+
say_hi = RobotAction.wrap_say("Hi!")
|
|
72
|
+
move_origin = RobotAction.wrap_move(Point(x=0, y=0))
|
|
71
73
|
|
|
72
|
-
# Round
|
|
73
|
-
|
|
74
|
-
restored =
|
|
74
|
+
# Round-trip serialization to JSON
|
|
75
|
+
action_json = RobotAction.serializer.to_json(say_hi)
|
|
76
|
+
restored = RobotAction.serializer.from_json(action_json)
|
|
75
77
|
|
|
76
|
-
assert
|
|
78
|
+
assert restored == say_hi
|
|
79
|
+
assert move_origin.union.kind == "move"
|
|
77
80
|
```
|
|
78
81
|
|
|
79
|
-
##
|
|
82
|
+
## Documentation
|
|
80
83
|
|
|
81
84
|
- [Getting started: setup & workflow](https://skir.build/docs/setup)
|
|
82
85
|
- [Language reference](https://skir.build/docs/language-reference)
|
|
@@ -86,7 +89,7 @@ assert(restored == point)
|
|
|
86
89
|
- [Github imports](https://skir.build/docs/github-imports)
|
|
87
90
|
- [Coming from Protocol Buffer](https://skir.build/docs/protobuf)
|
|
88
91
|
|
|
89
|
-
##
|
|
92
|
+
## Supported languages
|
|
90
93
|
|
|
91
94
|
| Language | Documentation | Example |
|
|
92
95
|
| :--- | :--- | :--- |
|
|
@@ -102,3 +105,4 @@ assert(restored == point)
|
|
|
102
105
|
| 🐦 **Swift** | [Documentation](https://skir.build/docs/swift) | [Example](https://github.com/gepheum/skir-swift-example) |
|
|
103
106
|
| ✨ **Gleam** | [Documentation](https://skir.build/docs/gleam) | [Example](https://github.com/gepheum/skir-gleam-example) |
|
|
104
107
|
| ⚡ **Zig** | [Documentation](https://skir.build/docs/zig) | [Example](https://github.com/gepheum/skir-zig-example) |
|
|
108
|
+
| 🌙 **MoonBit** | [Documentation](https://skir.build/docs/moonbit) | [Example](https://github.com/gepheum/skir-moonbit-example) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skir",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://skir.build/",
|
|
6
6
|
"bugs": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"glob": "^13.0.6",
|
|
45
45
|
"skir-cc-gen": "^1.0.16",
|
|
46
46
|
"skir-csharp-gen": "^0.1.1",
|
|
47
|
-
"skir-dart-gen": "^1.0.
|
|
47
|
+
"skir-dart-gen": "^1.0.8",
|
|
48
48
|
"skir-gleam-gen": "^0.1.2",
|
|
49
49
|
"skir-go-gen": "^0.1.7",
|
|
50
50
|
"skir-internal": "^0.2.21",
|