Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
erp5
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):
...
@@ -42,7 +42,7 @@ class JSONType(XMLObject):
,
PropertySheet
.
TextDocument
,
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.
Validate contained JSON with the Schema defined in the Portal Type.
"""
"""
...
@@ -60,4 +60,7 @@ class JSONType(XMLObject):
...
@@ -60,4 +60,7 @@ class JSONType(XMLObject):
validator
=
jsonschema
.
validators
.
validator_for
(
defined_schema
)(
defined_schema
,
format_checker
=
jsonschema
.
FormatChecker
())
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
sorted
(
validator
.
iter_errors
(
current_schema
),
key
=
lambda
e
:
e
.
path
)
return
err
return
err
return
True
return
True
\ No newline at end of file
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 @@
...
@@ -26,7 +26,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
expression
</string>
</key>
<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>
<item>
<item>
<key>
<string>
id
</string>
</key>
<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