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
90570a20
Verified
Commit
90570a20
authored
1 year ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
DOC: jsex: Better docstring, a few new TODOs
parent
e6a13890
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!89
ENH: JsonSchemaExporter accepts do_not_create parameter.
,
!88
jsex / yaml parser
Pipeline
#44126
failed
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/json_schema_exporter.py
+6
-3
6 additions, 3 deletions
src/caosadvancedtools/json_schema_exporter.py
with
6 additions
and
3 deletions
src/caosadvancedtools/json_schema_exporter.py
+
6
−
3
View file @
90570a20
...
...
@@ -74,7 +74,7 @@ class JsonSchemaExporter:
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]
A list of
RedcordType
names, for which there should be no option
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]
...
...
@@ -194,9 +194,12 @@ class JsonSchemaExporter:
name
=
prop
.
name
,
datatype
=
get_list_datatype
(
prop
.
datatype
,
strict
=
True
))
json_prop
[
"
items
"
],
inner_ui_schema
=
self
.
_make_segment_from_prop
(
list_element_prop
)
if
prop
.
name
in
self
.
_multiple_choice
and
prop
.
name
in
self
.
_do_not_create
:
# TODO: if not multiple_choice, but do_not_create:
# "ui:widget" = "radio" & "ui:inline" = true
# TODO: set threshold for number of items.
json_prop
[
"
uniqueItems
"
]
=
True
ui_schema
[
"
ui:widget
"
]
=
"
checkboxes
"
ui_schema
[
"
ui:
options
"
]
=
{
"
inline
"
:
True
}
ui_schema
[
"
ui:inline
"
]
=
True
if
inner_ui_schema
:
ui_schema
[
"
items
"
]
=
inner_ui_schema
elif
prop
.
is_reference
():
...
...
@@ -512,7 +515,7 @@ def recordtype_to_json_schema(rt: db.RecordType, additional_properties: bool = T
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], optional
A list of
RedcordType
names, for which there should be no option
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], optional
...
...
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