1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// SPDX-License-Identifier: MIT
// Copyright 2026 Tom F. <https://github.com/tomtom215/>
// My way of giving something small back to the open source community
// and encouraging more Rust development!
use crateExtensionError;
use DescriptionYml;
use parse_description_yml;
/// Validates a `description.yml` string and returns `Ok(())` if it passes all checks.
///
/// This is a convenience wrapper around [`parse_description_yml`] for callers that
/// only need a pass/fail result.
///
/// # Errors
///
/// Returns [`ExtensionError`] on the first validation failure.
///
/// # Example
///
/// ```rust
/// use quack_rs::validate::description_yml::validate_description_yml_str;
///
/// let valid_yml = "\
/// extension:\n\
/// name: my_ext\n\
/// description: My extension.\n\
/// version: 0.1.0\n\
/// language: Rust\n\
/// build: cargo\n\
/// license: MIT\n\
/// requires_toolchains: rust;python3\n\
/// maintainers:\n\
/// - Jane Doe\n\
/// \n\
/// repo:\n\
/// github: janedoe/duckdb-my-ext\n\
/// ref: main\n";
///
/// assert!(validate_description_yml_str(valid_yml).is_ok());
///
/// // Missing required field
/// assert!(validate_description_yml_str("extension:\n name: bad!Name\n").is_err());
/// ```
/// Validates that a Rust extension's `description.yml` follows pure-Rust best practices.
///
/// This function checks:
/// - `language` is `"Rust"`
/// - `build` is `"cargo"`
/// - `requires_toolchains` includes `"rust"`
///
/// These are the required values for a pure-Rust extension built with `quack-rs`.
///
/// # Errors
///
/// Returns [`ExtensionError`] if any Rust-specific field is missing or wrong.
///
/// # Example
///
/// ```rust
/// use quack_rs::validate::description_yml::{parse_description_yml, validate_rust_extension};
///
/// let yml = "\
/// extension:\n\
/// name: my_ext\n\
/// description: My extension.\n\
/// version: 0.1.0\n\
/// language: Rust\n\
/// build: cargo\n\
/// license: MIT\n\
/// requires_toolchains: rust;python3\n\
/// maintainers:\n\
/// - Jane Doe\n\
/// \n\
/// repo:\n\
/// github: janedoe/duckdb-my-ext\n\
/// ref: main\n";
///
/// let desc = parse_description_yml(yml).unwrap();
/// assert!(validate_rust_extension(&desc).is_ok());
/// ```