Skip to content

Commit 04a4d2f

Browse files
Merge pull request #115 from code0-tech/107-proto-json-rust
ProtoJSON Rust
2 parents 3244475 + aabad7f commit 04a4d2f

File tree

21 files changed

+516
-234
lines changed

21 files changed

+516
-234
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
if: startsWith(github.ref, 'refs/tags/pkg-')
3131
defaults:
3232
run:
33-
working-directory: "./reader/rust"
33+
working-directory: "./crates/package"
3434
steps:
3535
- name: Checkout Code
3636
uses: actions/checkout@v5
@@ -69,7 +69,7 @@ jobs:
6969
7070
- name: Build project
7171
run: cargo run bundle --path ../definitions --out ../bundles
72-
working-directory: "./cli"
72+
working-directory: "./crates/cli"
7373

7474
- name: Archive definitions folder
7575
run: |
@@ -94,7 +94,7 @@ jobs:
9494
if: startsWith(github.ref, 'refs/tags/cli-')
9595
defaults:
9696
run:
97-
working-directory: "./cli"
97+
working-directory: "./crates/cli"
9898
steps:
9999
- name: Checkout Code
100100
uses: actions/checkout@v5

Cargo.lock

Lines changed: 72 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
[workspace]
2-
members = ["cli", "reader/rust"]
2+
members = ["crates/cli", "crates/package"]
33
resolver = "3"
44

55
[workspace.package]
6-
version = "0.0.1"
76
edition = "2024"
87

98
[workspace.dependencies]
109
serde = "1.0.219"
1110
serde_json = "1.0.140"
12-
tucana = "0.0.37"
11+
tucana = "0.0.38"
1312
clap = "4.5.41"
1413
colored = "3.0"
1514
tabled = "0.20"
@@ -19,5 +18,4 @@ tokio = "1.47.0"
1918
futures = "0.3.31"
2019
zip = "6.0.0"
2120
bytes = "1.10.1"
22-
prost = "0.14.1"
23-
code0-definition-reader= "0.0.13"
21+
prost = "0.14.1"

cli/Cargo.toml renamed to crates/cli/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ description = "The cli for managing the Code0-Definitions"
66
repository = "https://github.com/code0-tech/code0-definitions"
77
homepage = "https://code0.tech"
88
license = "Apache-2.0"
9-
readme = "../README.md"
9+
readme = "../../README.md"
1010

1111
[dependencies]
1212
clap = { workspace = true, features = ["derive"] }
13-
code0-definition-reader = { workspace = true }
1413
tucana = { workspace = true }
1514
colored = { workspace = true }
1615
tabled = { workspace = true }
@@ -22,4 +21,4 @@ tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros"] }
2221
futures = { workspace = true }
2322
zip = { workspace = true }
2423
bytes = { workspace = true }
25-
prost = {workspace = true}
24+
prost = { workspace = true }

cli/src/analyser/diagnostics.rs renamed to crates/cli/src/analyser/diagnostics.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::formatter::{error, warning};
2-
use code0_definition_reader::reader::Meta;
2+
use crate::parser::Meta;
33
use std::cmp::PartialEq;
44
use std::path::Path;
55
use std::process::exit;
@@ -66,13 +66,6 @@ impl Reporter {
6666
.filter(|p| p.kind.severity() == Severity::Warning)
6767
.collect()
6868
}
69-
70-
pub fn get_debug(&self) -> Vec<&Diagnose> {
71-
self.diagnose
72-
.iter()
73-
.filter(|p| p.kind.severity() == Severity::Debug)
74-
.collect()
75-
}
7669
}
7770

7871
pub enum Severity {

cli/src/analyser/mod.rs renamed to crates/cli/src/analyser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use crate::analyser::diagnostics::DiagnosticKind::{
66
UndefinedGenericKey, UndefinedTranslation, UnusedGenericKey,
77
};
88
use crate::analyser::diagnostics::{Diagnose, DiagnosticKind, Reporter};
9-
use code0_definition_reader::parser::Parser;
10-
use code0_definition_reader::reader::{Meta, MetaType, Reader};
9+
use crate::parser::Parser;
10+
use crate::parser::{Meta, MetaType, Reader};
1111
use tucana::shared::data_type_identifier::Type;
1212
use tucana::shared::definition_data_type_rule::Config;
1313
use tucana::shared::{DataTypeIdentifier, DefinitionDataType, FlowType, RuntimeFunctionDefinition};

cli/src/command/bundle.rs renamed to crates/cli/src/command/bundle.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use code0_definition_reader::parser::Parser;
1+
use crate::parser::Parser;
22
use prost::Message;
33
use std::fs;
44
use std::io::Write;
@@ -23,7 +23,7 @@ pub fn bundle(path: Option<String>, out: Option<String>) {
2323
for feature in parser.features {
2424
feature.data_types.iter().for_each(|data_type| {
2525
let mut buf = Vec::new();
26-
if let Ok(_) = data_type.encode(&mut buf) {
26+
if data_type.encode(&mut buf).is_ok() {
2727
let path = format!(
2828
"{}/{}_{}_{}.pb",
2929
&out_path,
@@ -40,7 +40,7 @@ pub fn bundle(path: Option<String>, out: Option<String>) {
4040

4141
feature.flow_types.iter().for_each(|flow_type| {
4242
let mut buf = Vec::new();
43-
if let Ok(_) = flow_type.encode(&mut buf) {
43+
if flow_type.encode(&mut buf).is_ok() {
4444
let path = format!(
4545
"{}/{}_{}_{}.pb",
4646
&out_path,
@@ -57,7 +57,7 @@ pub fn bundle(path: Option<String>, out: Option<String>) {
5757

5858
feature.runtime_functions.iter().for_each(|function| {
5959
let mut buf = Vec::new();
60-
if let Ok(_) = function.encode(&mut buf) {
60+
if function.encode(&mut buf).is_ok() {
6161
let path = format!(
6262
"{}/{}_{}_{}.pb",
6363
&out_path,

cli/src/command/definition.rs renamed to crates/cli/src/command/definition.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use crate::formatter::{info, success};
2-
use code0_definition_reader::parser::Parser;
2+
use crate::parser::Parser;
33
use colored::Colorize;
4-
use prost::Message;
5-
use tucana::shared::DefinitionDataType;
64

75
pub fn search_definition(name: String, path: Option<String>) {
86
let dir_path = path.unwrap_or_else(|| "./definitions".to_string());
File renamed without changes.

cli/src/command/feature.rs renamed to crates/cli/src/command/feature.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::analyser::Analyser;
22
use crate::formatter::{success, success_table};
3+
use crate::parser::{Feature, Parser};
34
use crate::table::{feature_table, summary_table};
4-
use code0_definition_reader::parser::{Feature, Parser};
55

66
pub fn search_feature(name: Option<String>, path: Option<String>) {
77
let dir_path = path.unwrap_or_else(|| "./definitions".to_string());

0 commit comments

Comments
 (0)