File tree 3 files changed +10
-5
lines changed
3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change
1
+ === 2.4 (unreleased)
2
+
3
+ * Fix overriding variables (in pattern properties, property names, unique items and contains)
4
+
5
+
1
6
=== 2.3 (2018-09-14) ===
2
7
3
8
* Fix regex of hostname
Original file line number Diff line number Diff line change @@ -292,7 +292,7 @@ def generate_unique_items(self):
292
292
2.1439831256866455
293
293
"""
294
294
self .create_variable_with_length ()
295
- with self .l ('if {variable}_len > len(set(str(x ) for x in {variable})):' ):
295
+ with self .l ('if {variable}_len > len(set(str({variable}_x ) for {variable}_x in {variable})):' ):
296
296
self .l ('raise JsonSchemaException("{name} must contain unique items")' )
297
297
298
298
def generate_items (self ):
Original file line number Diff line number Diff line change @@ -105,11 +105,11 @@ def generate_property_names(self):
105
105
self .create_variable_with_length ()
106
106
with self .l ('if {variable}_len != 0:' ):
107
107
self .l ('{variable}_property_names = True' )
108
- with self .l ('for key in {variable}:' ):
108
+ with self .l ('for {variable}_key in {variable}:' ):
109
109
with self .l ('try:' ):
110
110
self .generate_func_code_block (
111
111
property_names_definition ,
112
- 'key' ,
112
+ '{}_key' . format ( self . _variable ) ,
113
113
self ._variable_name ,
114
114
clear_variables = True ,
115
115
)
@@ -143,11 +143,11 @@ def generate_contains(self):
143
143
self .l ('raise JsonSchemaException("{name} must not be empty")' )
144
144
else :
145
145
self .l ('{variable}_contains = False' )
146
- with self .l ('for key in {variable}:' ):
146
+ with self .l ('for {variable}_key in {variable}:' ):
147
147
with self .l ('try:' ):
148
148
self .generate_func_code_block (
149
149
contains_definition ,
150
- 'key' ,
150
+ '{}_key' . format ( self . _variable ) ,
151
151
self ._variable_name ,
152
152
clear_variables = True ,
153
153
)
You can’t perform that action at this time.
0 commit comments