Skip to main content

Module validate

Module validate 

Source
Expand description

Validation utilities for DuckDB community extension compliance.

This module provides compile-time and runtime validators that enforce the DuckDB Community Extension requirements. Extensions that pass these checks are ready for submission to the DuckDB community extensions repository.

§What is validated

  • Extension name: A lowercase letter, then lowercase letters, digits and underscores (no hyphens: DuckDB derives the <name>_init_c_api symbol from it); for a community extension, also not a DuckDB alias (s3) or core extension name (json)
  • Function name: Letters, digits and underscores, and not a reserved SQL keyword — anything needing quotes in SQL is rejected
  • Semantic versioning: validate_semver for strict semver; extension versions are checked far more loosely, because DuckDB specifies no format
  • SPDX license: Must be a recognized SPDX license identifier
  • Platform targets: Exclusions must name real DuckDB build targets, kept in sync with extension-ci-tools’ distribution matrix by CI
  • Platform exclusion list: Semicolon-separated string from description.yml
  • Cargo.toml: Release profile settings for loadable extensions

§Example

use quack_rs::validate::{
    validate_extension_name, validate_extension_version,
    validate_function_name, validate_semver, validate_spdx_license,
    validate_platform, validate_excluded_platforms_str,
};

assert!(validate_extension_name("my_extension").is_ok());
assert!(validate_extension_name("MyExt").is_err()); // uppercase not allowed

assert!(validate_function_name("word_count").is_ok());
// Mixed case is fine — DuckDB ships `formatReadableSize`.
assert!(validate_function_name("wordCount").is_ok());
assert!(validate_function_name("word-count").is_err()); // would need quoting in SQL

assert!(validate_semver("1.0.0").is_ok());
assert!(validate_semver("not-a-version").is_err());

// Extension versions accept both semver and git hashes (unstable)
assert!(validate_extension_version("0.1.0").is_ok());
assert!(validate_extension_version("690bfc5").is_ok());

assert!(validate_spdx_license("MIT").is_ok());
assert!(validate_spdx_license("FAKE-LICENSE").is_err());

assert!(validate_platform("linux_amd64").is_ok());
assert!(validate_platform("freebsd_amd64").is_err());

// Validate the semicolon-separated excluded_platforms field from description.yml
assert!(validate_excluded_platforms_str("wasm_mvp;wasm_eh;wasm_threads").is_ok());
assert!(validate_excluded_platforms_str("invalid_platform").is_err());
assert!(validate_excluded_platforms_str("").is_ok()); // empty means no exclusions

Re-exports§

pub use extension_name::validate_community_extension_name;
pub use extension_name::validate_extension_name;
pub use extension_name::DUCKDB_CORE_EXTENSION_NAMES;
pub use extension_name::DUCKDB_EXTENSION_ALIASES;
pub use extension_name::DUCKDB_RESERVED_EXTENSION_NAMES;
pub use function_name::validate_function_name;
pub use function_name::validate_parameter_name;
pub use function_name::DUCKDB_RESERVED_KEYWORDS;
pub use function_name::DUCKDB_UNCALLABLE_KEYWORDS;
pub use function_name::DUCKDB_UNREFERENCEABLE_PARAMETER_KEYWORDS;
pub use platform::is_opt_in_platform;
pub use platform::validate_excluded_platforms;
pub use platform::validate_platform;
pub use platform::DUCKDB_CI_PLATFORMS;
pub use platform::DUCKDB_OPT_IN_PLATFORMS;
pub use platform::DUCKDB_PLATFORMS;
pub use platform::DUCKDB_PLATFORM_GROUPS;
pub use platform::DUCKDB_RETIRED_PLATFORMS;
pub use release_profile::validate_release_profile;
pub use release_profile::ReleaseProfileCheck;
pub use semver::validate_extension_version;
pub use semver::validate_semver;
pub use spdx::validate_spdx_license;

Modules§

description_yml
Validation of DuckDB community extension description.yml files.
extension_name
Extension name validation per DuckDB community extension rules.
function_name
SQL function name validation for DuckDB extensions.
platform
DuckDB build platform validation.
release_profile
Release profile validation for DuckDB loadable extensions.
semver
Semantic versioning validation for DuckDB community extensions.
spdx
SPDX license identifier validation for DuckDB community extensions.

Functions§

validate_excluded_platforms_str
Validates the excluded_platforms field from description.yml as a semicolon-separated string.