Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-advanced-user-tools
Commits
460700e0
Commit
460700e0
authored
1 year ago
by
Timm Fitschen
Committed by
Florian Spreckelsen
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
AUDIT: Apply more suggestions from Review
parent
330808fa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!73
MAINT: change wording of TableImporter argument and allow converters and...
,
!72
Extend json-schema model parser
Pipeline
#37103
passed
1 year ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosadvancedtools/models/parser.py
+4
-5
4 additions, 5 deletions
src/caosadvancedtools/models/parser.py
with
4 additions
and
5 deletions
src/caosadvancedtools/models/parser.py
+
4
−
5
View file @
460700e0
...
...
@@ -618,14 +618,13 @@ class Parser(object):
class
JsonSchemaParser
(
Parser
):
"""
Extends the yaml parser to read in datamodels defined in a json schema.
**EXPERIMENTAL:** While this c
a
lss can already be used to create data models
**EXPERIMENTAL:** While this cl
a
ss 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
...
...
@@ -689,7 +688,7 @@ class JsonSchemaParser(Parser):
our : DataModel
The datamodel defined in `model_dict`
"""
# @review Timm Fitschen 202
2
-0
2-30
# @review Timm Fitschen 202
3
-0
5-25
if
isinstance
(
model_dict
,
dict
):
model_dict
=
[
model_dict
]
...
...
@@ -761,7 +760,7 @@ class JsonSchemaParser(Parser):
raise
JsonSchemaDefinitionError
(
f
"
Unkown atomic type in
{
elt
}
.
"
)
def
_treat_element
(
self
,
elt
:
dict
,
name
:
str
):
# @review Timm Fitschen 202
2
-0
2-30
# @review Timm Fitschen 202
3
-0
5-25
force_list
=
False
if
name
in
self
.
model
:
return
self
.
model
[
name
],
force_list
...
...
@@ -805,7 +804,7 @@ class JsonSchemaParser(Parser):
return
ent
,
force_list
def
_treat_record_type
(
self
,
elt
:
dict
,
name
:
str
):
# @review Timm Fitschen 202
2
-0
2-30
# @review Timm Fitschen 202
3
-0
5-25
rt
=
db
.
RecordType
(
name
=
name
)
if
"
required
"
in
elt
:
required
=
elt
[
"
required
"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment