Skip to content

Commit

Permalink
[JsonGen] Fix restrict checking on r/w properties
Browse files Browse the repository at this point in the history
  • Loading branch information
sebaszm committed Aug 8, 2024
1 parent d5f4a29 commit 606d331
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions JsonGenerator/source/class_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,23 @@ def append(self, argument, relay=None, override=None, test_set=None):

name = relay.temp_name if not override else override

if isinstance(relay, JsonObject) and self.__json and test_set:
if IsObjectOptional(relay):
if self.__reverse:
self.__cond.append("((%s.IsSet() == false) || (%s.IsDataValid() == true))" % (name, name))
if isinstance(relay, JsonObject) and self.__json:
if test_set:
if IsObjectOptional(relay):
if self.__reverse:
self.__cond.append("((%s.IsSet() == false) || (%s.IsDataValid() == true))" % (name, name))
else:
self.__cond.append("((%s.IsSet() == true) && (%s.IsDataValid() == false))" % (name, name))
else:
self.__cond.append("((%s.IsSet() == true) && (%s.IsDataValid() == false))" % (name, name))
if self.__reverse:
self.__cond.append("((%s.IsSet() == true) && (%s.IsDataValid() == true))" % (name, name))
else:
self.__cond.append("((%s.IsSet() == false) || (%s.IsDataValid() == false))" % (name, name))
else:
if self.__reverse:
self.__cond.append("((%s.IsSet() == true) && (%s.IsDataValid() == true))" % (name, name))
self.__cond.append("(%s.IsDataValid() == true)" % name)
else:
self.__cond.append("((%s.IsSet() == false) || (%s.IsDataValid() == false))" % (name, name))
self.__cond.append("(%s.IsDataValid() == false)" % name)

elif IsObjectRestricted(argument):
tests = []
Expand Down

0 comments on commit 606d331

Please sign in to comment.