Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
a22a4800
Commit
a22a4800
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-272
: fixed exception type
parent
6c8234e5
No related branches found
No related tags found
1 merge request
!213
Resolve TMSS-272
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
LCS/PyCommon/json_utils.py
+3
-3
3 additions, 3 deletions
LCS/PyCommon/json_utils.py
with
3 additions
and
3 deletions
LCS/PyCommon/json_utils.py
+
3
−
3
View file @
a22a4800
...
...
@@ -178,18 +178,18 @@ def validate_json_against_schema(json_string: str, schema: str):
try
:
json_object
=
json
.
loads
(
json_string
)
except
json
.
decoder
.
JSONDecodeError
as
e
:
raise
jsonschema
.
Schema
ValidationE
xception
(
"
Invalid JSON: %s
\n
%s
"
%
(
str
(
e
),
json_string
))
raise
jsonschema
.
exceptions
.
ValidationE
rror
(
"
Invalid JSON: %s
\n
%s
"
%
(
str
(
e
),
json_string
))
try
:
schema_object
=
json
.
loads
(
schema
)
except
json
.
decoder
.
JSONDecodeError
as
e
:
raise
jsonschema
.
Schema
ValidationE
xception
(
"
Invalid JSON: %s
\n
%s
"
%
(
str
(
e
),
schema
))
raise
jsonschema
.
exceptions
.
ValidationE
rror
(
"
Invalid JSON: %s
\n
%s
"
%
(
str
(
e
),
schema
))
# now do the actual validation
try
:
validate_json_object_with_schema
(
json_object
,
schema_object
)
except
jsonschema
.
ValidationError
as
e
:
raise
jsonschema
.
Schema
ValidationE
xception
(
str
(
e
))
raise
jsonschema
.
exceptions
.
ValidationE
rror
(
str
(
e
))
def
get_default_json_object_for_schema
(
schema
:
str
)
->
dict
:
...
...
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