Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-fastjsonschema for 
openSUSE:Factory checked in at 2023-09-29 21:12:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-fastjsonschema (Old)
 and      /work/SRC/openSUSE:Factory/.python-fastjsonschema.new.28202 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-fastjsonschema"

Fri Sep 29 21:12:36 2023 rev:6 rq:1114016 version:2.18.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-fastjsonschema/python-fastjsonschema.changes  
    2023-05-30 22:01:27.242660790 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-fastjsonschema.new.28202/python-fastjsonschema.changes
   2023-09-29 21:12:47.812066641 +0200
@@ -1,0 +2,7 @@
+Tue Sep 26 19:04:36 UTC 2023 - Torsten Gruner <simmpho...@opensuse.org>
+
+- update to 1.18.0
+  * Improved error message for required props - only missing are reported
+  * Fixed support of boolean schema in if-then-else application 
+
+-------------------------------------------------------------------

Old:
----
  fastjsonschema-2.17.1.tar.gz

New:
----
  fastjsonschema-2.18.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-fastjsonschema.spec ++++++
--- /var/tmp/diff_new_pack.DtSwLz/_old  2023-09-29 21:12:48.856104310 +0200
+++ /var/tmp/diff_new_pack.DtSwLz/_new  2023-09-29 21:12:48.860104454 +0200
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-fastjsonschema
-Version:        2.17.1
+Version:        2.18.0
 Release:        0
 Summary:        Fastest Python implementation of JSON schema
 License:        BSD-3-Clause

++++++ fastjsonschema-2.17.1.tar.gz -> fastjsonschema-2.18.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fastjsonschema-2.17.1/PKG-INFO 
new/fastjsonschema-2.18.0/PKG-INFO
--- old/fastjsonschema-2.17.1/PKG-INFO  2023-05-22 07:51:26.000000000 +0200
+++ new/fastjsonschema-2.18.0/PKG-INFO  2023-07-22 20:29:49.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: fastjsonschema
-Version: 2.17.1
+Version: 2.18.0
 Summary: Fastest Python implementation of JSON schema
 Home-page: https://github.com/horejsek/python-fastjsonschema
 Author: Michal Horejsek
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fastjsonschema-2.17.1/fastjsonschema/draft04.py 
new/fastjsonschema-2.18.0/fastjsonschema/draft04.py
--- old/fastjsonschema-2.17.1/fastjsonschema/draft04.py 2023-05-21 
08:08:16.000000000 +0200
+++ new/fastjsonschema-2.18.0/fastjsonschema/draft04.py 2023-07-22 
20:26:11.000000000 +0200
@@ -457,9 +457,10 @@
         with self.l('if {variable}_is_dict:'):
             if not isinstance(self._definition['required'], (list, tuple)):
                 raise JsonSchemaDefinitionException('required must be an 
array')
-            self.create_variable_with_length()
-            with self.l('if not all(prop in {variable} for prop in 
{required}):'):
-                self.exc('{name} must contain {} properties', 
self.e(self._definition['required']), rule='required')
+            self.l('{variable}__missing_keys = set({required}) - 
{variable}.keys()')
+            with self.l('if {variable}__missing_keys:'):
+                dynamic = 'str(sorted({variable}__missing_keys)) + " 
properties"'
+                self.exc('{name} must contain ', 
self.e(self._definition['required']), rule='required', append_to_msg=dynamic)
 
     def generate_properties(self):
         """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fastjsonschema-2.17.1/fastjsonschema/draft06.py 
new/fastjsonschema-2.18.0/fastjsonschema/draft06.py
--- old/fastjsonschema-2.17.1/fastjsonschema/draft06.py 2023-05-21 
08:08:16.000000000 +0200
+++ new/fastjsonschema-2.18.0/fastjsonschema/draft06.py 2023-07-22 
20:21:18.000000000 +0200
@@ -40,6 +40,8 @@
         Means that schema can be specified by boolean.
         True means everything is valid, False everything is invalid.
         """
+        if self._definition is True:
+            self.l('pass')
         if self._definition is False:
             self.exc('{name} must not be there')
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fastjsonschema-2.17.1/fastjsonschema/generator.py 
new/fastjsonschema-2.18.0/fastjsonschema/generator.py
--- old/fastjsonschema-2.17.1/fastjsonschema/generator.py       2023-05-21 
08:08:16.000000000 +0200
+++ new/fastjsonschema-2.18.0/fastjsonschema/generator.py       2023-07-22 
19:37:40.000000000 +0200
@@ -242,7 +242,7 @@
                 name = name + '".format(**locals()) + "'
 
         context = dict(
-            self._definition or {},
+            self._definition if self._definition and self._definition is not 
True else {},
             variable=self._variable,
             name=name,
             **kwds
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fastjsonschema-2.17.1/fastjsonschema/version.py 
new/fastjsonschema-2.18.0/fastjsonschema/version.py
--- old/fastjsonschema-2.17.1/fastjsonschema/version.py 2023-05-22 
07:49:47.000000000 +0200
+++ new/fastjsonschema-2.18.0/fastjsonschema/version.py 2023-07-22 
20:29:00.000000000 +0200
@@ -1 +1 @@
-VERSION = '2.17.1'
+VERSION = '2.18.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/fastjsonschema-2.17.1/fastjsonschema.egg-info/PKG-INFO 
new/fastjsonschema-2.18.0/fastjsonschema.egg-info/PKG-INFO
--- old/fastjsonschema-2.17.1/fastjsonschema.egg-info/PKG-INFO  2023-05-22 
07:51:26.000000000 +0200
+++ new/fastjsonschema-2.18.0/fastjsonschema.egg-info/PKG-INFO  2023-07-22 
20:29:48.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: fastjsonschema
-Version: 2.17.1
+Version: 2.18.0
 Summary: Fastest Python implementation of JSON schema
 Home-page: https://github.com/horejsek/python-fastjsonschema
 Author: Michal Horejsek
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/fastjsonschema-2.17.1/fastjsonschema.egg-info/SOURCES.txt 
new/fastjsonschema-2.18.0/fastjsonschema.egg-info/SOURCES.txt
--- old/fastjsonschema-2.17.1/fastjsonschema.egg-info/SOURCES.txt       
2023-05-22 07:51:26.000000000 +0200
+++ new/fastjsonschema-2.18.0/fastjsonschema.egg-info/SOURCES.txt       
2023-07-22 20:29:48.000000000 +0200
@@ -20,6 +20,7 @@
 tests/conftest.py
 tests/test_array.py
 tests/test_boolean.py
+tests/test_boolean_schema.py
 tests/test_common.py
 tests/test_compile_to_code.py
 tests/test_composition.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fastjsonschema-2.17.1/tests/test_boolean_schema.py 
new/fastjsonschema-2.18.0/tests/test_boolean_schema.py
--- old/fastjsonschema-2.17.1/tests/test_boolean_schema.py      1970-01-01 
01:00:00.000000000 +0100
+++ new/fastjsonschema-2.18.0/tests/test_boolean_schema.py      2023-07-22 
20:24:36.000000000 +0200
@@ -0,0 +1,73 @@
+import pytest
+
+from fastjsonschema import JsonSchemaValueException
+
+
+BASE_SCHEMA = {
+    '$schema': 'http://json-schema.org/draft-07/schema',
+    "if": {
+        "const": 1
+    },
+}
+
+
+@pytest.mark.parametrize('value, expected', [
+    (1, 1),
+    (2, 2),
+])
+def test_boolean_schema_true_in_then(asserter, value, expected):
+    asserter({
+        **BASE_SCHEMA,
+        'then': True,
+        'else': {
+            'type': 'number'
+        },
+    }, value, expected)
+
+
+@pytest.mark.parametrize('value, expected', [
+    (1, JsonSchemaValueException(
+        'data must not be there', value=1, name='data',
+        definition=False, rule=None
+    )),
+    (2, 2),
+])
+def test_boolean_schema_false_in_then(asserter, value, expected):
+    asserter({
+        **BASE_SCHEMA,
+        'then': False,
+        'else': {
+            'type': 'number'
+        },
+    }, value, expected)
+
+
+@pytest.mark.parametrize('value, expected', [
+    (1, 1),
+    (2, 2),
+])
+def test_boolean_schema_true_in_else(asserter, value, expected):
+    asserter({
+        **BASE_SCHEMA,
+        'then': {
+            'type': 'number',
+        },
+        'else': True,
+    }, value, expected)
+
+
+@pytest.mark.parametrize('value, expected', [
+    (1, 1),
+    (2, JsonSchemaValueException(
+        'data must not be there', value=2, name='data',
+        definition=False, rule=None
+    )),
+])
+def test_boolean_schema_false_in_else(asserter, value, expected):
+    asserter({
+        **BASE_SCHEMA,
+        'then': {
+            'type': 'number',
+        },
+        'else': False,
+    }, value, expected)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fastjsonschema-2.17.1/tests/test_integration.py 
new/fastjsonschema-2.18.0/tests/test_integration.py
--- old/fastjsonschema-2.17.1/tests/test_integration.py 2022-07-17 
09:30:32.000000000 +0200
+++ new/fastjsonschema-2.18.0/tests/test_integration.py 2023-07-22 
20:26:11.000000000 +0200
@@ -85,8 +85,12 @@
         JsonSchemaValueException('data[2][1] must be string', value=2, 
name='data[2][1]', definition={'type': 'string'}, rule='type'),
     ),
     (
+        [9, 'hello', [1], {'q': 'q', 'x': 'x', 'y': 'y'}, 'str', 5],
+        JsonSchemaValueException('data[3] must contain [\'a\', \'b\'] 
properties', value={'q': 'q', 'x': 'x', 'y': 'y'}, name='data[3]', 
definition=definition['items'][3], rule='required'),
+    ),
+    (
         [9, 'hello', [1], {'a': 'a', 'x': 'x', 'y': 'y'}, 'str', 5],
-        JsonSchemaValueException('data[3] must contain [\'a\', \'b\'] 
properties', value={'a': 'a', 'x': 'x', 'y': 'y'}, name='data[3]', 
definition=definition['items'][3], rule='required'),
+        JsonSchemaValueException('data[3] must contain [\'b\'] properties', 
value={'a': 'a', 'x': 'x', 'y': 'y'}, name='data[3]', 
definition=definition['items'][3], rule='required'),
     ),
     (
         [9, 'hello', [1], {}, 'str', 5],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fastjsonschema-2.17.1/tests/test_object.py 
new/fastjsonschema-2.18.0/tests/test_object.py
--- old/fastjsonschema-2.17.1/tests/test_object.py      2022-02-26 
10:43:31.000000000 +0100
+++ new/fastjsonschema-2.18.0/tests/test_object.py      2023-07-22 
20:26:11.000000000 +0200
@@ -43,10 +43,11 @@
     }, value, expected)
 
 
-exc = JsonSchemaValueException('data must contain [\'a\', \'b\'] properties', 
value='{data}', name='data', definition='{definition}', rule='required')
+def make_exc(missing):
+    return JsonSchemaValueException('data must contain {} 
properties'.format(missing), value='{data}', name='data', 
definition='{definition}', rule='required')
 @pytest.mark.parametrize('value, expected', [
-    ({}, exc),
-    ({'a': 1}, exc),
+    ({}, make_exc(['a', 'b'])),
+    ({'a': 1}, make_exc(['b'])),
     ({'a': 1, 'b': 2}, {'a': 1, 'b': 2}),
 ])
 def test_required(asserter, value, expected):

Reply via email to