Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion archive/registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ clap = { version = "4.1", features = ["derive"] }
crossterm = { version = "0.26" }
ntreg = { path = "../ntreg" }
ntstatuserror = { path = "../ntstatuserror" }
schemars = { version = "0.8" }
schemars = { version = "1.0" }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }

Expand Down
43 changes: 13 additions & 30 deletions dsc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dsc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dsc"
version = "3.2.0-preview.2"
version = "3.2.0-preview.3"
edition = "2021"

[profile.release]
Expand All @@ -23,12 +23,12 @@ jsonschema = { version = "0.30", default-features = false }
path-absolutize = { version = "3.1" }
regex = "1.11"
rust-i18n = { version = "3.1" }
schemars = { version = "0.8" }
schemars = { version = "1.0" }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
serde_yaml = { version = "0.9" }
syntect = { version = "5.0", features = ["default-fancy"], default-features = false }
sysinfo = { version = "0.35" }
sysinfo = { version = "0.36" }
thiserror = "2.0"
tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3", features = ["ansi", "env-filter", "json"] }
Expand Down
6 changes: 3 additions & 3 deletions dsc/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use dsc_lib::{
use jsonschema::Validator;
use path_absolutize::Absolutize;
use rust_i18n::t;
use schemars::{schema_for, schema::RootSchema};
use schemars::{Schema, schema_for};
use serde::Deserialize;
use serde_json::Value;
use std::collections::HashMap;
Expand Down Expand Up @@ -145,9 +145,9 @@ pub fn add_fields_to_json(json: &str, fields_to_add: &HashMap<String, String>) -
///
/// # Returns
///
/// * `RootSchema` - The schema
/// * `Schema` - The schema
#[must_use]
pub fn get_schema(schema: SchemaType) -> RootSchema {
pub fn get_schema(schema: SchemaType) -> Schema {
match schema {
SchemaType::GetResult => {
schema_for!(GetResult)
Expand Down
6 changes: 3 additions & 3 deletions dsc/tests/dsc_schema.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Describe 'config schema tests' {
$LASTEXITCODE | Should -Be 0
$schema | Should -Not -BeNullOrEmpty
$schema = $schema | ConvertFrom-Json
$schema.'$schema' | Should -BeExactly 'http://json-schema.org/draft-07/schema#'
$schema.'$schema' | Should -BeExactly 'https://json-schema.org/draft/2020-12/schema'
}

It 'return dsc schema: <type>' -Skip:(!$IsWindows) -TestCases @(
Expand All @@ -26,14 +26,14 @@ Describe 'config schema tests' {
$LASTEXITCODE | Should -Be 0
$schema | Should -Not -BeNullOrEmpty
$schema = $schema | ConvertFrom-Json
$schema.'$schema' | Should -BeExactly 'http://json-schema.org/draft-07/schema#'
$schema.'$schema' | Should -BeExactly 'https://json-schema.org/draft/2020-12/schema'
}

It 'can accept the use of --output-format as a subcommand' {
$schema = dsc resource schema -r Microsoft.DSC.Debug/Echo -o pretty-json
$LASTEXITCODE | Should -Be 0
$schema | Should -Not -BeNullOrEmpty
$schema = $schema | ConvertFrom-Json
$schema.'$schema' | Should -BeExactly 'http://json-schema.org/draft-07/schema#'
$schema.'$schema' | Should -BeExactly 'https://json-schema.org/draft/2020-12/schema'
}
}
35 changes: 9 additions & 26 deletions dsc_lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dsc_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ regex = "1.11"
rt-format = "0.3"
rust-i18n = { version = "3.1" }
# reqwest = { version = "0.12.8", features = ["native-tls"], default-features = false }
schemars = { version = "0.8", features = ["preserve_order"] }
schemars = { version = "1.0", features = ["preserve_order"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
serde_yaml = { version = "0.9" }
Expand Down
13 changes: 6 additions & 7 deletions dsc_lib/src/configure/config_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use chrono::{DateTime, Local};
use rust_i18n::t;
use schemars::JsonSchema;
use schemars::{JsonSchema, json_schema};
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use std::collections::HashMap;
Expand Down Expand Up @@ -193,12 +193,11 @@ impl DscRepoSchema for Configuration {
const SCHEMA_FOLDER_PATH: &'static str = "config";
const SCHEMA_SHOULD_BUNDLE: bool = true;

fn schema_metadata() -> schemars::schema::Metadata {
schemars::schema::Metadata {
title: Some(t!("configure.config_doc.configurationDocumentSchemaTitle").into()),
description: Some(t!("configure.config_doc.configurationDocumentSchemaDescription").into()),
..Default::default()
}
fn schema_metadata() -> schemars::Schema {
json_schema!({
"title": t!("configure.config_doc.configurationDocumentSchemaTitle").to_string(),
"description": t!("configure.config_doc.configurationDocumentSchemaDescription").to_string(),
})
}

fn validate_schema_uri(&self) -> Result<(), DscError> {
Expand Down
13 changes: 6 additions & 7 deletions dsc_lib/src/dscresources/resource_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

use rust_i18n::t;
use schemars::JsonSchema;
use schemars::{Schema, JsonSchema, json_schema};
use semver::Version;
use serde::{Deserialize, Serialize};
use serde_json::Value;
Expand Down Expand Up @@ -240,12 +240,11 @@ impl DscRepoSchema for ResourceManifest {
const SCHEMA_FOLDER_PATH: &'static str = "resource";
const SCHEMA_SHOULD_BUNDLE: bool = true;

fn schema_metadata() -> schemars::schema::Metadata {
schemars::schema::Metadata {
title: Some(t!("dscresources.resource_manifest.resourceManifestSchemaTitle").into()),
description: Some(t!("dscresources.resource_manifest.resourceManifestSchemaDescription").into()),
..Default::default()
}
fn schema_metadata() -> Schema {
json_schema!({
"title": t!("dscresources.resource_manifest.resourceManifestSchemaTitle").to_string(),
"description": t!("dscresources.resource_manifest.resourceManifestSchemaDescription").to_string(),
})
}

fn validate_schema_uri(&self) -> Result<(), DscError> {
Expand Down
13 changes: 6 additions & 7 deletions dsc_lib/src/extensions/extension_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

use rust_i18n::t;
use schemars::JsonSchema;
use schemars::{Schema, JsonSchema, json_schema};
use semver::Version;
use serde::{Deserialize, Serialize};
use serde_json::Value;
Expand Down Expand Up @@ -41,12 +41,11 @@ impl DscRepoSchema for ExtensionManifest {
const SCHEMA_FOLDER_PATH: &'static str = "extension";
const SCHEMA_SHOULD_BUNDLE: bool = true;

fn schema_metadata() -> schemars::schema::Metadata {
schemars::schema::Metadata {
title: Some(t!("extensions.extension_manifest.extensionManifestSchemaTitle").into()),
description: Some(t!("extensions.extension_manifest.extensionManifestSchemaDescription").into()),
..Default::default()
}
fn schema_metadata() -> Schema {
json_schema!({
"title": t!("extensions.extension_manifest.extensionManifestSchemaTitle").to_string(),
"description": t!("extensions.extension_manifest.extensionManifestSchemaDescription").to_string(),
})
}

fn validate_schema_uri(&self) -> Result<(), DscError> {
Expand Down
Loading
Loading