Skip to content

Commit

Permalink
feat: add initial support for schema.org properties
Browse files Browse the repository at this point in the history
  • Loading branch information
onnovalkering committed Apr 3, 2020
1 parent ea31209 commit 1d41659
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
8 changes: 7 additions & 1 deletion src/v11_clt.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::v11_cm::{Any, CwlType, Documentation, Format, SecondaryFiles};
use crate::v11_cm::{Any, CwlType, Documentation, Format, Schema, SecondaryFiles};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use serde_yaml::Value as YValue;
Expand Down Expand Up @@ -42,6 +42,12 @@ pub struct CommandLineTool {
pub success_codes: Option<Vec<u32>>,

pub temporary_fail_codes: Option<Vec<u32>>,

#[serde(flatten)]
pub schema: Schema,

#[serde(rename = "$namespaces")]
pub namespaces: Option<YValue>, // TODO
}

#[serde(untagged, rename_all = "camelCase")]
Expand Down
16 changes: 16 additions & 0 deletions src/v11_cm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use serde_yaml::Value as YValue;

#[skip_serializing_none]
#[serde(rename_all = "camelCase")]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Schema {
#[serde(rename = "s:author")]
pub author: Option<YValue>, // TODO
#[serde(rename = "s:description")]
pub description: Option<String>,
#[serde(rename = "s:license")]
pub license: Option<String>,
#[serde(rename = "s:name")]
pub name: Option<String>,
#[serde(rename = "s:version")]
pub version: Option<String>,
}

#[serde(untagged, rename_all = "camelCase")]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum SecondaryFiles {
Expand Down
28 changes: 17 additions & 11 deletions src/v11_wf.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::v11_cm::{Any, CwlType, Documentation, Format, SecondaryFiles};
use crate::v11_cm::{Any, CwlType, Documentation, Format, Schema, SecondaryFiles};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use serde_yaml::Value as YValue;
Expand All @@ -9,25 +9,31 @@ type Map<T> = std::collections::HashMap<String, T>;
#[serde(rename_all = "camelCase")]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Workflow {
class: String,
pub class: String,

cwl_version: String,
pub cwl_version: String,

doc: Option<Documentation>,
pub doc: Option<Documentation>,

hints: Option<YValue>, // TODO
pub hints: Option<YValue>, // TODO

id: Option<String>,
pub id: Option<String>,

inputs: WorkflowInputs,
pub inputs: WorkflowInputs,

label: Option<String>,
pub label: Option<String>,

pub outputs: WorkflowOutputs,

pub steps: WorkflowSteps,

outputs: WorkflowOutputs,
pub requirements: Option<YValue>, // TODO

steps: WorkflowSteps,
#[serde(flatten)]
pub schema: Schema,

requirements: Option<YValue>, // TODO
#[serde(rename = "$namespaces")]
pub namespaces: Option<YValue>, // TODO
}

#[serde(untagged, rename_all = "camelCase")]
Expand Down

0 comments on commit 1d41659

Please sign in to comment.