Skip to content
Snippets Groups Projects
Commit 32e8bb22 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

DOC: Document limitations

parent 66749a65
Branches
Tags
2 merge requests!39Release 0.4.0,!33F json schema datamodel
Pipeline #21055 passed with warnings
This commit is part of merge request !33. Comments created here will be created in the context of that merge request.
...@@ -11,8 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -11,8 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- CFood that creates a Record for each line in a csv file - CFood that creates a Record for each line in a csv file
- `generic_analysis.py` allows to easily call scripts to perform analyses in - `generic_analysis.py` allows to easily call scripts to perform analyses in
server side scripting [EXPERIMENTAL] server side scripting [EXPERIMENTAL]
- Models parser can import from Json Schema files now: - **EXPERIMENTAL:** Models parser can import from Json Schema files now:
`models.parser.parse_model_from_json_schema(...)` `models.parser.parse_model_from_json_schema(...)`. See the documentation of
`models.parser.JsonSchemaParser` for the limitations of the current
implementation.
- New keyword "role" in yaml data model that allows creation of Records and Files. - New keyword "role" in yaml data model that allows creation of Records and Files.
- It is now possible to set values of properties and default values of properties - It is now possible to set values of properties and default values of properties
directly in the yaml model. directly in the yaml model.
......
...@@ -151,7 +151,25 @@ def parse_model_from_string(string): ...@@ -151,7 +151,25 @@ def parse_model_from_string(string):
def parse_model_from_json_schema(filename: str): def parse_model_from_json_schema(filename: str):
"""Return a datamodel parsed from a json schema definition.""" """Return a datamodel parsed from a json schema definition.
Parameters
----------
filename : str
The path of the json schema file that is to be parsed
Returns
-------
out : Datamodel
The datamodel generated from the input schema which then can be used for
synchronizing with CaosDB.
Note
----
This is an experimental feature, see ``JsonSchemaParser`` for information
about the limitations of the current implementation.
"""
# @author Florian Spreckelsen # @author Florian Spreckelsen
# @date 2022-02-17 # @date 2022-02-17
# @review Daniel Hornung 2022-02-18 # @review Daniel Hornung 2022-02-18
...@@ -566,7 +584,27 @@ class Parser(object): ...@@ -566,7 +584,27 @@ class Parser(object):
class JsonSchemaParser(Parser): class JsonSchemaParser(Parser):
"""Extends the yaml parser to read in datamodels defined in a json schema.""" """Extends the yaml parser to read in datamodels defined in a json schema.
**EXPERIMENTAL:** While this calss can already be used to create data models
from basic json schemas, there are the following limitations and missing
features:
* Due to limitations of json-schema itself, we currently do not support
inheritance in the imported data models
* The same goes for suggested properties of RecordTypes
* Currently, ``$defs`` and ``$ref`` in the input schema are not resolved.
* Already defined RecordTypes and (scalar) Properties can't be re-used as
list properties
* Reference properties that are different from the referenced RT. (Although
this is possible for list of references)
* Values
* Roles
* The extern keyword from the yaml parser
* Currently, a json-schema cannot be transformed into a data model if its
root element isn't a RecordType (or Property) with ``title`` and ``type``.
"""
# @author Florian Spreckelsen # @author Florian Spreckelsen
# @date 2022-02-17 # @date 2022-02-17
# @review Timm Fitschen 2022-02-30 # @review Timm Fitschen 2022-02-30
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment