@@ -223,15 +223,15 @@ def generate_not(self):
223
223
def generate_min_length (self ):
224
224
with self .l ('if isinstance({variable}, str):' ):
225
225
self .create_variable_with_length ()
226
- if not isinstance (self ._definition ['minLength' ], int ):
226
+ if not isinstance (self ._definition ['minLength' ], ( int , float ) ):
227
227
raise JsonSchemaDefinitionException ('minLength must be a number' )
228
228
with self .l ('if {variable}_len < {minLength}:' ):
229
229
self .exc ('{name} must be longer than or equal to {minLength} characters' , rule = 'minLength' )
230
230
231
231
def generate_max_length (self ):
232
232
with self .l ('if isinstance({variable}, str):' ):
233
233
self .create_variable_with_length ()
234
- if not isinstance (self ._definition ['maxLength' ], int ):
234
+ if not isinstance (self ._definition ['maxLength' ], ( int , float ) ):
235
235
raise JsonSchemaDefinitionException ('maxLength must be a number' )
236
236
with self .l ('if {variable}_len > {maxLength}:' ):
237
237
self .exc ('{name} must be shorter than or equal to {maxLength} characters' , rule = 'maxLength' )
@@ -328,7 +328,7 @@ def generate_multiple_of(self):
328
328
def generate_min_items (self ):
329
329
self .create_variable_is_list ()
330
330
with self .l ('if {variable}_is_list:' ):
331
- if not isinstance (self ._definition ['minItems' ], int ):
331
+ if not isinstance (self ._definition ['minItems' ], ( int , float ) ):
332
332
raise JsonSchemaDefinitionException ('minItems must be a number' )
333
333
self .create_variable_with_length ()
334
334
with self .l ('if {variable}_len < {minItems}:' ):
@@ -337,7 +337,7 @@ def generate_min_items(self):
337
337
def generate_max_items (self ):
338
338
self .create_variable_is_list ()
339
339
with self .l ('if {variable}_is_list:' ):
340
- if not isinstance (self ._definition ['maxItems' ], int ):
340
+ if not isinstance (self ._definition ['maxItems' ], ( int , float ) ):
341
341
raise JsonSchemaDefinitionException ('maxItems must be a number' )
342
342
self .create_variable_with_length ()
343
343
with self .l ('if {variable}_len > {maxItems}:' ):
@@ -443,7 +443,7 @@ def generate_items(self):
443
443
def generate_min_properties (self ):
444
444
self .create_variable_is_dict ()
445
445
with self .l ('if {variable}_is_dict:' ):
446
- if not isinstance (self ._definition ['minProperties' ], int ):
446
+ if not isinstance (self ._definition ['minProperties' ], ( int , float ) ):
447
447
raise JsonSchemaDefinitionException ('minProperties must be a number' )
448
448
self .create_variable_with_length ()
449
449
with self .l ('if {variable}_len < {minProperties}:' ):
@@ -452,7 +452,7 @@ def generate_min_properties(self):
452
452
def generate_max_properties (self ):
453
453
self .create_variable_is_dict ()
454
454
with self .l ('if {variable}_is_dict:' ):
455
- if not isinstance (self ._definition ['maxProperties' ], int ):
455
+ if not isinstance (self ._definition ['maxProperties' ], ( int , float ) ):
456
456
raise JsonSchemaDefinitionException ('maxProperties must be a number' )
457
457
self .create_variable_with_length ()
458
458
with self .l ('if {variable}_len > {maxProperties}:' ):
0 commit comments