Skip to content

Commit

Permalink
fix spec violations found by the validator
Browse files Browse the repository at this point in the history
- File object had a badly named field
- remove an extension example entry; see #22 for details

Signed-off-by: mimir-d <[email protected]>
  • Loading branch information
mimir-d committed Oct 12, 2024
1 parent 52e3314 commit 639cce7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ jobs:
cargo run --manifest-path $ROOT/Cargo.toml --example {} |
tee /dev/stderr |
go run . -schema ../../json_spec/output/root.json -
"
"
10 changes: 4 additions & 6 deletions examples/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ enum ExtensionType {
}

#[derive(Serialize)]
struct ComplexExtension {
struct Extension {
#[serde(rename = "@type")]
ext_type: ExtensionType,

Expand All @@ -25,13 +25,11 @@ struct ComplexExtension {
}

async fn step0(s: tv::ScopedTestStep) -> Result<TestStatus, tv::OcptvError> {
s.add_extension("simple", "extension_identifier").await?;

s.add_extension(
"complex",
ComplexExtension {
"ext0",
Extension {
ext_type: ExtensionType::Example,
field: "demo".to_owned(),
field: "example".to_owned(),
subtypes: vec![1, 42],
},
)
Expand Down
2 changes: 1 addition & 1 deletion src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ pub struct Diagnosis {
#[derive(Debug, Serialize, PartialEq, Clone)]
#[serde(rename = "file")]
pub struct File {
#[serde(rename = "name")]
#[serde(rename = "displayName")]
pub name: String,

#[serde(rename = "uri")]
Expand Down
4 changes: 2 additions & 2 deletions tests/output/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async fn test_step_with_file() -> Result<()> {
"testStepArtifact": {
"testStepId": "step0",
"file": {
"name": "name",
"displayName": "name",
"uri": uri.clone().as_str().to_owned(),
"isSnapshot": false
}
Expand Down Expand Up @@ -53,7 +53,7 @@ async fn test_step_with_file_builder() -> Result<()> {
"testStepArtifact": {
"testStepId": "step0",
"file": {
"name": "name",
"displayName": "name",
"uri": uri.clone().as_str().to_owned(),
"isSnapshot": false,
"contentType": "text/plain",
Expand Down

0 comments on commit 639cce7

Please sign in to comment.