#8 let xmd be None or dict
Merged 7 years ago by nphilipp. Opened 7 years ago by ttomecek.
ttomecek/modulemd validate-xmd-correctly  into  master

file modified
+4 -2
@@ -299,8 +299,10 @@ 

              raise TypeError("documentation must be a string")

          if not isinstance(self.tracker, str):

              raise TypeError("tracker must be a string")

-         if not isinstance(self.xmd, dict):

-             raise TypeError("xmd must be a dictionary")

+         if self.xmd is not None and not isinstance(self.xmd, dict):

+             raise TypeError(

+                 "xmd must be a dictionary or null, current value: {!r}".format(self.xmd)

+             )

          if not isinstance(self.profiles, dict):

              raise TypeError("profiles must be a dictionary")

          for p in self.profiles.keys():

spec says it can be None:
A dictionary of user-defined keys and values. May be null.

Signed-off-by: Tomas Tomecek ttomecek@redhat.com

Perhaps mention this in the error message, too?

rebased

7 years ago

@nphilipp fixed, thanks for feedback!

Pull-Request has been merged by nphilipp

7 years ago

no problem, this was done on flock modularity workshop

Metadata