@@ -151,7 +151,13 @@ impl VersionedField {
151151 version : & VersionDefinition ,
152152 next_version : & VersionDefinition ,
153153 from_struct_ident : & IdentString ,
154+ mod_gen_ctx : ModuleGenerationContext < ' _ > ,
154155 ) -> Option < TokenStream > {
156+ let experimental_conversion_tracking = mod_gen_ctx
157+ . kubernetes_options
158+ . experimental_conversion_tracking
159+ . is_present ( ) ;
160+
155161 match & self . changes {
156162 Some ( changes) => {
157163 let next_change = changes. get_expect ( & next_version. inner ) ;
@@ -190,10 +196,12 @@ impl VersionedField {
190196 } ) ,
191197 // Default .into() call using From impls.
192198 None => {
193- let json_path_ident =
194- format_ident ! ( "__sv_{ident}_path" , ident = to_ident. as_ident( ) ) ;
199+ if self . nested && experimental_conversion_tracking {
200+ let json_path_ident = format_ident ! (
201+ "__sv_{ident}_path" ,
202+ ident = to_ident. as_ident( )
203+ ) ;
195204
196- if self . nested {
197205 Some ( quote ! {
198206 #to_ident: #from_struct_ident. #from_ident. tracking_into( status, #json_path_ident) ,
199207 } )
@@ -209,12 +217,12 @@ impl VersionedField {
209217 #from_ident: #downgrade_fn( #from_struct_ident. #to_ident) ,
210218 } ) ,
211219 None => {
212- let json_path_ident = format_ident ! (
213- "__sv_{ident}_path" ,
214- ident = from_ident. as_ident( )
215- ) ;
220+ if self . nested && experimental_conversion_tracking {
221+ let json_path_ident = format_ident ! (
222+ "__sv_{ident}_path" ,
223+ ident = from_ident. as_ident( )
224+ ) ;
216225
217- if self . nested {
218226 Some ( quote ! {
219227 #from_ident: #from_struct_ident. #to_ident. tracking_into( status, #json_path_ident) ,
220228 } )
@@ -235,12 +243,12 @@ impl VersionedField {
235243 // in some edge cases.
236244 match direction {
237245 Direction :: Upgrade => {
238- let json_path_ident = format_ident ! (
239- "__sv_{ident}_path" ,
240- ident = next_field_ident. as_ident( )
241- ) ;
246+ if self . nested && experimental_conversion_tracking {
247+ let json_path_ident = format_ident ! (
248+ "__sv_{ident}_path" ,
249+ ident = next_field_ident. as_ident( )
250+ ) ;
242251
243- if self . nested {
244252 Some ( quote ! {
245253 #next_field_ident: #from_struct_ident. #old_field_ident. tracking_into( status, #json_path_ident) ,
246254 } )
@@ -259,10 +267,11 @@ impl VersionedField {
259267 }
260268 None => {
261269 let field_ident = & * self . ident ;
262- let json_path_ident =
263- format_ident ! ( "__sv_{ident}_path" , ident = field_ident. as_ident( ) ) ;
264270
265- if self . nested {
271+ if self . nested && experimental_conversion_tracking {
272+ let json_path_ident =
273+ format_ident ! ( "__sv_{ident}_path" , ident = field_ident. as_ident( ) ) ;
274+
266275 Some ( quote ! {
267276 #field_ident: #from_struct_ident. #field_ident. tracking_into( status, & #json_path_ident) ,
268277 } )
0 commit comments