pub enum ComponentDependency {
Version(String),
Package {
version: String,
registry: Option<String>,
package: Option<String>,
export: Option<String>,
inherit_configuration: Option<InheritConfiguration>,
},
Local {
path: PathBuf,
export: Option<String>,
inherit_configuration: Option<InheritConfiguration>,
},
HTTP {
url: String,
digest: String,
export: Option<String>,
inherit_configuration: Option<InheritConfiguration>,
},
AppComponent {
component: KebabId,
export: Option<String>,
inherit_configuration: Option<InheritConfiguration>,
},
}Expand description
Specifies how to satisfy an import dependency of the component. This may be one of:
- A semantic versioning constraint for the package version to use. Spin fetches the latest matching version of the package whose name matches the dependency name from the default registry.
Example: "my:dep/import" = ">= 0.1.0"
- A package from a registry.
Example: "my:dep/import" = { version = "0.1.0", registry = "registry.io", ...}
- A package from a filesystem path.
Example: "my:dependency" = { path = "path/to/component.wasm", export = "my-export" }
- A component in the application. The referenced component binary is composed: additional
configuration such as files, networking, storage, etc. are ignored. This is intended
primarily as a convenience for including dependencies in the manifest so that they
can be built using
spin build.
Example: "my:dependency" = { component = "my-dependency", export = "my-export" }
- A package from an HTTP URL.
Example: "my:import" = { url = "https://example.com/component.wasm", sha256 = "sha256:..." }
Learn more: https://spinframework.dev/v3/writing-apps#using-component-dependencies
Variants§
Version(String)
... = ">= 0.1.0"
Package
... = { version = "0.1.0", registry = "registry.io", ...}
Fields
version: StringA semantic versioning constraint for the package version to use. Required. Spin fetches the latest matching version from the specified registry, or from the default registry if no registry is specified.
Example: "my:dep/import" = { version = ">= 0.1.0" }
Learn more: https://spinframework.dev/writing-apps#dependencies-from-a-registry
registry: Option<String>The registry that hosts the package. If omitted, this defaults to your system default registry.
Example: "my:dep/import" = { registry = "registry.io", version = "0.1.0" }
Learn more: https://spinframework.dev/writing-apps#dependencies-from-a-registry
package: Option<String>The name of the package to use. If omitted, this defaults to the package name of the imported interface.
Example: "my:dep/import" = { package = "your:implementation", version = "0.1.0" }
Learn more: https://spinframework.dev/writing-apps#dependencies-from-a-registry
export: Option<String>The name of the export in the package. If omitted, this defaults to the name of the import.
Example: "my:dep/import" = { export = "your:impl/export", version = "0.1.0" }
Learn more: https://spinframework.dev/writing-apps#dependencies-from-a-registry
inherit_configuration: Option<InheritConfiguration>The set of configurations to inherit from the parent component. If omitted or set to false,
no configurations will be inherited. If true, all configurations will be inherited.
Selective inheritance can be specified by enumerating the configuration keys the dependency
would like to inherit.
Examples:
"my:dep/import" = { version = "0.1.0", inherit_configuration = true }
"my:dep/import" = { version = "0.1.0", inherit_configuration = ["ai_models", "allowed_outbound_hosts"] }
Local
... = { path = "path/to/component.wasm", export = "my-export" }
Fields
path: PathBufThe path to the Wasm file that implements the dependency.
Example: "my:dep/import" = { path = "path/to/component.wasm" }
Learn more: https://spinframework.dev/writing-apps#dependencies-from-a-local-component
export: Option<String>The name of the export in the package. If omitted, this defaults to the name of the import.
Example: "my:dep/import" = { export = "your:impl/export", path = "path/to/component.wasm" }
Learn more: https://spinframework.dev/writing-apps#dependencies-from-a-local-component
inherit_configuration: Option<InheritConfiguration>The set of configurations to inherit from the parent component. If omitted or set to false,
no configurations will be inherited. If true, all configurations will be inherited.
Selective inheritance can be specified by enumerating the configuration keys the dependency
would like to inherit.
Examples:
"my:dep/import" = { version = "0.1.0", inherit_configuration = true }
"my:dep/import" = { version = "0.1.0", inherit_configuration = ["ai_models", "allowed_outbound_hosts"] }
HTTP
... = { url = "https://example.com/component.wasm", sha256 = "..." }
Fields
url: StringThe URL to the Wasm component that implements the dependency.
Example: "my:dep/import" = { url = "https://example.com/component.wasm", sha256 = "sha256:..." }
Learn more: https://spinframework.dev/writing-apps#dependencies-from-a-url
digest: StringThe SHA256 digest of the Wasm file. This is required for integrity checking. Must begin with sha256:.
Example: "my:dep/import" = { sha256 = "sha256:...", ... }
Learn more: https://spinframework.dev/writing-apps#dependencies-from-a-url
export: Option<String>The name of the export in the package. If omitted, this defaults to the name of the import.
Example: "my:dep/import" = { export = "your:impl/export", ... }
Learn more: https://spinframework.dev/writing-apps#dependencies-from-a-url
inherit_configuration: Option<InheritConfiguration>The set of configurations to inherit from the parent component. If omitted or set to false,
no configurations will be inherited. If true, all configurations will be inherited.
Selective inheritance can be specified by enumerating the configuration keys the dependency
would like to inherit.
Examples:
"my:dep/import" = { version = "0.1.0", inherit_configuration = true }
"my:dep/import" = { version = "0.1.0", inherit_configuration = ["ai_models", "allowed_outbound_hosts"] }
AppComponent
... = { component = "my-dependency" }
Fields
component: KebabIdThe ID of the component which implements the dependency.
Example: "my:dep/import" = { component = "my-dependency" }
Learn more: https://spinframework.dev/writing-apps#using-component-dependencies
export: Option<String>The name of the export in the package. If omitted, this defaults to the name of the import.
Example: "my:dep/import" = { export = "your:impl/export", component = "my-dependency" }
Learn more: https://spinframework.dev/writing-apps#using-component-dependencies
inherit_configuration: Option<InheritConfiguration>The set of configurations to inherit from the parent component. If omitted or set to false,
no configurations will be inherited. If true, all configurations will be inherited.
Selective inheritance can be specified by enumerating the configuration keys the dependency
would like to inherit.
Examples:
"my:dep/import" = { version = "0.1.0", inherit_configuration = true }
"my:dep/import" = { version = "0.1.0", inherit_configuration = ["ai_models", "allowed_outbound_hosts"] }
Implementations§
Source§impl ComponentDependency
impl ComponentDependency
Sourcepub fn inherit_configuration(&self) -> Option<&InheritConfiguration>
pub fn inherit_configuration(&self) -> Option<&InheritConfiguration>
Returns the inherit_configuration field if present on this dependency variant.
Sourcepub fn set_inherit_configuration(&mut self, value: InheritConfiguration)
pub fn set_inherit_configuration(&mut self, value: InheritConfiguration)
Sets the inherit_configuration field on this dependency variant.
No-op for Version variants.
Trait Implementations§
Source§impl Clone for ComponentDependency
impl Clone for ComponentDependency
Source§fn clone(&self) -> ComponentDependency
fn clone(&self) -> ComponentDependency
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComponentDependency
impl Debug for ComponentDependency
Source§impl<'de> Deserialize<'de> for ComponentDependency
impl<'de> Deserialize<'de> for ComponentDependency
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ComponentDependency
impl JsonSchema for ComponentDependency
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more