Skip to content
Merged
42 changes: 0 additions & 42 deletions crates/stackable-versioned-macros/src/codegen/container/struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,6 @@ impl Struct {
let k8s_openapi_path = &*kubernetes_options.crates.k8s_openapi;
let kube_core_path = &*kubernetes_options.crates.kube_core;

// TODO (@Techassi): Move the YAML printing code into 'stackable-versioned' so that we don't
// have any cross-dependencies and the macro can be used on it's own (K8s features of course
// still need kube and friends).
Some(quote! {
#automatically_derived
#vis enum #enum_ident {
Expand All @@ -374,45 +371,6 @@ impl Struct {
) -> ::std::result::Result<#k8s_openapi_path::apiextensions_apiserver::pkg::apis::apiextensions::v1::CustomResourceDefinition, #kube_core_path::crd::MergeError> {
#kube_core_path::crd::merge_crds(vec![#(#fn_calls),*], &stored_apiversion.to_string())
}

/// Generates and writes a merged CRD which contains all versions defined using the `#[versioned()]`
/// macro to a file located at `path`.
pub fn write_merged_crd<P>(path: P, stored_apiversion: Self, operator_version: &str) -> Result<(), ::stackable_versioned::Error>
where P: AsRef<::std::path::Path>
{
use ::stackable_shared::yaml::{YamlSchema, SerializeOptions};

let merged_crd = Self::merged_crd(stored_apiversion).map_err(|err| ::stackable_versioned::Error::MergeCrd {
source: err,
})?;

YamlSchema::write_yaml_schema(
&merged_crd,
path,
operator_version,
SerializeOptions::default()
).map_err(|err| ::stackable_versioned::Error::SerializeYaml {
source: err,
})
}

/// Generates and writes a merged CRD which contains all versions defined using the `#[versioned()]`
/// macro to stdout.
pub fn print_merged_crd(stored_apiversion: Self, operator_version: &str) -> Result<(), ::stackable_versioned::Error> {
use ::stackable_shared::yaml::{YamlSchema, SerializeOptions};

let merged_crd = Self::merged_crd(stored_apiversion).map_err(|err| ::stackable_versioned::Error::MergeCrd {
source: err,
})?;

YamlSchema::print_yaml_schema(
&merged_crd,
operator_version,
SerializeOptions::default()
).map_err(|err| ::stackable_versioned::Error::SerializeYaml {
source: err,
})
}
}
})
}
Expand Down
2 changes: 2 additions & 0 deletions crates/stackable-versioned/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.

### Removed

- BREAKING: Remove {write,print}_merged_crd functions ([#924]).
- BREAKING: Remove the `CustomResource` derive ([#914]).

### Changed
Expand All @@ -39,6 +40,7 @@ All notable changes to this project will be documented in this file.
[#920]: https://github.com/stackabletech/operator-rs/pull/920
[#922]: https://github.com/stackabletech/operator-rs/pull/922
[#923]: https://github.com/stackabletech/operator-rs/pull/923
[#924]: https://github.com/stackabletech/operator-rs/pull/924
[#925]: https://github.com/stackabletech/operator-rs/pull/925

## [0.4.1] - 2024-10-23
Expand Down
Loading