@@ -151,7 +151,13 @@ impl VersionedField {
151
151
version : & VersionDefinition ,
152
152
next_version : & VersionDefinition ,
153
153
from_struct_ident : & IdentString ,
154
+ mod_gen_ctx : ModuleGenerationContext < ' _ > ,
154
155
) -> Option < TokenStream > {
156
+ let experimental_conversion_tracking = mod_gen_ctx
157
+ . kubernetes_options
158
+ . experimental_conversion_tracking
159
+ . is_present ( ) ;
160
+
155
161
match & self . changes {
156
162
Some ( changes) => {
157
163
let next_change = changes. get_expect ( & next_version. inner ) ;
@@ -190,10 +196,12 @@ impl VersionedField {
190
196
} ) ,
191
197
// Default .into() call using From impls.
192
198
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
+ ) ;
195
204
196
- if self . nested {
197
205
Some ( quote ! {
198
206
#to_ident: #from_struct_ident. #from_ident. tracking_into( status, #json_path_ident) ,
199
207
} )
@@ -209,12 +217,12 @@ impl VersionedField {
209
217
#from_ident: #downgrade_fn( #from_struct_ident. #to_ident) ,
210
218
} ) ,
211
219
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
+ ) ;
216
225
217
- if self . nested {
218
226
Some ( quote ! {
219
227
#from_ident: #from_struct_ident. #to_ident. tracking_into( status, #json_path_ident) ,
220
228
} )
@@ -235,12 +243,12 @@ impl VersionedField {
235
243
// in some edge cases.
236
244
match direction {
237
245
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
+ ) ;
242
251
243
- if self . nested {
244
252
Some ( quote ! {
245
253
#next_field_ident: #from_struct_ident. #old_field_ident. tracking_into( status, #json_path_ident) ,
246
254
} )
@@ -259,10 +267,11 @@ impl VersionedField {
259
267
}
260
268
None => {
261
269
let field_ident = & * self . ident ;
262
- let json_path_ident =
263
- format_ident ! ( "__sv_{ident}_path" , ident = field_ident. as_ident( ) ) ;
264
270
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
+
266
275
Some ( quote ! {
267
276
#field_ident: #from_struct_ident. #field_ident. tracking_into( status, & #json_path_ident) ,
268
277
} )
0 commit comments