Skip to content

Commit

Permalink
Merge pull request #1093 from rainlanguage/2024-12-18-yaml-files-tsif…
Browse files Browse the repository at this point in the history
…y-fix

Fixing default macro for config structs
  • Loading branch information
hardyjosh authored Jan 3, 2025
2 parents 0645f38 + 70454f8 commit 3ab3ada
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
7 changes: 4 additions & 3 deletions crates/settings/src/deployer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use std::{
use strict_yaml_rust::StrictYaml;
use thiserror::Error;
use typeshare::typeshare;
use yaml::{optional_string, require_hash, require_string, YamlError, YamlParsableHash};
use yaml::{
default_document, optional_string, require_hash, require_string, YamlError, YamlParsableHash,
};

#[cfg(target_family = "wasm")]
use rain_orderbook_bindings::{impl_all_wasm_traits, wasm_traits::prelude::*};
Expand All @@ -18,9 +20,8 @@ use rain_orderbook_bindings::{impl_all_wasm_traits, wasm_traits::prelude::*};
#[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(target_family = "wasm", derive(Tsify))]
#[serde(rename_all = "kebab-case")]
#[serde(default)]
pub struct Deployer {
#[serde(skip)]
#[serde(skip, default = "default_document")]
pub document: Arc<RwLock<StrictYaml>>,
pub key: String,
#[typeshare(typescript(type = "string"))]
Expand Down
5 changes: 2 additions & 3 deletions crates/settings/src/metaboard.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::yaml::{require_hash, require_string, YamlError, YamlParsableHash};
use crate::yaml::{default_document, require_hash, require_string, YamlError, YamlParsableHash};
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
Expand All @@ -11,9 +11,8 @@ use url::{ParseError, Url};
#[typeshare]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
#[serde(default)]
pub struct Metaboard {
#[serde(skip)]
#[serde(skip, default = "default_document")]
pub document: Arc<RwLock<StrictYaml>>,
pub key: String,
#[typeshare(typescript(type = "string"))]
Expand Down
7 changes: 4 additions & 3 deletions crates/settings/src/network.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::config_source::*;
use crate::yaml::{optional_string, require_hash, require_string, YamlError, YamlParsableHash};
use crate::yaml::{
default_document, optional_string, require_hash, require_string, YamlError, YamlParsableHash,
};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::{
Expand All @@ -18,9 +20,8 @@ use rain_orderbook_bindings::{impl_all_wasm_traits, wasm_traits::prelude::*};
#[derive(Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(target_family = "wasm", derive(Tsify))]
#[serde(rename_all = "kebab-case")]
#[serde(default)]
pub struct Network {
#[serde(skip)]
#[serde(skip, default = "default_document")]
pub document: Arc<RwLock<StrictYaml>>,
pub key: String,
#[typeshare(typescript(type = "string"))]
Expand Down
7 changes: 4 additions & 3 deletions crates/settings/src/orderbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ use strict_yaml_rust::StrictYaml;
use subgraph::Subgraph;
use thiserror::Error;
use typeshare::typeshare;
use yaml::{optional_string, require_hash, require_string, YamlError, YamlParsableHash};
use yaml::{
default_document, optional_string, require_hash, require_string, YamlError, YamlParsableHash,
};

#[typeshare]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
#[serde(default)]
pub struct Orderbook {
#[serde(skip)]
#[serde(skip, default = "default_document")]
pub document: Arc<RwLock<StrictYaml>>,
pub key: String,
#[typeshare(typescript(type = "string"))]
Expand Down
5 changes: 2 additions & 3 deletions crates/settings/src/subgraph.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::yaml::{require_hash, require_string, YamlError, YamlParsableHash};
use crate::yaml::{default_document, require_hash, require_string, YamlError, YamlParsableHash};
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
Expand All @@ -11,9 +11,8 @@ use url::{ParseError, Url};
#[typeshare]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
#[serde(default)]
pub struct Subgraph {
#[serde(skip)]
#[serde(skip, default = "default_document")]
pub document: Arc<RwLock<StrictYaml>>,
pub key: String,
#[typeshare(typescript(type = "string"))]
Expand Down
7 changes: 4 additions & 3 deletions crates/settings/src/token.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::yaml::{optional_string, require_hash, require_string, YamlError, YamlParsableHash};
use crate::yaml::{
default_document, optional_string, require_hash, require_string, YamlError, YamlParsableHash,
};
use crate::*;
use alloy::primitives::{hex::FromHexError, Address};
use serde::{Deserialize, Serialize};
Expand All @@ -16,9 +18,8 @@ use rain_orderbook_bindings::{impl_all_wasm_traits, wasm_traits::prelude::*};
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
#[cfg_attr(target_family = "wasm", derive(Tsify))]
#[serde(default)]
pub struct Token {
#[serde(skip)]
#[serde(skip, default = "default_document")]
pub document: Arc<RwLock<StrictYaml>>,
pub key: String,
#[typeshare(typescript(type = "Network"))]
Expand Down

0 comments on commit 3ab3ada

Please sign in to comment.