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
3bf6b29b
Commit
3bf6b29b
authored
3 years ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Add treatment of other atomic properties
parent
51e616a6
No related branches found
No related tags found
2 merge requests
!39
Release 0.4.0
,
!33
F json schema datamodel
Pipeline
#19448
failed
3 years ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosadvancedtools/models/parser.py
+11
-1
11 additions, 1 deletion
src/caosadvancedtools/models/parser.py
unittests/test_json_schema_model_parser.py
+1
-1
1 addition, 1 deletion
unittests/test_json_schema_model_parser.py
with
12 additions
and
2 deletions
src/caosadvancedtools/models/parser.py
+
11
−
1
View file @
3bf6b29b
...
@@ -521,7 +521,17 @@ class JsonSchemaParser(Parser):
...
@@ -521,7 +521,17 @@ class JsonSchemaParser(Parser):
if
name
in
self
.
model
:
if
name
in
self
.
model
:
return
ent
return
ent
if
elt
[
"
type
"
]
==
"
string
"
:
if
elt
[
"
type
"
]
==
"
string
"
:
ent
=
db
.
Property
(
name
=
name
,
datatype
=
db
.
TEXT
)
if
"
format
"
in
elt
and
elt
[
"
format
"
]
==
"
date-time
"
:
# Treat datetime strings separately
ent
=
db
.
Property
(
name
=
name
,
datatype
=
db
.
DATETIME
)
else
:
ent
=
db
.
Property
(
name
=
name
,
datatype
=
db
.
TEXT
)
elif
elt
[
"
type
"
]
==
"
integer
"
:
ent
=
db
.
Property
(
name
=
name
,
datatype
=
db
.
INTEGER
)
elif
elt
[
"
type
"
]
==
"
number
"
:
ent
=
db
.
Property
(
name
=
name
,
datatype
=
db
.
DOUBLE
)
elif
elt
[
"
type
"
]
==
"
boolean
"
:
ent
=
db
.
Property
(
name
=
name
,
datatype
=
db
.
BOOLEAN
)
elif
elt
[
"
type
"
]
==
"
object
"
:
elif
elt
[
"
type
"
]
==
"
object
"
:
ent
=
self
.
_treat_record_type
(
elt
,
name
)
ent
=
self
.
_treat_record_type
(
elt
,
name
)
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
unittests/test_json_schema_model_parser.py
+
1
−
1
View file @
3bf6b29b
...
@@ -70,7 +70,7 @@ def test_datamodel_with_atomic_properties():
...
@@ -70,7 +70,7 @@ def test_datamodel_with_atomic_properties():
rt1
=
model
[
"
Dataset1
"
]
rt1
=
model
[
"
Dataset1
"
]
assert
isinstance
(
rt1
,
db
.
RecordType
)
assert
isinstance
(
rt1
,
db
.
RecordType
)
assert
rt
.
name
==
"
Dataset1
"
assert
rt
1
.
name
==
"
Dataset1
"
assert
rt1
.
description
==
"
Some description
"
assert
rt1
.
description
==
"
Some description
"
assert
len
(
rt1
.
get_properties
())
==
3
assert
len
(
rt1
.
get_properties
())
==
3
...
...
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