Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos.core
Commits
fabe007a
Commit
fabe007a
authored
Apr 12, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Use json schema to validate the software.cfg.json
parent
0150fdee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_load_schema_js.js
...b_page_module/rjs_gadget_erp5_page_slap_load_schema_js.js
+11
-1
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_load_schema_js.xml
..._page_module/rjs_gadget_erp5_page_slap_load_schema_js.xml
+2
-2
No files found.
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_load_schema_js.js
View file @
fabe007a
...
@@ -210,6 +210,16 @@
...
@@ -210,6 +210,16 @@
});
});
}
}
function
validateSoftwareJSONSchema
(
json
)
{
return
getJSON
(
"
slapos_load_software_schema.json
"
)
.
push
(
function
(
schema
)
{
if
(
!
tv4
.
validate
(
json
,
schema
))
{
throw
new
Error
(
"
Non valid JSON for software.cfg.json:
"
+
json
);
}
return
JSON
.
parse
(
json
);
});
}
gk
gk
.
declareMethod
(
"
getBaseUrl
"
,
function
(
url
)
{
.
declareMethod
(
"
getBaseUrl
"
,
function
(
url
)
{
var
base_url
,
url_uri
=
URI
(
url
);
var
base_url
,
url_uri
=
URI
(
url
);
...
@@ -232,7 +242,7 @@
...
@@ -232,7 +242,7 @@
.
declareMethod
(
"
loadSoftwareJSON
"
,
function
(
url
)
{
.
declareMethod
(
"
loadSoftwareJSON
"
,
function
(
url
)
{
return
getJSON
(
url
)
return
getJSON
(
url
)
.
push
(
function
(
json
)
{
.
push
(
function
(
json
)
{
return
JSON
.
parse
(
json
);
return
validateSoftwareJSONSchema
(
json
);
});
});
})
})
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_load_schema_js.xml
View file @
fabe007a
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
999.
27487.10946.52445
</string>
</value>
<value>
<string>
999.
31669.11148.21196
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1649
686390.12
</float>
<float>
1649
728041.67
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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