From f558858ef33e718a18d05d30f4d3cf59def49bc2 Mon Sep 17 00:00:00 2001 From: Jessica Black Date: Wed, 15 May 2024 16:30:09 -0700 Subject: [PATCH] Add examples --- Cargo.toml | 2 +- src/locator.rs | 2 ++ src/locator_package.rs | 2 ++ src/locator_strict.rs | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2f4ae1d..3bf8246 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ pretty_assertions = "1.4.0" regex = "1.6.0" schemars = "0.8.19" serde = { version = "1.0.140", features = ["derive"] } +serde_json = "1.0.95" strum = { version = "0.24.1", features = ["derive"] } thiserror = "1.0.31" typed-builder = "0.10.0" @@ -21,4 +22,3 @@ typed-builder = "0.10.0" assert_matches = "1.5.0" itertools = "0.10.5" proptest = "1.0.0" -serde_json = "1.0.95" diff --git a/src/locator.rs b/src/locator.rs index 6453ca5..600f9c2 100644 --- a/src/locator.rs +++ b/src/locator.rs @@ -9,6 +9,7 @@ use schemars::{ JsonSchema, }; use serde::{Deserialize, Serialize}; +use serde_json::json; use typed_builder::TypedBuilder; use crate::{parse_org_project, Error, Fetcher, PackageLocator, ParseError, StrictLocator}; @@ -286,6 +287,7 @@ impl JsonSchema for Locator { "} .to_string(), ), + examples: vec![json!("git+github.com/fossas/example$1234")], ..Default::default() })), ..Default::default() diff --git a/src/locator_package.rs b/src/locator_package.rs index 571c024..20817c3 100644 --- a/src/locator_package.rs +++ b/src/locator_package.rs @@ -7,6 +7,7 @@ use schemars::{ JsonSchema, }; use serde::{Deserialize, Serialize}; +use serde_json::json; use typed_builder::TypedBuilder; use crate::{Error, Fetcher, Locator, StrictLocator}; @@ -161,6 +162,7 @@ impl JsonSchema for PackageLocator { "} .to_string(), ), + examples: vec![json!("git+github.com/fossas/example")], ..Default::default() })), ..Default::default() diff --git a/src/locator_strict.rs b/src/locator_strict.rs index 0936ce2..c13e978 100644 --- a/src/locator_strict.rs +++ b/src/locator_strict.rs @@ -7,6 +7,7 @@ use schemars::{ JsonSchema, }; use serde::{Deserialize, Serialize}; +use serde_json::json; use typed_builder::TypedBuilder; use crate::{Error, Fetcher, Locator, PackageLocator, ParseError}; @@ -186,6 +187,7 @@ impl JsonSchema for StrictLocator { "} .to_string(), ), + examples: vec![json!("git+github.com/fossas/example$1234")], ..Default::default() })), ..Default::default()