@@ -2,6 +2,7 @@ use std::{path::PathBuf, str::FromStr};
22#[ macro_use] extern crate log;
33use anyhow:: { anyhow, Context , Result } ;
44use clap:: { CommandFactory , Parser , Subcommand } ;
5+ use heck:: ToUpperCamelCase ;
56use k8s_openapi:: apiextensions_apiserver:: pkg:: apis:: apiextensions:: v1:: {
67 CustomResourceDefinition , CustomResourceDefinitionVersion ,
78} ;
@@ -281,7 +282,7 @@ impl Kopium {
281282 . is_some_and ( |c| c. contains_key ( "status" ) ) )
282283 && self . has_status_resource ( & structs)
283284 {
284- println ! ( r#"#[kube(status = "{}Status")]"# , kind) ;
285+ println ! ( r#"#[kube(status = "{}Status")]"# , kind. to_upper_camel_case ( ) ) ;
285286 }
286287 if self . schema != "derived" {
287288 println ! ( r#"#[kube(schema = "{}")]"# , self . schema) ;
@@ -306,7 +307,10 @@ impl Kopium {
306307 }
307308 } else {
308309 self . print_derives ( s, & structs) ;
309- let spec_trimmed_name = s. name . as_str ( ) . replace ( & format ! ( "{}Spec" , kind) , kind) ;
310+ let spec_trimmed_name = s
311+ . name
312+ . as_str ( )
313+ . replace ( & format ! ( "{}Spec" , kind. to_upper_camel_case( ) ) , kind) ;
310314 if s. is_enum {
311315 println ! ( "pub enum {} {{" , spec_trimmed_name) ;
312316 } else {
@@ -322,7 +326,10 @@ impl Kopium {
322326 for annot in & m. extra_annot {
323327 println ! ( " {}" , annot) ;
324328 }
325- let spec_trimmed_type = m. type_ . as_str ( ) . replace ( & format ! ( "{}Spec" , kind) , kind) ;
329+ let spec_trimmed_type = m
330+ . type_
331+ . as_str ( )
332+ . replace ( & format ! ( "{}Spec" , kind. to_upper_camel_case( ) ) , kind) ;
326333 if s. is_enum {
327334 // NB: only supporting plain enumerations atm, not oneOf
328335 println ! ( " {}," , name) ;
0 commit comments