File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
tests/KubernetesClient.Tests Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ private static TBuilder WithOverridesFromJsonPropertyAttributes<TBuilder>(this T
225
225
continue ;
226
226
}
227
227
228
- var yamlAttribute = new YamlMemberAttribute { Alias = jsonAttribute . PropertyName } ;
228
+ var yamlAttribute = new YamlMemberAttribute { Alias = jsonAttribute . PropertyName , ApplyNamingConventions = false } ;
229
229
builder . WithAttributeOverride ( type , property . Name , yamlAttribute ) ;
230
230
}
231
231
}
Original file line number Diff line number Diff line change @@ -559,5 +559,40 @@ public void LoadSecret()
559
559
Assert . Equal ( "bXktYXBw" , Encoding . UTF8 . GetString ( result . Data [ "username" ] ) ) ;
560
560
Assert . Equal ( "Mzk1MjgkdmRnN0pi" , Encoding . UTF8 . GetString ( result . Data [ "password" ] ) ) ;
561
561
}
562
+
563
+ [ Fact ]
564
+ public void DeserializeWithJsonPropertyName ( )
565
+ {
566
+ var kManifest = @"
567
+ apiVersion: apiextensions.k8s.io/v1
568
+ kind: CustomResourceDefinition
569
+ metadata:
570
+ name: test-crd
571
+ spec:
572
+ group: test.crd
573
+ names:
574
+ kind: Crd
575
+ listKind: CrdList
576
+ plural: crds
577
+ singular: crd
578
+ scope: Namespaced
579
+ versions:
580
+ - name: v1alpha1
581
+ schema:
582
+ openAPIV3Schema:
583
+ description: This is a test crd.
584
+ x-kubernetes-int-or-string: true
585
+ required:
586
+ - metadata
587
+ - spec
588
+ type: object
589
+ served: true
590
+ storage: true
591
+ " ;
592
+ var result = Yaml . LoadFromString < V1CustomResourceDefinition > ( kManifest ) ;
593
+ Assert . Single ( result ? . Spec ? . Versions ) ;
594
+ var ver = result . Spec . Versions [ 0 ] ;
595
+ Assert . Equal ( true , ver ? . Schema ? . OpenAPIV3Schema ? . XKubernetesIntOrString ) ;
596
+ }
562
597
}
563
598
}
You can’t perform that action at this time.
0 commit comments