You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataGraph The file containing the Target Data Graph.
77
77
78
78
optional arguments:
79
+
--server Ignore all the rest of the options, start the HTTP Server.
79
80
-h, --help show this help message and exit
80
81
-s [SHACL], --shacl [SHACL]
81
82
A file containing the SHACL Shapes Graph.
@@ -155,7 +156,7 @@ Some other optional keyword variables available on the `validate` function:
155
156
* `data_graph_format`: Override the format detection for the given data graph source file.
156
157
* `shacl_graph_format`: Override the format detection for the given shacl graph source file.
157
158
* `ont_graph_format`: Override the format detection for the given extra ontology graph source file.
158
-
* `iterate_rules`: Interate SHACL Rules until steady state is found (only works with advanced mode).
159
+
* `iterate_rules`: Iterate SHACL Rules until steady state is found (only works with advanced mode).
159
160
* `do_owl_imports`: Enable the feature to allow the import of subgraphs using `owl:imports` for the shapes graph and the ontology graph. Note, you explicitly cannot use this on the target data graph.
160
161
* `serialize_report_graph`: Convert the report results_graph into a serialised representation (for example, 'turtle')
161
162
* `check_dash_result`: Check the validation result against the given expected DASH test suite result.
@@ -176,6 +177,42 @@ You can get an equivalent of the Command Line Tool using the Python3 executable
176
177
$ python3 -m pyshacl
177
178
```
178
179
180
+
## Integrated OpenAPI3.0-compatible HTTP REST Service
181
+
182
+
PySHACL now has a built-in validation service, exposed via an OpenAPI3.0-compatible REST API.
183
+
184
+
Due to the additional dependencies required to run, this feature is an optional extra.
185
+
186
+
You must first install PySHACL with the `http` extra option enabled:
187
+
188
+
```bash
189
+
$ pip3 install -U pyshacl[http]
190
+
```
191
+
192
+
When that is installed, you can start the service using the by executing the CLI entrypoint:
193
+
194
+
```bash
195
+
$ pyshacl --server
196
+
# or
197
+
$ pyshacl_server
198
+
# or
199
+
$ python3 -m pyshacl server
200
+
```
201
+
202
+
By default, this will run the service on localhost address `127.0.0.1` on port `8099`.
203
+
204
+
To view the SwaggerUI documentation for the service, navigate to `http://127.0.0.1:8099/docs/swagger` and for the ReDoc version, go to `http://127.0.0.1:8099/docs/redoc`.
205
+
206
+
To view the OpenAPI3 schema see `http://127.0.0.1:8099/docs/openapi.json`
207
+
208
+
### Configuring the HTTP REST Service
209
+
210
+
- You can force PySHACL CLI to start up in HTTP Server mode by passing environment variable `PYSHACL_SERVER=TRUE`. This is useful in a containerised service, where you will _only_ be running PySHACL in this mode.
211
+
- `PYSHACL_SERVER_LISTEN=1.2.3.4` listen on a different IP Address or hostname
212
+
- `PYSHACL_SERVER_PORT=8080` listen on given different TCP PORT
213
+
- `PYSHACL_SERVER_HOSTNAME=example.org` when you are hosting the server behind a reverse-proxy or in a containerised environment, use this so PySHACL server knows what your externally facing hostname is
214
+
215
+
179
216
180
217
## Errors
181
218
Under certain circumstances pySHACL can produce a `Validation Failure`. This is a formal error defined by the SHACL specification and is required to be produced as a result of specific conditions within the SHACL graph.
0 commit comments