Skip to content

Breaking Change in Interface? #1018

@BrianMarre

Description

@BrianMarre

Thanks in advance for answering a stupid question,

In between version 4.15.0 and 4.16.0 the following code snippet broke

resolver = jsonschema.RefResolver(base_uri=RenderedObject._BASE_URI,
    referrer=uri,
    store=RenderedObject._schema_by_uri)

using the following arguments

base_uri = https://registry.hzdr.de/crp/picongpu/schema/
referrer = https://registry.hzdr.de/crp/picongpu/schema/picongpu.pypicongpu.species.operation.densityprofile.uniform.Uniform
store = (see attached file)

interesting section of store (as far as I can tell)

'https://registry.hzdr.de/crp/picongpu/schema/picongpu.pypicongpu.species.operation.densityprofile.uniform.Uniform': {
    '$id': 'https://registry.hzdr.de/crp/picongpu/schema/picongpu.pypicongpu.species.operation.densityprofile.uniform.Uniform',
    'type': 'object',
    'description': 'Describes a globally constant density.',
    'unevaluatedProperties': False,
    'required': ['density_si'],
    'properties': {
        'density_si': {
            'type': 'number',
            'description': 'density in kg * m^-3',
            'exclusiveMinimum': 0
        }
    }
}

with the following error message

ERROR: test_rendering_with_type (quick.pypicongpu.species.operation.densityprofile.densityprofile.TestDensityProfile)
object with added type information is returned & validated
----------------------------------------------------------------------
Traceback (most recent call last):
  File "~/picongpu/test/python/picongpu/quick/pypicongpu/species/operation/densityprofile/densityprofile.py", line 94, in test_rendering_with_type
    uniform.get_generic_profile_rendering_context()
  File "/opt/spack-modules/linux-ubuntu20.04-skylake_avx512/gcc-10.2.0/python-3.10.4-ez4r7hnfxopga5tpgir2fzxvek45oq7g/lib/python3.10/site-packages/typeguard/__init__.py", line 1033, in wrapper
    retval = func(*args, **kwargs)
  File "~/picongpu/lib/python/picongpu/pypicongpu/species/operation/densityprofile/densityprofile.py", line 93, in get_generic_profile_rendering_context
    serialized_data = self.get_rendering_context()
  File "/opt/spack-modules/linux-ubuntu20.04-skylake_avx512/gcc-10.2.0/python-3.10.4-ez4r7hnfxopga5tpgir2fzxvek45oq7g/lib/python3.10/site-packages/typeguard/__init__.py", line 1033, in wrapper
    retval = func(*args, **kwargs)
  File "~/picongpu/lib/python/picongpu/pypicongpu/rendering/renderedobject.py", line 189, in get_rendering_context
    RenderedObject.check_context_for_type(self.__class__, serialized)
  File "/opt/spack-modules/linux-ubuntu20.04-skylake_avx512/gcc-10.2.0/python-3.10.4-ez4r7hnfxopga5tpgir2fzxvek45oq7g/lib/python3.10/site-packages/typeguard/__init__.py", line 1033, in wrapper
    retval = func(*args, **kwargs)
  File "~/picongpu/lib/python/picongpu/pypicongpu/rendering/renderedobject.py", line 207, in check_context_for_type
    resolver = jsonschema.RefResolver(base_uri=RenderedObject._BASE_URI,
  File "/opt/spack-modules/linux-ubuntu20.04-skylake_avx512/gcc-10.2.0/python-3.10.4-ez4r7hnfxopga5tpgir2fzxvek45oq7g/lib/python3.10/site-packages/jsonschema/validators.py", line 736, in __init__
    self.store.update(
  File "/opt/spack-modules/linux-ubuntu20.04-skylake_avx512/gcc-10.2.0/python-3.10.4-ez4r7hnfxopga5tpgir2fzxvek45oq7g/lib/python3.10/_collections_abc.py", line 999, in update
    for key, value in other:
  File "/opt/spack-modules/linux-ubuntu20.04-skylake_avx512/gcc-10.2.0/python-3.10.4-ez4r7hnfxopga5tpgir2fzxvek45oq7g/lib/python3.10/site-packages/jsonschema/validators.py", line 738, in <genexpr>
    for schema in store.values() if "$id" in schema
TypeError: argument of type 'bool' is not iterable

I am not entirely sure whether this is caused by a bug or a breaking change I missed, but I did not see anything I could identify on a quick scan of the changelog.

Thankful for every pointer, even a RTFM if it specifies a location ;)

test.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions