Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a32cb3a4da | |||
| 9cefc225fc | |||
| 4874c09fb5 | |||
| 86d49273bc |
12
src/database/action.rs
Normal file
12
src/database/action.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||||
|
#[serde(default)]
|
||||||
|
pub struct Action {
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub punc: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub navigate: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub launch: Option<String>,
|
||||||
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
pub mod action;
|
||||||
pub mod compile;
|
pub mod compile;
|
||||||
pub mod edge;
|
pub mod edge;
|
||||||
pub mod r#enum;
|
pub mod r#enum;
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
|
use crate::database::action::Action;
|
||||||
use crate::database::schema::Schema;
|
use crate::database::schema::Schema;
|
||||||
|
use indexmap::IndexMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use indexmap::IndexMap;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
@ -219,14 +220,6 @@ pub enum SchemaTypeOrArray {
|
|||||||
Multiple(Vec<String>),
|
Multiple(Vec<String>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
||||||
pub struct Action {
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub navigate: Option<String>,
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub punc: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum Dependency {
|
pub enum Dependency {
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
use crate::database::action::Action;
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -22,14 +23,3 @@ pub struct Sidebar {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub priority: Option<i32>,
|
pub priority: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
|
||||||
#[serde(default)]
|
|
||||||
pub struct Action {
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub punc: Option<String>,
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub navigate: Option<String>,
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub present: Option<String>,
|
|
||||||
}
|
|
||||||
|
|||||||
@ -226,7 +226,10 @@ fn test_library_api() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 4. Validate Happy Path
|
// 4. Validate Happy Path
|
||||||
let happy_drop = jspg_validate("source_schema", JsonB(json!({"type": "source_schema", "name": "Neo"})));
|
let happy_drop = jspg_validate(
|
||||||
|
"source_schema",
|
||||||
|
JsonB(json!({"type": "source_schema", "name": "Neo"})),
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
happy_drop.0,
|
happy_drop.0,
|
||||||
json!({
|
json!({
|
||||||
@ -236,7 +239,10 @@ fn test_library_api() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 5. Validate Unhappy Path
|
// 5. Validate Unhappy Path
|
||||||
let unhappy_drop = jspg_validate("source_schema", JsonB(json!({"type": "source_schema", "wrong": "data"})));
|
let unhappy_drop = jspg_validate(
|
||||||
|
"source_schema",
|
||||||
|
JsonB(json!({"type": "source_schema", "wrong": "data"})),
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unhappy_drop.0,
|
unhappy_drop.0,
|
||||||
json!({
|
json!({
|
||||||
|
|||||||
Reference in New Issue
Block a user