influxdb3-plugin-schemas
Schema types for InfluxDB 3 plugin manifests and registry indexes.
This crate is consumed by:
influxdb3-plugin-sdk— author-side packaginginfluxdb3-plugin-cli— theinfluxdb3-pluginbinary- the InfluxDB 3 Processing Engine runtime — for install-time manifest parsing
Overview
The crate exposes the core types plus their supporting newtypes:
Manifest— parsedmanifest.tomlwithPluginMetadataandDependenciesIndex/IndexEntry— parsedindex.jsonwith canonical serialization and required per-versionPublishedAtpublication timestampsPluginId— the(source, name, version)identity tupleplugin_format— the pure plugin-directory validation contract: the diagnostic type (ValidationError), the entry-point classification rule (classify_entry_point), the trigger-binding rule (check_trigger_bindings), the extraction rules (TopLevelFunctionDef), the success payload (ValidatedPluginDefinition/EntryPoint), and the executableTOP_LEVEL_DEF_CONFORMANCE_CASESthat any extractor must satisfy. This module has no filesystem ortree-sitterdependency; the SDK supplies the mechanism that feeds these checks.
Manifest::parse_toml and Index::parse_json perform two-phase parsing:
syntax/required-field decoding first, then field-level validation with
multi-error collection. Structural syntax failures still come back as a
single root-level SchemaError::TomlParse / SchemaError::JsonParse, but
field-level defects in one document are returned together as
SchemaErrors.
Parsing And Errors
Manifest::parse_tomlreturnsResult<Manifest, SchemaErrors>.Index::parse_jsonreturnsResult<Index, SchemaErrors>.- Each
SchemaErrorscontains one or moreReportedErrorvalues, each with:path: the field path where the error was detectederror: the underlyingSchemaErrorvariant
Direct callers that previously matched a single SchemaError should now
iterate the collection:
use ;
match parse_toml
Stability
Per the plugin SDK design, this crate targets a semver-stable public API.
Schema formats evolve independently via manifest_schema_version and
index_schema_version fields; this crate exposes those version types as
first-class.
The crate is licensed MIT OR Apache-2.0. The stability commitment
applies to the types defined here and is anchored at first crates.io
publish.
Spec Coverage
Tracks alignment between this crate's parsing/validation behavior and the internal plugin version management specification. Updated when a deliberate decision lands or a deviation is reconciled.
plugin.name rule (1–64 characters)
- Approved rule:
[a-zA-Z][a-zA-Z0-9_-]*(1-64 ASCII characters, starting with an ASCII letter; Windows reserved device names are rejected case-insensitively) — aligned with Cargo'svalidate_create_ident. - Code: enforced by
PluginName::validateinsrc/identity.rs. - Tests:
plugin_name_length_boundariesinidentity.rspins the empty / 1 / 64 / 65-char edges;reserved_names_rejectedcovers the Windows-device-name set. - Remaining gaps: none.
Index-entry validation alignment
- Approved rule: index entries follow the same field-level rules as
manifest entries for
triggers(closed set, non-empty), optional URL schemes (http/httpsonly), anddependencies.database_version(SemVer range). Documented in core design doc's "Index-entry validation mirrors manifest validation" subsection. - Code:
Index::validate()extended to enforce non-empty triggers and URL-scheme allowlist on every entry. Existing duplicate(name, version)check unchanged. - Tests: new inline tests in
src/index.rsfor empty triggers, invalid URL schemes, and unknown top-level field tolerance. New invalid fixtures undertests/fixtures/invalid/. - Remaining gaps: none.
Published plugin-version timestamps
- Approved rule: every published plugin-version index entry carries a
required
published_atvalue matching Cargo registry-indexpubtime:YYYY-MM-DDTHH:MM:SSZin UTC, with no offsets or fractional seconds. - Code:
PublishedAtvalidates and serializes the timestamp, andIndexEntryexposes it directly.Index::parse_jsonreports missing, non-string, or malformed values atplugins[N].published_at. - Tests: inline tests in
src/index.rs, fixture coverage undertests/fixtures/, and query tests that ensure search and info results expose the selected version's publication timestamp. - Remaining gaps: none.
Error policy for invalid parsed fields
- Approved policy: the parser entry points preserve dedicated
SchemaErrorvariants where defined (InvalidPluginName,InvalidVersion,InvalidDatabaseVersion,InvalidPythonRequirement,InvalidUrl,InvalidUrlScheme,InvalidHash, etc.) and attach field paths viaReportedError. - Boundary: syntax-level and required-field decode failures still
surface as root-level
SchemaError::TomlParse/JsonParse. - Remaining gaps: callers that bypass
parse_toml/parse_jsonand deserialize public schema types directly through serde still inherit serde's wrapper-style error model rather than field-path-awareReportedErrors.
SemVer precedence in canonical ordering
- Approved rule:
Index::to_canonical_jsonsorts by name ascending then version ascending per SemVer 2.0.0 precedence (prereleases sort before the corresponding release at same major.minor.patch; build metadata is ignored). - Code:
to_canonical_jsonnow usesVersion::cmp_precedence. The earlierVersion::cmpwould have produced lexical ordering of build metadata, violating Spec 1's "per SemVer 2.0.0 precedence" wording. This bug was latent (no current entries carry build metadata) and was caught by the new test below. - Tests: inline tests in
src/index.rsfor prerelease ordering and build-metadata equivalence (the latter asserts bothcmp_precedencereturnsEqualandcmpdoes NOT — the second assertion documents why the impl had to becmp_precedence). - Remaining gaps: none.