Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
7d85b622
Commit
7d85b622
authored
Sep 17, 2021
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_json_type: use validateLocalJsonSchema to validate local schema
parent
a2b42906
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
bt5/erp5_json_type/DocumentTemplateItem/portal_components/document.erp5.JSONType.py
...tTemplateItem/portal_components/document.erp5.JSONType.py
+5
-2
bt5/erp5_json_type/PropertySheetTemplateItem/portal_property_sheets/JSONTypeConstraint/json_schema_validation_constraint_constraint.xml
...nstraint/json_schema_validation_constraint_constraint.xml
+1
-1
No files found.
bt5/erp5_json_type/DocumentTemplateItem/portal_components/document.erp5.JSONType.py
View file @
7d85b622
...
...
@@ -42,7 +42,7 @@ class JSONType(XMLObject):
,
PropertySheet
.
TextDocument
)
def
validateJsonSchema
(
self
,
list_error
=
False
):
def
validate
Local
JsonSchema
(
self
,
list_error
=
False
):
"""
Validate contained JSON with the Schema defined in the Portal Type.
"""
...
...
@@ -60,4 +60,7 @@ class JSONType(XMLObject):
validator
=
jsonschema
.
validators
.
validator_for
(
defined_schema
)(
defined_schema
,
format_checker
=
jsonschema
.
FormatChecker
())
return
sorted
(
validator
.
iter_errors
(
current_schema
),
key
=
lambda
e
:
e
.
path
)
return
err
return
True
\ No newline at end of file
return
True
def
validateJsonSchema
(
self
,
list_error
=
False
):
return
self
.
validateLocalJsonSchema
(
list_error
=
list_error
)
\ No newline at end of file
bt5/erp5_json_type/PropertySheetTemplateItem/portal_property_sheets/JSONTypeConstraint/json_schema_validation_constraint_constraint.xml
View file @
7d85b622
...
...
@@ -26,7 +26,7 @@
</item>
<item>
<key>
<string>
expression
</string>
</key>
<value>
<string>
python: object.validate
Json
Schema()
</string>
</value>
<value>
<string>
python: object.validate
LocalJSON
Schema()
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment