Skip to content

Commit d8d845c

Browse files
authored
fix: optional attr min and max validation generation (#91)
Signed-off-by: peefy <[email protected]>
1 parent 9db7670 commit d8d845c

File tree

12 files changed

+6927
-26
lines changed

12 files changed

+6927
-26
lines changed

pkg/kube_resource/generator/testdata/additional_properties_pattern/models/sources_knative_dev_v1alpha1_git_hub_source.k

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ schema SourcesKnativeDevV1alpha1GitHubSourceSpecCeOverrides:
125125

126126

127127
check:
128-
all _, extensions in extensions {len(extensions) >= 1 }
128+
all _, extensions in extensions {len(extensions) >= 1 if extensions not in [None, Undefined] }
129129

130130

131131
schema SourcesKnativeDevV1alpha1GitHubSourceSpecSecretToken:
@@ -208,7 +208,7 @@ schema SourcesKnativeDevV1alpha1GitHubSourceSpecSinkRef:
208208
len(apiVersion) >= 1
209209
len(kind) >= 1
210210
len(name) >= 1
211-
len(namespace) >= 1
211+
len(namespace) >= 1 if namespace
212212

213213

214214
schema SourcesKnativeDevV1alpha1GitHubSourceStatus:

pkg/kube_resource/generator/testdata/all_of_pattern/models/karpenter_k8s_aws_v1beta1_e_c2_node_class.k

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpec:
9292

9393

9494
check:
95-
len(amiSelectorTerms) <= 30
96-
len(blockDeviceMappings) <= 50
95+
len(amiSelectorTerms) <= 30 if amiSelectorTerms
96+
len(blockDeviceMappings) <= 50 if blockDeviceMappings
9797
len(securityGroupSelectorTerms) <= 30
9898
len(subnetSelectorTerms) <= 30
9999

@@ -239,8 +239,8 @@ schema KarpenterK8sAwsV1beta1EC2NodeClassSpecMetadataOptions:
239239

240240

241241
check:
242-
httpPutResponseHopLimit <= 64
243-
httpPutResponseHopLimit >= 1
242+
httpPutResponseHopLimit <= 64 if httpPutResponseHopLimit not in [None, Undefined]
243+
httpPutResponseHopLimit >= 1 if httpPutResponseHopLimit not in [None, Undefined]
244244

245245

246246
schema KarpenterK8sAwsV1beta1EC2NodeClassSpecSecurityGroupSelectorTermsItems0:

pkg/kube_resource/generator/testdata/map_default_value/models/acid_zalan_do_v1_operator_configuration.k

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ schema AcidZalanDoV1OperatorConfigurationConfiguration:
184184

185185

186186
check:
187-
max_instances >= -1
188-
min_instances >= -1
189-
workers >= 1
187+
max_instances >= -1 if max_instances not in [None, Undefined]
188+
min_instances >= -1 if min_instances not in [None, Undefined]
189+
workers >= 1 if workers not in [None, Undefined]
190190

191191

192192
schema AcidZalanDoV1OperatorConfigurationConfigurationAwsOrGcp:
@@ -298,7 +298,7 @@ schema AcidZalanDoV1OperatorConfigurationConfigurationConnectionPooler:
298298
regex_match(str(connection_pooler_default_cpu_request), r"^(\d+m|\d+(\.\d{1,3})?)$") if connection_pooler_default_cpu_request
299299
regex_match(str(connection_pooler_default_memory_limit), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_limit
300300
regex_match(str(connection_pooler_default_memory_request), r"^(\d+(e\d+)?|\d+(\.\d+)?(e\d+)?[EPTGMK]i?)$") if connection_pooler_default_memory_request
301-
connection_pooler_number_of_instances >= 1
301+
connection_pooler_number_of_instances >= 1 if connection_pooler_number_of_instances not in [None, Undefined]
302302

303303

304304
schema AcidZalanDoV1OperatorConfigurationConfigurationDebug:

0 commit comments

Comments
 (0)