Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
european-cloud-industry
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Fonds-de-Dotation-du-Libre
european-cloud-industry
Commits
ea67c340
Commit
ea67c340
authored
Jul 04, 2022
by
EyaChafroud2
Committed by
GitHub
Jul 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update validator.py
parent
a8df8528
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
validator.py
validator.py
+38
-0
No files found.
validator.py
View file @
ea67c340
here
’
s
a
script
to
run
the
checks
:
``
`
#!/usr/bin/env python3
import
glob
,
json
,
os
from
jsonschema
import
validate
from
jsonschema.exceptions
import
ValidationError
SCHEMA
=
json
.
load
(
open
(
"data/JSON-schema.json"
))
num_valid
=
0
filenames
=
sorted
(
glob
.
glob
(
"data/*.json"
))
for
fn
in
filenames
:
if
fn
==
"data/JSON-schema.json"
:
continue
try
:
data
=
json
.
load
(
open
(
fn
))
except
:
print
(
f"
{
fn
}
-> syntactically incorrect JSON"
)
continue
try
:
validate
(
instance
=
data
,
schema
=
SCHEMA
[
0
])
except
ValidationError
as
e
:
print
(
f"
{
fn
}
-> invalid JSON"
)
print
(
" "
+
e
.
message
)
continue
print
(
f"
{
fn
}
-> OK"
)
num_valid
+=
1
print
(
f"
{
num_valid
}
valid JSON files"
)
``
`
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