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
448faa36
Verified
Commit
448faa36
authored
1 year ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
ENH: jsex has new parameter `use_rt_pool`
parent
8bbb9e0a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!100
WIP: Filling XLSX: Seems to be working.
,
!94
ENH: add framework for converting json schema into table templates
,
!93
Filling XLSX: Everything except multiple choice.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
src/caosadvancedtools/json_schema_exporter.py
+20
-5
20 additions, 5 deletions
src/caosadvancedtools/json_schema_exporter.py
with
22 additions
and
5 deletions
CHANGELOG.md
+
2
−
0
View file @
448faa36
...
...
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ###
-
Json schema exporter has new parameter
`use_rt_pool`
.
### Changed ###
### Deprecated ###
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/json_schema_exporter.py
+
20
−
5
View file @
448faa36
...
...
@@ -29,6 +29,7 @@ from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import
linkahead
as
db
from
linkahead.common.datatype
import
get_list_datatype
,
is_list_datatype
from
.models.data_model
import
DataModel
class
JsonSchemaExporter
:
...
...
@@ -45,6 +46,7 @@ class JsonSchemaExporter:
do_not_create
:
List
[
str
]
=
None
,
do_not_retrieve
:
List
[
str
]
=
None
,
no_remote
:
bool
=
False
,
use_rt_pool
:
DataModel
=
None
,
multiple_choice
:
List
[
str
]
=
None
,
wrap_files_in_objects
:
bool
=
False
,
):
...
...
@@ -73,16 +75,21 @@ class JsonSchemaExporter:
description of the corresponding schema entry. If set to false, an
additional `unit` key is added to the schema itself which is purely
annotational and ignored, e.g., in validation. Default is True.
do_not_create : list[str]
do_not_create : list[str]
, optional
A list of reference Property names, for which there should be no option
to create them. Instead, only the choice of existing elements should
be given.
do_not_retrieve : list[str]
do_not_retrieve : list[str]
, optional
A list of RedcordType names, for which no Records shall be retrieved. Instead, only an
object description should be given. If this list overlaps with the `do_not_create`
parameter, the behavior is undefined.
no_remote : bool
If True, do not attempt to connect to a LinkAhead server at all. Default is False.
no_remote : bool, optional
If True, do not attempt to connect to a LinkAhead server at all. Default is False. Note
that the exporter may fail if this option is activated and the data model is not
self-sufficient.
use_rt_pool : DataModel, optional
If given, do not attempt to retrieve RecordType information remotely but from this parameter
instead.
multiple_choice : list[str], optional
A list of reference Property names which shall be denoted as multiple choice properties.
This means that each option in this property may be selected at most once. This is not
...
...
@@ -118,6 +125,7 @@ class JsonSchemaExporter:
self
.
_do_not_create
=
do_not_create
self
.
_do_not_retrieve
=
do_not_retrieve
self
.
_no_remote
=
no_remote
self
.
_use_rt_pool
=
use_rt_pool
self
.
_multiple_choice
=
multiple_choice
self
.
_wrap_files_in_objects
=
wrap_files_in_objects
...
...
@@ -256,7 +264,9 @@ class JsonSchemaExporter:
# Only a simple list of values
json_prop
[
"
enum
"
]
=
values
else
:
if
self
.
_no_remote
:
if
self
.
_use_rt_pool
:
rt
=
self
.
_use_rt_pool
.
get_deep
(
prop_name
)
elif
self
.
_no_remote
:
rt
=
prop
.
datatype
else
:
rt
=
db
.
execute_query
(
f
"
FIND RECORDTYPE WITH name=
'
{
prop_name
}
'"
,
...
...
@@ -479,6 +489,7 @@ def recordtype_to_json_schema(rt: db.RecordType, additional_properties: bool = T
do_not_create
:
List
[
str
]
=
None
,
do_not_retrieve
:
List
[
str
]
=
None
,
no_remote
:
bool
=
False
,
use_rt_pool
:
DataModel
=
None
,
multiple_choice
:
List
[
str
]
=
None
,
rjsf
:
bool
=
False
,
wrap_files_in_objects
:
bool
=
False
...
...
@@ -524,6 +535,9 @@ def recordtype_to_json_schema(rt: db.RecordType, additional_properties: bool = T
parameter, the behavior is undefined.
no_remote : bool, optional
If True, do not attempt to connect to a LinkAhead server at all. Default is False.
use_rt_pool : DataModel, optional
If given, do not attempt to retrieve RecordType information remotely but from this parameter
instead.
multiple_choice : list[str], optional
A list of reference Property names which shall be denoted as multiple choice properties.
This means that each option in this property may be selected at most once. This is not
...
...
@@ -560,6 +574,7 @@ def recordtype_to_json_schema(rt: db.RecordType, additional_properties: bool = T
do_not_create
=
do_not_create
,
do_not_retrieve
=
do_not_retrieve
,
no_remote
=
no_remote
,
use_rt_pool
=
use_rt_pool
,
multiple_choice
=
multiple_choice
,
wrap_files_in_objects
=
wrap_files_in_objects
)
...
...
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