Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
xml-validation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
vaclab
xml-validation
Commits
db5ae6e6
Commit
db5ae6e6
authored
3 years ago
by
Rolf Niepraschk
Browse files
Options
Downloads
Patches
Plain Diff
Description og "/update"
parent
817b5598
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+10
-46
10 additions, 46 deletions
README.md
server.py
+0
-2
0 additions, 2 deletions
server.py
with
10 additions
and
48 deletions
README.md
+
10
−
46
View file @
db5ae6e6
...
...
@@ -55,14 +55,14 @@ File `config.json`:
### /validate endpoint [POST]
```
shell
curl
-X
POST
-H
"Content-Type: text/xml"
-d
@
valid_xml_matches_xsd
http://localhost:5005/validate
curl
-X
POST
-H
"Content-Type: text/xml"
-d
@
VALID.xml
http://localhost:5005/validate
<ok/>
```
Validation against an explizit schema version
```
shell
curl
-X
POST
-H
"Content-Type: text/xml"
-d
@
valid_xml_matches_xsd
http://localhost:5005/validate?v
=
2.4.0
curl
-X
POST
-H
"Content-Type: text/xml"
-d
@
VALID.xml
http://localhost:5005/validate?v
=
2.4.0
<ok/>
```
...
...
@@ -73,59 +73,17 @@ wget --post-file=example.xml --header="Content-Type:text/xml;" -q -O- http://loc
```
```
shell
curl
-X
POST
-H
"Content-Type: text/xml
?v=2.1.0"
-d
@no_valid_
xml http://localhost:5005/validate
curl
-X
POST
-H
"Content-Type: text/xml
"
-d
@INVALID.
xml http://localhost:5005/validate
<error>invalid xml data</error>
```
```
shell
curl
-X
POST
-H
"Content-Type: text/xml"
-d
@
valid_xml_but_dont_matches_xsd
http://localhost:5005/validate
curl
-X
POST
-H
"Content-Type: text/xml"
-d
@
VALID_XML_BUT_DONT_MATCHES_XSD.xml
http://localhost:5005/validate
<error>verbose error message</error>
```
Example:
```
shell
curl
-X
POST
-H
"Content-Type: text/xml"
-d
@11044_17_DCC_v1.8.1_Au_with_error.xml http://localhost:5005/validate
<error>failed decoding
'A'
with XsdAtomicBuiltin
(
name
=
'xs:double'
)
:
Reason: could not convert string to float:
'A'
Schema:
<simpleType
xmlns
=
"http://www.w3.org/2001/XMLSchema"
xmlns:hfp
=
"http://www.w3.org/2001/XMLSchema-hasFacetAndProperty"
id
=
"double"
name
=
"double"
>
<annotation>
<appinfo>
<hfp:hasFacet
name
=
"pattern"
/>
<hfp:hasFacet
name
=
"enumeration"
/>
<hfp:hasFacet
name
=
"whiteSpace"
/>
<hfp:hasFacet
name
=
"maxInclusive"
/>
<hfp:hasFacet
name
=
"maxExclusive"
/>
<hfp:hasFacet
name
=
"minInclusive"
/>
<hfp:hasFacet
name
=
"minExclusive"
/>
<hfp:hasProperty
name
=
"ordered"
value
=
"total"
/>
<hfp:hasProperty
name
=
"bounded"
value
=
"true"
/>
<hfp:hasProperty
name
=
"cardinality"
value
=
"finite"
/>
<hfp:hasProperty
name
=
"numeric"
value
=
"true"
/>
</appinfo>
<documentation
source
=
"http://www.w3.org/TR/xmlschema-2/#double"
/>
</annotation>
<restriction
base
=
"xs:anySimpleType"
>
<whiteSpace
fixed
=
"true"
id
=
"double.whiteSpace"
value
=
"collapse"
/>
</restriction>
</simpleType>
Instance:
<ns0:coverageProbability xmlns:ns0
=
"https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/SI"
>
A</ns0:coverageProbability>
Path: /
{
https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/DCC
}
digitalCalibrationCertificate/
{
https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/DCC
}
measurementResults/
{
https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/DCC
}
influenceConditions/
{
https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/DCC
}
influenceCondition/
{
https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/DCC
}
outcome/
{
https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/DCC
}
data/
{
https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/DCC
}
quantity/
{
https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/SI
}
list/
{
https://intranet.ptb.de/fileadmin/dokumente/intranet/abteilungen/abteilung_1/Digitaler_Kalibrierschein/SI
}
coverageProbability
</error>
```
### /version [GET]
Returns the version of the validation server:
...
...
@@ -136,6 +94,12 @@ curl http://localhost:5005/version
<version>0.2.0</version>
```
### /update [POST]
This URL can be used as a webhook for GitLab (Tag Push Events). With this,
GitLab notifies the Flask server of the existence of a new program version,
which is then requested as a tarball and unpacked.
## Web interface
```
...
...
This diff is collapsed.
Click to expand it.
server.py
+
0
−
2
View file @
db5ae6e6
...
...
@@ -7,8 +7,6 @@ import subprocess, json
from
pprint
import
pprint
config
=
utils
.
get_config_dict
()
###releases_dict = utils.get_releases_dict(config['xsd']['releases'])
###versions = utils.get_versions(releases_dict)
app
=
Flask
(
__name__
)
CORS
(
app
)
...
...
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