diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d6066030f5e22234c82fb5bfaefa9bae004a8a8e..80f38616e1abbe4e560d9bbfbd2542d02bfe5007 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -139,7 +139,7 @@ unittest_py37: stage: unittest image: python:3.7 script: &python_test_script - - pip install nose pandas pytest pytest-cov gitignore-parser openpyxl>=3.0.7 xlrd==1.2 h5py jsonref + - pip install nose pandas pytest pytest-cov gitignore-parser openpyxl>=3.0.7 xlrd==1.2 h5py - pip install git+https://gitlab.indiscale.com/caosdb/src/caosdb-pylib.git@dev - pip install . - pytest --cov=caosadvancedtools unittests diff --git a/setup.py b/setup.py index eed060aaf515260a03c1cbde6d205a8fa06ae395..4f4d8943fa16b842dfe3d25f3d83bc76b64e42b8 100755 --- a/setup.py +++ b/setup.py @@ -156,6 +156,7 @@ def setup_package(): author_email='h.tomwoerden@indiscale.com', python_requires='>=3.7', install_requires=["caosdb>=0.11.0", + "jsonref", "jsonschema>=4.4.0", "numpy>=1.17.3", "openpyxl>=3.0.7", @@ -164,7 +165,6 @@ def setup_package(): ], extras_require={"h5-crawler": ["h5py>=3.3.0", ], "gitignore-parser": ["gitignore-parser >=0.1.0", ], - "jsonref": ["jsonref", ], }, packages=find_packages('src'), package_dir={'': 'src'}, diff --git a/src/caosadvancedtools/models/parser.py b/src/caosadvancedtools/models/parser.py index abf47d03c056714a66295aefefc3800f1d3dfd7a..a0da3b24cadced579dc9b124f8ef30c86e880f4f 100644 --- a/src/caosadvancedtools/models/parser.py +++ b/src/caosadvancedtools/models/parser.py @@ -747,6 +747,11 @@ class JsonSchemaParser(Parser): "be identified with CaosDB's name property." ) return None, force_list + # LinkAhead suports null for all types, so in the very special case of + # `"type": ["null", "<other_type>"]`, only consider the other type: + if isinstance(elt["type"], list) and len(elt["type"]) == 2 and "null" in elt["type"]: + elt["type"].remove("null") + elt["type"] = elt["type"][0] if "enum" in elt: ent = self._treat_enum(elt, name) elif elt["type"] in JSON_SCHEMA_ATOMIC_TYPES: diff --git a/tox.ini b/tox.ini index ce18fc00b3eac352ac3b5c4fdd4d580961f7b6ee..0e9664c377366923b60e11d138825e1543cc8c7f 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,6 @@ deps=nose openpyxl >= 3.0.7 xlrd == 1.2 h5py - jsonref commands=py.test --cov=caosadvancedtools -vv {posargs} [flake8]