Weaver¶
Workflow Execution Management Service (EMS)
Application, Deployment and Execution Service (ADES)
- Weaver (the nest-builder)
Weaver birds build exquisite and elaborate nest structures that are a rival to any human feat of engineering. Some of these nests are the largest structures to be built by birds. (Eden).
Although weavers are named for their elaborately woven nests, some are notable for their selective parasitic nesting habits instead. (Wikipedia)
Weaver is an Execution Management Service (EMS) that allows the execution of workflows chaining various applications and Web Processing Services (WPS) inputs and outputs. Remote execution is deferred by the EMS to an Application Deployment and Execution Service (ADES), as defined by Common Workflow Language (CWL) configurations.
Weaver can be launched either as an EMS or an ADES according to configuration values it is deployed with. For more details, see Configuration section.
dependencies |
|
---|---|
build status |
|
tests status |
|
releases |
Summary¶
Weaver is primarily an Execution Management Service (EMS) that allows the execution of workflows chaining various applications and Web Processing Services (WPS) inputs and outputs. Remote execution of each process in a workflow chain is dispatched by the EMS to one or many registered Application Deployment and Execution Service (ADES) by ensuring the transfer of files accordingly between instances when located across multiple remote locations.
Weaver can also accomplish the ADES role in order to perform application deployment at the data source using the application definition provided by Common Workflow Language (CWL) configuration. It can then directly execute a registered process execution with received inputs from a WPS request to expose output results for a following ADES in a EMS workflow execution chain.
Weaver extends the OGC API - Processes (WPS-REST bindings) by providing additional functionalities such as more detailed job log routes, adding more process management request options than required by the standard, and supporting remote providers to name a few. Because of this, not all features offered in Weaver are guaranteed to be applicable on other similarly behaving ADES and/or EMS instances. The reference specification is tracked to preserve the minimal conformance requirements and provide feedback to Open Geospatial Consortium (OGC) in this effect.
Weaver can be launched either as an EMS or an ADES according to configuration values it is deployed with. For more details, see Configuration and Documentation sections.
Links¶
Docker image repositories:
CRIM registry: ogc/weaver
OGC processes: ogc-public
DockerHub: pavics/weaver
$ docker pull pavics/weaver:4.2.0
For convenience, following tags are also available:
weaver:4.2.0-manager
: Weaver image that will run the API for WPS process and job management.weaver:4.2.0-worker
: Weaver image that will run the process job runner application.
Following links correspond to existing servers with Weaver configured as EMS/ADES instances respectively.
ADES Test server: https://ogc-ades.crim.ca/weaver/
EMS Test server: https://ogc-ems.crim.ca/weaver/
EMS Extra server: https://ogc.crim.ca/ems/
Note
The test servers will not necessarily be up-to-date with the latest version.
Request the ${server}/weaver/versions
route to verify the running version.
Configuration¶
All configuration settings can be overridden using a weaver.ini
file that will be picked during
instantiation of the application. An example of such file is provided here: weaver.ini.example.
Setting Weaver’s operational mode (EMS/ADES) is accomplished using the
weaver.configuration
field of weaver.ini
.
For more configuration details, please refer to Documentation.
Documentation¶
The REST API documentation is auto-generated and served under any running Weaver application on route
{WEAVER_URL}/api/
. This documentation will correspond to the version of the executed Weaver application.
For the latest documentation, you can refer to the OpenAPI Specification served directly on ReadTheDocs.
More ample details about installation, configuration and usage are also provided on ReadTheDocs. These are generated from corresponding information provided in docs source directory.
Extra Details & Sponsors¶
The project was initially developed upon OGC Testbed-14 – ESA Sponsored Threads – Exploitation Platform findings and following improvements. It is also advanced with sponsorship of U.S. Department of Energy to support common API of the Earth System Grid Federation (ESGF). The findings are reported on the OGC Testbed-14 thread, and more explicitly in the ADES & EMS Results and Best Practices Engineering Report.
The project has been employed for OGC Testbed-15 - ML Thread to demonstrate the use of Machine Learning interactions with OGC web standards in the context of natural resources applications. The advancements are reported through the OGC Testbed-15: Machine Learning Engineering Report.
Developments are continued in OGC Testbed-16 to improve methodologies in order to provide better interoperable geospatial data processing in the areas of Earth Observation Application Packages.
The project is furthermore developed through the Data Analytics for Canadian Climate Services (DACCS) initiative.
Weaver is a prototype implemented in Python with the Pyramid web framework. It is part of PAVICS and Birdhouse ecosystems.
Table of Contents¶
Installation¶
The installation is using the Python distribution system Miniconda (default installation of no conda
found)
to maintain software dependencies. Any conda
installation should work the same. To use a pre-installed conda
distribution, simply make sure that it can be found on the shell path.
Requirements¶
The installation works on Linux 64 bit distributions (tested on Ubuntu 16.04).
Note
Windows is not officially supported, but some patches have been applied to help using it. If you find some problems, please submit a new issue or open a pull request with fixes.
From GitHub Sources¶
Install weaver as normal user from GitHub sources:
git clone https://github.com/crim-ca/weaver.git
cd weaver
make install
If no conda
environment is activated, the install
process will setup a new or reuse the conda environment
named weaver
and install all dependency packages. If an environment is activated, Weaver will be installed in
that environment. You can also enforce a specific environment using:
make CONDA_ENV=<my-env> install
Windows Installation¶
Minimal support is provided to run the code on Windows. To do so, the Makefile
assumes you are running in a
MINGW
environment, that conda
is already installed, and that it is available from CONDA_HOME
variable or
similar. If this is not the case, you will have to adjust the reference variables accordingly.
Note
Windows support is not official and any dependency could stop supporting it at any given time. Particularly, libraries for Celery task execution have a tendency to break between versions for Windows. The application is regularly evaluated on a Linux virtual machine. It is recommended to run it as so or using the existing Docker images.
Known issues¶
Package
shapely.geos
has C++ dependency togeos
library. If the package was installed in aconda
environment, but throughpip install
call, the source path will not be found. You have to make sure to install it usingconda install -c conda-forge shapely
.The example weaver.ini.example file uses
gunicorn
by default to take advantage of its performance features, but this package does not support Windows. Alternatively, you might need to usewaitress
by replacing it in the[server:main]
section.
Please refer to Configuration and Running sections for following steps.
Configuration¶
After you have installed Weaver, you can customize its behaviour using multiple configuration settings.
Configuration Settings¶
All settings are configured using a weaver.ini
configuration file. A weaver.ini.example file is provided
with default values to help in the configuration process. Explanations of respective settings are also available in
this example file.
The configuration file tell the application runner (e.g. Gunicorn, pserve
or similar WSGI HTTP Server), how to
execute Weaver as well as all settings to provide in order to personalize the application. All settings specific to
Weaver employ the format weaver.<setting>
.
Most configuration parameters for the manager portion of Weaver (i.e.: WSGI HTTP server for API endpoints) are
defined in the [app:main]
section of weaver.ini.example, while parameters specific to the worker (task queue
handler) are within [celery]
section. Note that multiple settings are shared between the two applications, such as
the mongodb.[...]
configuration or weaver.configuration
options. When parameters are shared, they are usually
expected to be placed in [app:main]
section.
Following is a partial list of most predominant settings specific to Weaver. Many parameters provide alternative or extended functionality when employed in conjunction with other settings. Others are sometimes not necessarily required to be defined if default behaviour is desired. Refer to the relevant details that will describe in which condition they are optional and which default value or operation is applied in each situation.
Note
Refer to weaver.ini.example for the extended list of applicable settings. Some advanced configuration settings are also described in other sections of this page.
weaver.configuration = ADES|EMS|HYBRID|DEFAULT
(default:DEFAULT
)Tells the application in which mode to run.EnablingADES
for instance will disable someEMS
-specific operations such as dispatching Workflow process steps to known remoteADES
servers.ADES
should be used to only run processes locally (as the working unit).EMS
will always dispatch execution of jobs to otherADES
except for Workflow processes that chains them.WhenHYBRID
is specified, Weaver will assume bothADES
andEMS
roles simultaneously, meaning it will be able to execute local processes by itself and monitor dispatched execution of registered remote providers.Finally,DEFAULT
configuration will provide very minimalistic operations as all other modes will be unavailable.weaver.url = <url>
(default:http://localhost:4001
)Defines the full URL (including HTTP protocol/scheme, hostname and optionally additional path suffix) that will be used as base URL for all other URL settings of Weaver.
Note
This is the URL that you want displayed in responses (e.g.: processDescriptionURL
or job location
).
For the effective URL employed by the WSGI HTTP server, refer to [server:main]
section of weaver.ini.example.
weaver.schema_url = <url>
(default:${weaver.url}/json#/definitions
)Defines the base URL of schemas to be reported in responses.When not provided, the running Web Application instance OpenAPI JSON path will be employed to refer to the schemadefinitions
section. The configuration setting is available to override this endpoint by another static URL location where the corresponding schemas can be found if desired.
New in version 4.0.0.
weaver.wps = true|false
(default:true
)Enables the WPS-1/2 endpoint.
Warning
At the moment, this setting must be true
to allow job execution as the worker monitors this endpoint.
This could change with future developments (see issue #21).
weaver.wps_path = <url-path>
weaver.wps_url = <full-url>
(default: path/ows/wps
)Defines the URL to employ as WPS-1/2 endpoint.It can either be the explicit full URL to use or the path relative toweaver.url
.Settingweaver.wps_path
is ignored if its URL equivalent is defined.The path variant SHOULD start with/
for appropriate concatenation withweaver.url
, although this is not strictly enforced.weaver.wps_output_s3_bucket = <s3-bucket>
(default:None
)AWS S3 bucket where to store WPS outputs. Used in conjunction withweaver.wps_output_s3_region
.When this parameter is defined, any job result generated by a process execution will be stored (uploaded) to that location. If no bucket is specified, the outputs fall back to using the location specified byweaver.wps_output_dir
.
New in version 1.13.0.
See also
weaver.wps_output_s3_region = <s3-region>
(default:None
)AWS S3 region to employ for storing WPS outputs. Used in conjunction withweaver.wps_output_s3_bucket
.When this parameter is defined as well asweaver.wps_output_s3_bucket
, it is employed to define which S3 to write output files to. If not defined butweaver.wps_output_s3_bucket
is specified, Weaver attempt to retrieve the region from the profile defined in AWS configuration files or environment variables.
New in version 1.13.0.
See also
weaver.wps_output_dir = <directory-path>
(default:/tmp
)Location where WPS outputs (results from jobs) will be stored for stage-out.Whenweaver.wps_output_s3_bucket
is specified, only WPS XML status and log files are stored under this path. Otherwise, job results are also located under this directory with a sub-directory named with the job ID.This directory should be mapped to Weaver’s WPS output URL to serve them externally as needed.weaver.wps_output_path = <url-path>
weaver.wps_output_url = <full-url>
(default: path/wpsoutputs
)Endpoint that will be employed as prefix to refer to WPS outputs (job results).It can either be the explicit full URL to use or the path relative toweaver.url
.Settingweaver.wps_output_path
is ignored if its URL equivalent is defined.The path variant SHOULD start with/
for appropriate concatenation withweaver.url
, although this is not strictly enforced.weaver.wps_workdir = <directory-path>
(default: uses automatically generated temporary directory if none specified)Prefix where process job worker should execute the process from.weaver.wps_restapi = true|false
(default:true
)Enable the WPS-REST endpoint.
Warning
Weaver looses most, if not all, of its useful features without this, and there won’t be much point in using it without REST endpoint, but it should technically be possible to run it as WPS-1/2 only if desired.
weaver.wps_restapi_path = <url-path>
weaver.wps_restapi_url = <full-url>
(default: path/
)Endpoint that will be employed as prefix to refer to WPS-REST requests(including but not limited to OGC API - Processes schemas).It can either be the explicit full URL to use or the path relative toweaver.url
.Settingweaver.wps_restapi_path
is ignored if its URL equivalent is defined.The path variant SHOULD start with/
for appropriate concatenation withweaver.url
, although this is not strictly enforced.weaver.wps_metadata_[...]
(multiple settings)Metadata fields that will be rendered by either or both the WPS-1/2 and WPS-REST endpoints (Access registered process(es) (GetCapabilities, DescribeProcess)).weaver.wps_email_[...]
(multiple settings)Defines configuration of email notification functionality on job completion.Encryption settings as well as custom email templates are available. Default email template defined in email-template is employed if none is provided. Email notifications are sent only on job completion if an email was provided in the Execution of a process (Execute) request body (see also: Email Notification).
Note
Since Weaver employs Celery as task queue manager and MongoDB as backend, relevant settings for the configuration of Celery and the configuration of MongoDB Backend should be referred to. Processing of task jobs and results reporting is accomplished according to the specific implementation of these services. Therefore, all applicable settings and extensions should be available for custom server configuration and scaling as needed.
Configuration of AWS S3 Buckets¶
Any AWS S3 bucket accessed by Weaver needs to be accessible by the application, whether it is to fetch input files or to store output results. This can require from the server administrator to specify credentials by one of reference supported methodologies to provide necessary role and/or permissions. See also reference AWS Configuration which list various options that will be considered when working with S3 buckets.
Note that Weaver expects the AWS Configuration to define a default profile from which the AWS
client can infer which region it needs to connect to. The S3 bucket to store files should be defined by
weaver.wps_output_s3_bucket
setting as presented in the previous section.
The S3 file references for input and output in Weaver are expected to be formatted as:
s3://<bucket>/<file-key>
This implicitly tells Weaver to employ the S3 bucket it was configured with as well as the automatically retrieved region from the AWS server configuration.
Alternatively, the reference can be provided with the more explicit AWS S3 link such as:
https://s3.[region-name.]amazonaws.com/<bucket>/<file-key>
In this situation, Weaver will parse it as equivalent to the prior shorthand reference format, as long as the AWS server configuration matches with all associated details from the HTTP URL variant. If this is not the case, Weaver will still attempt to fetch the file as standard HTTP reference, but read access should be granted accordingly to the corresponding bucket and file such that Weaver can access it.
Finally, in the above references, file-key
is used as anything after the bucket name. In other words, this value
can contain any amount of /
separators and details. For example, Weaver will store process output results to S3
using file-key
as a combination of <WPS-UUID>/<output-id>.<ext>
, therefore forming the full job result file
references as:
https://s3.<region-name>.amazonaws.com/<bucket>/<WPS-UUID>/<output-id>.<ext>
Note
Value of WPS-UUID
can be retrieved from Weaver internal job storage from weaver.datatypes.Job.wps_id()
.
It refers to the process execution identifier that accomplished the WPS request to run the Application Package.
Configuration of WPS Processes¶
Weaver allows the configuration of services or processes auto-deployment using definitions from a file formatted
as wps_processes.yml.example. On application startup, provided references in processes
list will be employed
to attempt deployment of corresponding processes locally. Given that the resources can be correctly resolved, they
will immediately be available from Weaver’s API without further request needed.
For convenience, every reference URL in the configuration file can either refer to explicit process definition (i.e.: endpoint and query parameters that resolve to Access registered process(es) (GetCapabilities, DescribeProcess) response), or a group of processes under a common WPS server to iteratively register, using a Access registered process(es) (GetCapabilities, DescribeProcess) WPS endpoint. Please refer to wps_processes.yml.example for explicit format, keywords supported, and their resulting behaviour.
Note
Processes defined under processes
section registered into Weaver will correspond to a local snapshot of
the remote resource at that point in time, and will not update if the reference changes. On the other hand, their
listing and description offering will not require the remote service to be available at all time until execution.
New in version 1.14.0: When references are specified using providers
section instead of processes
, the registration
only saves the remote WPS provider endpoint to dynamically populate WPS processes on demand.
Using this registration method, the processes will always reflect the latest modification from the remote WPS provider.
To specify a custom YAML file, you can define the setting named weaver.wps_processes_file
with the appropriate path
within the employed weaver.ini
file that starts your application. By default, this setting will look for the
provided path as absolute location, then will attempt to resolve relative path (corresponding to where the application
is started from), and will also look within the weaver/config
directory. If none of the files can be found, the
operation is skipped.
To ensure that this feature is disabled and to avoid any unexpected auto-deployment provided by this functionality,
simply set setting weaver.wps_processes_file
as undefined (i.e.: nothing after =
in weaver.ini
).
Starting the Application¶
Todo
complete docs
make start
(or similar command)
need to start
gunicorn/pserve
(example Dockerfile-manager)need to start
celery
worker (example Dockerfile-worker)
Running Weaver¶
Running Weaver Service¶
Before running Weaver, you must make sure that the required MongoDB connection is accessible according to
specified connection settings in weaver/config/weaver.ini
.
See also
Weaver installation comes with a Makefile which provides a shortcut command to start the application with Gunicorn:
Note
If using Windows
, make sure you have read the Windows Installation section.
$ make start # start Weaver WSGI application server
Weaver should be running after this operation.
It will be available under the configured URL endpoint in weaver.ini
(see weaver.ini.example).
If everything was configured correctly, calling this URL (default: http://localhost:4001
) should
provide a response containing a JSON body with basic information about Weaver.
Execution Details¶
To execute, Weaver requires two type of application executed in parallel. First, it requires a WSGI HTTP server
that will run the application to provide API endpoints. This is referred to as weaver-manager
in the provided
docker images. Second, Weaver requires a Celery task queue handler to execute submitted process jobs. This
is referred to as weaver-worker
in built Docker images.
For specific details about configuration of both applications, please refer to Configuration section.
The typical commands that need to be executed for the manager and worker applications should be similar to the following calls. Obviously, additional arguments supported by the corresponding applications can be provided.
# manager
pserve <weaver-root>/config/weaver.ini
# worker
celery worker -A pyramid_celery.celery_app --ini <weaver-root>/config/weaver.ini
Tutorial¶
Using the WPS application included in Weaver¶
Install Weaver (see: Installation) and make sure all required components are started and running (see: Configuration).
Then, execute the desired WPS or WPS-REST request according to desired operation mode and version.
For all following examples, ${WEAVER_URL}
is used to specify your application URL endpoint configuration.
By default, this value should be localhost:4001
.
Note
This tutorial section is a minimal introduction to available requests and endpoints. Please refer to processes for further details, such as detailed request payload contents, types of processes and additional operations that compose a typical process execution workflow. Similarly, refer to Application Package for further details about the definition of the reference application executed by the deployed processes.
WPS-1/2 requests¶
Specifying the appropriate version=<1.0.0|2.0.0>
parameter in the URL as required.
Run a WPS-1/WPS-2 GetCapabilities
request:
$ curl -k "${WEAVER_URL}/ows/wps?service=wps&request=getcapabilities"
You should receive an XML response listing service details and available processes.
Run a WPS-1/WPS-2 DescribeProcess
request (built-in process jsonarray2netcdf
):
$ curl -k "${WEAVER_URL}/ows/wps?service=wps&request=describeprocess&identifier=jsonarray2netcdf&version=1.0.0"
This will provide you with an XML response listing the specific process details such and inputs/outputs and description.
We can now use the process to execute a WPS request. To do so, we will need some input data files to call it. First, let’s create a JSON file with some dummy NetCDF file reference for demonstration purpose.
$ echo 'Test WPS' > /tmp/test.nc
$ echo '["file:///tmp/test.nc"]' > /tmp/test.json
Then, run the WPS-1/WPS-2 Execute
request (built-in process jsonarray2netcdf
) as follow:
$ curl -k "${WEAVER_URL}/ows/wps?service=wps&request=execute&identifier=jsonarray2netcdf&version=1.0.0 \
&DataInputs=input=file:///tmp/test.json"
The execution of the process should read the JSON list with our dummy NetCDF file and make it available (as a copy)
on the output parameter named output
with a path matching the configured output WPS path of the application.
Note
All above WPS-1/2 requests suppose that configuration setting weaver.wps_path /ows/wps
(default value).
The request URL have to be adjusted accordingly if this parameter is modified.
Also, the provided file reference is relative where Weaver application is running. If you want to employ a remote server instance, you will have to either place the file on this server file system at a location Weaver has access to, or provide the file through an HTTP URL.
WPS-3 requests¶
All previous operations for listing available processes (GetCapabilities
), describing or executing a WPS-1/2
process can also be accomplished using the WPS-3 REST JSON interface. For instance, listing processes is done like so:
$ curl -k "${WEAVER_URL}/processes"
Individual process details (DescribeProcess
) can be obtained with the following method
(e.g.: built-in process jsonarray2netcdf
in this case):
$ curl -k "${WEAVER_URL}/processes/jsonarray2netcdf"
And execution of this process can be accomplished with the following request:
$ curl -X POST "${WEAVER_URL}/processes/jsonarray2netcdf/jobs" \
-H "Content-Type: application/json" \
-d '{"inputs": [{"id": "input", "href": "file:///tmp/test.json"}],
"outputs": [{"id": "output", "transmissionMode": "reference"}],
"response": "document",
"mode": "async"}'
The JSON response should provide a location
field specifying where the job status can be verified.
Upon successful job completion, an output
reference URL should have been generated just as with
the WPS-1/2 example.
The WPS-3 interface allows further operations such as job monitoring, specific output listing, log reporting, etc.
For all available operations and specific details about them, please refer to OpenAPI schemas (they will also be
rendered on route ${WEAVER_URL}/api
when running Weaver application).
Endpoint Content-Type¶
Todo
wps-1/2 xml default, json supported wps-2
Todo
wps-rest json only (for now, xml also if implemented) https://github.com/crim-ca/weaver/issues/125 https://github.com/crim-ca/weaver/issues/126
Next Steps¶
Have a look to the Processes, Package and FAQ sections.
The full OpenAPI Specification is also available for request details.
Processes¶
Type of Processes¶
Weaver supports multiple type of processes, as listed below. Each one of them are accessible through the same API interface, but they have different implications.
WPS-REST (a.k.a.: WPS-3, OGC API - Processes)
See also
Section Examples provides multiple concrete use cases of Deploy and Execute request payloads for diverse set of applications.
Builtin¶
These processes come pre-packaged with Weaver. They will be available directly on startup of the application and re-updated on each boot to make sure internal database references are updated with any source code changes.
Theses processes typically correspond to utility operations. They are specifically useful when employed as
step
within a Workflow process that requires data-type conversion between input/output of similar, but not
perfectly, compatible definitions.
For example, process weaver.processes.builtin.jsonarray2netcdf
takes a single input JSON file which its
content contains an array-list of NetCDF file references, and returns them directly as the corresponding list of output
files. These two different file formats (single JSON to multiple NetCDF) can then be used to map two processes with
these respective output and inputs.
As of the latest release, following builtin processes are available:
All builtin processes are marked with weaver.processes.constants.CWL_REQUIREMENT_APP_BUILTIN
in the
CWL hints
section and are all defined in weaver.processes.builtin
.
WPS-1/2¶
This kind of process corresponds to a traditional WPS XML or JSON endpoint (depending of supported version) prior to WPS-REST specification. When the WPS-REST process is deployed in Weaver using an URL reference to an WPS-1/2 process, Weaver parses and converts the XML or JSON body of the response and registers the process locally using this definition. This allows a remote server offering limited functionalities (e.g.: no REST bindings supported) to provide them through Weaver.
A minimal Deploy request body for this kind of process could be as follows:
{
"processDescription": {
"process": {
"id": "my-process-reference"
}
},
"executionUnit": [
{
"href": "https://example.com/wps?service=WPS&request=DescribeProcess&identifier=my-process&version=1.0.0"
}
]
}
This would tell Weaver to locally deploy the my-process-reference
process using the WPS-1 URL reference that is
expected to return a DescribeProcess
XML schema. Provided that this endpoint can be resolved and parsed according
to typical WPS specification, this should result into a successful process registration. The deployed process would
then be accessible with DescribeProcess requests.
The above deployment procedure can be automated on startup using Weaver’s wps_processes.yml
configuration file.
Please refer to Configuration of WPS Processes section for more details on this matter.
Warning
Because Weaver creates a snapshot of the reference process at the moment it was deployed, the local process definition could become out-of-sync with the remote reference where the Execute request will be sent. Refer to Remote Provider section for more details to work around this issue.
See also
WPS-REST¶
This process type is the main component of Weaver. All other process types are converted to this one either through some parsing (e.g.: WPS-1/2) or with some requirement indicators (e.g.: Builtin, Workflow) for special handling.
When deploying one such process directly, it is expected to have a reference to a CWL Application Package. This is most of the time employed to wrap a reference docker image process. The reference package can be provided in multiple ways as presented below.
Note
When a process is deployed with any of the below supported Application Package formats, additional parsing of this CWL as well as complementary details directly within the WPS deployment body is accomplished. See Correspondence between CWL and WPS fields section for more details.
Package as Literal Unit Block¶
In this situation, the CWL definition is provided as is using JSON-formatted package embedded within the
POST {WEAVER_URL}/processes
(Deploy) request. The request payload would take the following shape:
{
"processDescription": {
"process": {
"id": "my-process-reference"
}
},
"executionUnit": [
{
"unit": {
"cwlVersion": "v1.0",
"class": "CommandLineTool",
"inputs": ["<...>"],
"outputs": ["<...>"],
"<...>": "<...>"
}
}
]
}
ESGF-CWT¶
For traditional WPS-1 process type, Weaver adds default values to CWL definition. As we can see in
weaver/processes/wps_package.py
, the following default values for the CWL package are:
cwl_package = OrderedDict([
("cwlVersion", "v1.0"),
("class", "CommandLineTool"),
("hints", {
CWL_REQUIREMENT_APP_WPS1: {
"provider": get_url_without_query(wps_service_url),
"process": process_id,
}}),
])
In ESGF-CWT processes, ESGF-CWTRequirement
hint must be used instead of usual WPS1Requirement
, contained
in the weaver.processes.constants.CWL_REQUIREMENT_APP_WPS1
variable. The handling of this technicality is
handled in weaver/processes/wps_package.py
. We can define ESGF-CWT processes using this syntax:
{
"cwlVersion": "v1.0",
"class": "CommandLineTool",
"hints": {
"ESGF-CWTRequirement": {
"provider": "https://edas.nccs.nasa.gov/wps/cwt",
"process": "xarray.subset"
}
}
}
Workflow¶
Processes categorized as Workflow
are very similar to WPS-REST processes. From the API standpoint, they
actually look exactly the same as an atomic process when calling DescribeProcess or Execute requests.
The difference lies within the referenced Application Package which uses a CWL Workflow instead of
typical CWL CommandLineTool, and therefore, modifies how the process is internally executed.
For Workflow
processes to be deploy-able and executable, it is mandatory that Weaver is configured as
EMS or HYBRID (see: Configuration Settings). This requirement is due to the nature of workflows
that chain processes that need to be dispatched to known remote ADES servers
(see: Configuration of Data Sources and Workflow Operations).
Given that a Workflow
process was successfully deployed and that all process steps can be resolved, calling
its Execute request will tell Weaver to parse the chain of operations and send step process execution requests
to relevant ADES picked according to data sources. Each step’s job will then gradually be monitored from the
remote ADES until completion, and upon successful result, the EMS will retrieve the data references to
pass it down to the following step. When the complete chain succeeds, the final results of the last step will be
provided as Workflow
output as for atomic processes. In case of failure, the error will be indicated in the log
with the appropriate step and message where the error occurred.
Note
Although chaining sub-workflow(s) within a bigger scoped workflow is technically possible, this have not yet been fully explored (tested) in Weaver. There is a chance that Data-Source resolution fails to identify where to dispatch the step in this situation. If this impacts you, please vote and indicate your concern on issue #171.
Remote Provider¶
Remote provider correspond to a remote service that provides similar interfaces as supported by Weaver (WPS-like). For example, a remote WPS-1 XML endpoint can be referenced as a provider. When an API Providers-scoped request is executed, for example to list is processes capabilities (see GetCapabilities), Weaver will send the corresponding request using the registered reference URL to access the remote server and reply with parsed response, as if they its processes were registered locally.
Since remote providers obviously require access to the remote service, Weaver will only be able to provide results if the service is accessible with respect to standard implementation features and supported specifications.
The main advantage of using Weaver’s endpoint rather than directly accessing the referenced remote provider processes is in the case of limited functionality offered by the service. For instance, WPS-1 do not always offer GetStatus feature, and there is no extensive job monitoring availability. Since Weaver wraps the original reference with its own endpoints, these features indirectly become employable. Similarly, although WPS-1 offer XML-only endpoints, the parsing operation accomplished by Weaver makes theses services available as WPS-REST JSON endpoints. On top of that, registering remote providers into Weaver allows the user to use it as a central hub to keep references to all his accessible services and dispatch jobs from a common location.
A remote provider differs from previously presented WPS-1/2 processes such that the underlying processes of the service are not registered locally. For example, if a remote service has two WPS processes, only top-level service URL will be registered locally (in Weaver’s database) and the application will have no explicit knowledge of these remote processes. When calling process-specific requests (e.g.: DescribeProcess or Execute), Weaver will re-send the corresponding request directly to the remote provider each time and return the result accordingly. On the other hand, a WPS-1/2 reference would be parsed and saved locally with the response at the time of deployment. This means that a deployed WPS-1/2 reference would act as a snapshot of the reference (which could become out-of-sync), while Remote Provider will dynamically update according to the re-fetched response from the remote service. If our example remote service was extended to have a third WPS process, it would immediately be reflected in GetCapabilities and DescribeProcess retrieved via Weaver Providers-scoped requests. This would not be the case for the WPS-1/2 reference that would need manual update (deploy the third process to register it in Weaver).
An example body of the register provider request could be as follows:
{
"id": "my-service",
"url": "https://example.com/wps",
"public": true
}
Then, processes of this registered remote-provider will be accessible. For example, if the referenced service by
the above URL add a WPS process identified by my-process
, its JSON description would be obtained with following
request (DescribeProviderProcess):
GET {WEAVER_URL}/providers/my-service/processes/my-process
Note
Process my-process
in the example is not registered locally. From the point of view of Weaver’s processes
(i.e.: route /processes/{id}
), it does NOT exist. You must absolutely use the provider-prefixed route
/providers/{id}/processes/{id}
to explicitly fetch and resolve this remote process definition.
Warning
API requests scoped under Providers are Weaver-specific implementation. These are not part of OGC API - Processes specification.
Managing processes included in Weaver ADES/EMS¶
Following steps represent the typical steps applied to deploy a process, execute it and retrieve the results.
Register a new process (Deploy)¶
Deployment of a new process is accomplished through the POST {WEAVER_URL}/processes
POST {WEAVER_URL}/processes
(Deploy) request.
The request body requires mainly two components:
processDescription
:Defines the process identifier, metadata, inputs, outputs, and some execution specifications. This mostly corresponds to information that corresponds to a traditional WPS definition.executionUnit
:Defines the core details of the Application Package. This corresponds to the explicit CWL definition that indicates how to execute the given application.
Upon deploy request, Weaver will either respond with a successful result, or with the appropriate error message, whether caused by conflicting ID, invalid definitions or other parsing issues. A successful process deployment will result in this process to become available for following steps.
Warning
When a process is deployed, it is not necessarily available immediately. This is because process visibility also
needs to be updated. The process must be made public to allow its discovery. For updating visibility, please
refer to the PUT {WEAVER_URL}/processes/{id}/visibility
(Visibility) request.
After deployment and visibility preconditions have been met, the corresponding process should become available through DescribeProcess requests and other routes that depend on an existing process.
Note that when a process is deployed using the WPS-REST interface, it also becomes available through the WPS-1/2 interface with the same identifier and definition. Because of compatibility limitations, some parameters in the WPS-1/2 might not be perfectly mapped to the equivalent or adjusted WPS-REST interface, although this concerns mostly only new features such as status monitoring. For most traditional use cases, properties are mapped between the two interfaces, but it is recommended to use the WPS-REST one because of the added features.
Access registered process(es) (GetCapabilities, DescribeProcess)¶
Available processes can all be listed using GET {WEAVER_URL}/processes
(GetCapabilities) request. This request will return all locally registered
process summaries. Other return formats and filters are also available according to provided request query parameters.
Note that processes not marked with public visibility will not be listed in this result.
For more specific process details, the GET {WEAVER_URL}/processes/{id}
(DescribeProcess) request should be used. This will return all information
that define the process references and expected inputs/outputs.
Note
For remote processes (see: Remote Provider), Provider requests are also available for more fine-grained
search of underlying processes. These processes are not necessarily listed as local processes, and will therefore
sometime not yield any result if using the typical DescribeProcess
endpoint.
All routes listed under Process requests should normally be applicable for remote processes by prefixing
them with /providers/{id}
.
Execution of a process (Execute)¶
Process execution (i.e.: submitting a Job) is accomplished using the POST {WEAVER_URL}/processes/{id}/jobs
(Execute) request. This section will
first describe the basics of this request format, and after go into details for specific use cases and parametrization
of various input/output combinations. Let’s employ the following example of JSON body sent to the Job execution
to better illustrate the requirements.
{
"mode": "async",
"response": "document",
"inputs": [
{
"id": "input-file",
"href": "<some-file-reference"
},
{
"id": "input-value",
"data": 1,
}
],
"outputs": [
{
"id": "output",
"transmissionMode": "reference"
}
]
}
Basic Details¶
The first field is mode
, it basically tells whether to run the Process in a blocking (sync
) or
non-blocking (async
) manner. Note that support is currently limited for mode sync
as this use case is often more
cumbersome than async
execution. Effectively, sync
mode requires to have a task worker executor available
to run the Job (otherwise it fails immediately due to lack of processing resource), and the requester must wait
for the whole execution to complete to obtain the result. Given that Process could take a very long time to
complete, it is not practical to execute them in this manner and potentially have to wait hours to retrieve outputs.
Instead, the preferred and default approach is to request an async
Job execution. When doing so, Weaver
will add this to a task queue for processing, and will immediately return a Job identifier and location where
the user can probe for its status, using GetStatus monitoring request. As soon as any task worker becomes available,
it will pick any leftover queued Job to execute it.
The second field is response
. At the time being, Weaver only supports document
value. This parameter is
present only for compatibility with other ADES implementation, but does not actually affects Weaver’s
response.
Following are the inputs
definition. This is the most important section of the request body. It defines which
parameters to forward to the referenced Process to be executed. All id
elements in this Job request
body must correspond to valid inputs
from the definition returned by DescribeProcess response. Obviously, all
formatting requirements (i.e.: proper file MIME-types), data types (e.g.: int
, string
, etc.) and
validations rules (e.g.: minOccurs
, AllowedValues
, etc.) must also be fulfilled. When providing files as input,
multiple protocols are supported. See later section File Reference Types for details.
Finally, the outputs
section defines, for each id
corresponding to the Process definition, how to
report the produced outputs from a successful Job completion. Again, Weaver only implement the
reference
result for the time being as this is the most common variation. In this case, the produced file is
stored locally and exposed externally with returned reference URL. The other (unimplemented) mode value
would
return the contents directly in the response instead of the URL.
Note
Other parameters can be added to the request to provide further functionalities. Above fields are the minimum requirements to request a Job. Please refer to the OpenAPI Execute definition for all applicable features.
Note
Since most of the time, returned files are not human readable or are simply too large to be displayed, the
transmissionMode: value
is rarely employed. Also, it is to be noted that outputs representing LiteralData
(which is even more uncommon) would automatically be represented as value
without explicitly requesting it,
as there would not be any file to return. If this poses problem or you encounter a valid use-case where value
would be useful for your needs, please submit a new issue to request the feature.
Execution Steps¶
Once the Job is submitted, its status should initially switch to accepted
. This effectively means that the
Job is pending execution (task queued), but is not yet executing. When a worker retrieves it for execution, the
status will change to started
for preparation steps (i.e.: allocation resources, retrieving required
parametrization details, etc.), followed by running
when effectively reaching the execution step of the underlying
Application Package operation. This status will remain as such until the operation completes, either with
succeeded
or failed
status.
At any moment during async
execution, the Job status can be requested using GET {WEAVER_URL}/processes/{id}/jobs/{id}
(GetStatus). Note that
depending on the timing at which the user executes this request and the availability of task workers, it could be
possible that the Job be already in running
state, or even failed
in case of early problem detected.
When the Job reaches its final state, multiple parameters will be adjusted in the status response to indicate its completion, notably the completed percentage, time it finished execution and full duration. At that moment, the requests for retrieving either error details or produced outputs become accessible. Examples are presented in GetResult section.
Process Operations¶
Todo
detail ‘operations’ accomplished (stage-in, exec-cwl, stage-out)
Workflow Operations¶
Todo
same as prev + ‘operations’ (deploy based on data-source, visibility, exec-remote for each step, pull-result)
File Reference Types¶
Most inputs can be categorized into two of the most commonly employed types, namely LiteralData
and ComplexData
.
The former represents basic values such as integers or strings, while the other represents a file reference.
Files in Weaver (and WPS in general) can be specified with any formats
as MIME-type.
As for standard WPS, remote file references are usually limited to http(s)
scheme, unless the process
takes an input string and parses the unusual reference from the literal data to process it by itself. On the other hand,
Weaver supports all following reference schemes.
http(s)://
file://
opensearchfile://
[experimental]s3://
[experimental]
The method in which Weaver will handle such references depends on its configuration, in other words, whether it is running as ADES or EMS (see: Configuration), as well as depending on some other CWL package requirements. These use-cases are described below.
Warning
Missing schemes in URL reference are considered identical as if file://
was used. In most cases, if not always,
an execution request should not employ this scheme unless the file is ensured to be at the specific location where
the running Weaver application can find it. This scheme is usually only employed as byproduct of the fetch
operation that Weaver uses to provide the file locally to underlying CWL application package to be
executed.
When Weaver is able to figure out that the process needs to be executed locally in ADES mode, it will fetch all necessary files prior to process execution in order to make them available to the CWL package. When Weaver is in EMS configuration, it will always forward remote references (regardless of scheme) exactly as provided as input of the process execution request, since it assumes it needs to dispatch the execution to another ADES remote server, and therefore only needs to verify that the file reference is reachable remotely. In this case, it becomes the responsibility of this remote instance to handle the reference appropriately. This also avoids potential problems such as if Weaver as EMS doesn’t have authorized access to a link that only the target ADES would have access to.
When CWL package defines WPS1Requirement
under hints
for corresponding WPS-1/2 remote processes being
monitored by Weaver, it will skip fetching of http(s)
-based references since that would otherwise lead to useless
double downloads (one on Weaver and the other on the WPS side). It is the same in case of
ESGF-CWTRequirement
employed for ESGF-CWT processes. Because these processes do not always support S3
buckets, and because Weaver supports many variants of S3 reference formats, it will first fetch the S3
reference using its internal AWS Configuration, and then expose this downloaded file as https(s)
reference
accessible by the remote WPS process.
Note
When Weaver is fetching remote files with http(s)://
, it can take advantage of additional request options to
support unusual or server-specific handling of remote reference as necessary. This could be employed for instance
to attribute access permissions only to some given ADES server by providing additional authorization tokens
to the requests. Please refer to Configuration of Request Options for this matter.
When using S3 references, Weaver will attempt to retrieve the file using server AWS Configuration and AWS Credentials. Provided that the corresponding S3 bucket can be accessed by the running Weaver application, it will fetch the file and store it locally temporarily for CWL execution.
Note
When using S3 buckets, authorization are handled through typical AWS credentials and role permissions. This means that AWS access must be granted to the application in order to allow it fetching the file. There are also different formats of S3 reference formats handled by Weaver. Please refer to Configuration of AWS S3 Buckets for more details.
When using OpenSearch references, additional parameters are necessary to handle retrieval of specific file URL. Please refer to OpenSearch Data Source for more details.
Following table summarize the default behaviour of input file reference handling of different situations when received as input argument of process execution. For simplification, keyword <any> is used to indicate that any other value in the corresponding column can be substituted for a given row when applied with conditions of other columns, which results to same operational behaviour. Elements that behave similarly are also presented together in rows to reduce displayed combinations.
Configuration |
Process Type |
File Scheme |
Applied Operation |
---|---|---|---|
<any> |
<any> |
|
Query and re-process 1 |
|
Convert to |
||
|
Nothing (unmodified) |
||
|
Fetch and convert to |
||
|
Nothing (file already local) |
||
|
Fetch and convert to |
||
|
|||
|
Convert to |
||
|
Nothing (unmodified, step will handle it) |
||
|
|||
|
Convert to |
||
|
Nothing (unmodified) |
||
|
Fetch and convert to |
||
|
Nothing (unmodified) |
||
|
Fetch and convert to |
||
|
Convert to |
||
|
Nothing (unmodified, step will handle it) |
||
|
Footnotes
- 1
References defined by
opensearch://
will trigger an OpenSearch query using the provided URL as well as other input additional parameters (see OpenSearch Data Source). After processing of this query, retrieved file references will be re-processed using the summarized logic in the table for the given use case.- 2(1,2,3,4,5)
When a
file://
(or empty scheme) maps to a local file that needs to be exposed externally for another remote process, the conversion tohttp(s)://
scheme employs settingweaver.wps_output_url
to form the result URL reference. The file is placed inweaver.wps_output_dir
to expose it as HTTP(S) endpoint. Note that the HTTP(S) servicing of the file is not handled by Weaver itself. It is assumed that the server where Weaver is hosted or another service takes care of this task.- 3(1,2,3,4)
When the process refers to a remote WPS-REST process (i.e.: remote WPS instance that supports REST bindings but that is not necessarily an ADES), Weaver simply wraps and monitors its remote execution, therefore files are handled just as for any other type of remote WPS-like servers. When the process contains an actual CWL Application Package that defines a
CommandLineTool
class (including applications with Docker image requirement), files are fetched as it will be executed locally. See CWL CommandLineTool, WPS-REST and Remote Providers for further details.- 4(1,2)
When an
s3://
file is fetched, is gets downloaded to a temporaryfile://
location, which is NOT necessarily exposed ashttp(s)://
. If execution is transferred to a remove process that is expected to not support S3 references, only then the file gets converted as in 2.- 5(1,2)
Workflows are only available on EMS and HYBRID instances. Since they chain processes, no fetch is needed as the sub-step process will do it instead as needed. See Workflow process as well as CWL Workflow for more details.
Todo
method to indicate explicit fetch to override these? (https://github.com/crim-ca/weaver/issues/183)
Todo
add tests that validate each combination of operation
OpenSearch Data Source¶
In order to provide OpenSearch query results as input to Process for execution, the
corresponding Deploy request body must be provided with additionalParameters
in order to indicate
how to interpret any specified metadata. The appropriate OpenSearch queries can then be applied
prior the execution to retrieve the explicit file reference(s) of EOImage elements that have
been found and to be submitted to the Job.
Depending on the desired context (application or per-input) over which the AOI, TOI, EOImage and multiple other metadata search filters are to be applied, their definition can be provided in the following locations within the Deploy body.
Context |
Location |
Role |
---|---|---|
Application |
|
|
Input |
|
|
The distinction between application or per-input contexts is entirely dependent of whatever is the intended processing operation of the underlying Process, which is why they must be defined by the user deploying the process since there is no way for Weaver to automatically infer how to employ provided search parameters.
In each case, the structure of additionalParameters
should be similar to the following definition:
{
"additionalParameters": [
{
"role": "http://www.opengis.net/eoc/applicationContext/inputMetadata",
"parameters": [
{
"name": "EOImage",
"values": [
"true"
]
},
{
"name": "AllowedCollections",
"values": "s2-collection-1,s2-collection-2,s2-sentinel2,s2-landsat8"
}
]
}
]
}
In each case, it is also expected that the role
should correspond to the location where the definition is provided
accordingly to their context from the above table.
For each deployment, processes using EOImage to be processed into OpenSearch query results can interpret the following field definitions for mapping against respective inputs or application context.
Name |
Values |
Context |
Description |
---|---|---|---|
|
|
Input |
Indicates that the nested parameters within the current |
|
String of comma-separated list of collection IDs. |
Input (same one as |
Provides a subset of collection identifiers that are supported. During execution any specified input not respecting one of the defined values will fail OpenSearch query resolution. |
|
|
Input (other one than |
String with the relevant OpenSearch query filter name according to the described input.
Defines a given Process input |
|
|
Application |
Indicates that provided |
|
|
Application |
Indicates that provided |
When an EOImage is detected for a given Process, any submitted Job execution will expect the
defined inputs in the Process description to indicate which images to retrieve for the application. Using
inputs defined with corresponding CatalogSearchField
filters, a specific OpenSearch query will be sent to
obtain the relevant images. The inputs corresponding to search fields will then be discarded following
OpenSearch resolution. The resolved link(s) for to EOImage will be substituted within the id
of the
input where EOImage
was specified and will be forwarded to the underlying Application Package for execution.
Note
Collection identifiers are mapped against URL endpoints defined in configuration to execute the appropriate OpenSearch requests. See Configuration of Data Sources for more details.
See also
Definitions in OpenSearch Deploy request body provides a more detailed example of the expected structure and
relevant additionalParameters
locations.
See also
Definitions in OpenSearch Examples providing different combinations of inputs, notably for using distinct
AOI, term:TOI and collections, with or without UniqueAOI
and UniqueTOI
specifiers.
Multiple Outputs¶
Although CWL allows output arrays, WPS does not support it directly, as only single values are allowed for WPS outputs according to original specification. To work around this, Metalink files can be used to provide a single output reference that embeds other references. This approach is also employed and preferred as described in PyWPS Multiple Outputs.
Todo
fix doc when Multiple Output is supported with metalink (https://github.com/crim-ca/weaver/issues/25)
Todo
add example of multi-output process definition
Todo
and how CWL maps them with WPS
Warning
This feature is being worked on (Weaver Issue #25). Direct support between
See also
Email Notification¶
When submitting a job for execution, it is possible to provide the notification_email
field.
Doing so will tell Weaver to send an email to the specified address with successful or failure details upon job
completion. The format of the email is configurable from weaver.ini.example file with email-specific settings
(see: Configuration).
Monitoring of a process (GetStatus)¶
Todo
job status body example (success vs fail)
Obtaining output results, logs or errors¶
In the case of successful Job execution, the outputs can be retrieved with GET {WEAVER_URL}/processes/{id}/jobs/{id}/result
(GetResult) request to list
each corresponding output id
with the generated file reference URL. Keep in mind that those URL’s purpose are
only to fetch the results (not persistent storage), and could therefore be purged after some reasonable amount of time.
The format should be similar to the following example, with minor variations according to Configurations:
{
"outputs": [
{
"id": "output",
"href": "{WEAVER_URL}/wpsoutputs/f93a15be-6e16-11ea-b667-08002752172a/output_netcdf.nc"
}
]
}
In situations where the Job resulted into failed
status, the GET {WEAVER_URL}/processes/{id}/jobs/{id}/exceptions
(GetLogs) can be use to retrieve
the potential cause of failure, by capturing any raised exception. Below is an example of such exception details.
[
"builtins.Exception: Could not read status document after 5 retries. Giving up."
]
The returned exception are often better understood when compared against, or in conjunction with, the logs that provide details over each step of the operation.
Any Job executed by Weaver will provide minimal information log, such as operation setup, the moment when it started execution and latest status. The extent of other log entries will more often than not depend on the verbosity of the underlying process being executed. When executing an Application Package, Weaver tries as best as possible to collect standard output and error steams to report them through log and exception lists.
Since Weaver can only report as much details as provided by the running application, it is recommended by
Application Package implementers to provide progressive status updates when developing their package
in order to help understand problematic steps in event of process execution failures. In the case of remote WPS
processes monitored by Weaver for example, this means gradually reporting process status updates
(e.g.: calling WPSResponse.update_status
if you are using |pywps|_, see: Progress and Status Report), while using print
and/or logging
operation for scripts or Docker images executed through CWL CommandLineTool
.
Note
Job logs and exceptions are a Weaver-specific implementation. They are not part of traditional OGC API - Processes.
A minimalistic example of logging output is presented below. This can be retrieved using GET {WEAVER_URL}/processes/{id}/jobs/{id}/logs
(GetLogs) request, at any
moment during Job execution (with logs up to that point in time) or after its completion (for full output).
Note again that the more the Process is verbose, the more tracking will be provided here.
[
"[2020-03-24 21:32:32] INFO [weaver.datatype.Job] 0:00:00 1% accepted Job task setup completed.",
"[2020-03-24 21:32:32] INFO [weaver.datatype.Job] 0:00:00 2% accepted Execute WPS request for process [jsonarray2netcdf]",
"[2020-03-24 21:32:33] INFO [weaver.datatype.Job] 0:00:01 4% accepted Fetching job input definitions.",
"[2020-03-24 21:32:33] INFO [weaver.datatype.Job] 0:00:01 6% accepted Fetching job output definitions.",
"[2020-03-24 21:32:33] INFO [weaver.datatype.Job] 0:00:01 8% accepted Starting job process execution",
"[2020-03-24 21:32:34] INFO [weaver.datatype.Job] 0:00:01 10% accepted Verifying job status location.",
"[2020-03-24 21:32:34] WARNING [weaver.datatype.Job] 0:00:01 10% accepted WPS status location could not be found",
"[2020-03-24 21:32:34] INFO [weaver.datatype.Job] 0:00:01 20% running Starting monitoring of job execution.",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:34] INFO [wps_package.jsonarray2netcdf] 1% running Preparing package logs done.",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:34] INFO [wps_package.jsonarray2netcdf] 2% running Launching package...",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:34] INFO [cwltool] Resolved '/tmp/tmpse3pi1gj/jsonarray2netcdf' to 'file:///tmp/tmpse3pi1gj/jsonarray2netcdf'",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:34] INFO [cwltool] ../../../../../tmp/tmpse3pi1gj/jsonarray2netcdf:1:1: Unknown hint",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded file:///tmp/tmpse3pi1gj/BuiltinRequirement",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:34] INFO [wps_package.jsonarray2netcdf] 5% running Loading package content done.",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:34] INFO [wps_package.jsonarray2netcdf] 6% running Retrieve package inputs done.",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:34] INFO [wps_package.jsonarray2netcdf] 8% running Convert package inputs done.",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:34] INFO [wps_package.jsonarray2netcdf] 10% running Running package...",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:34] INFO [cwltool] [job jsonarray2netcdf] /tmp/tmpqy1t8dp3$ python \\",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded /opt/weaver/processes/builtin/jsonarray2netcdf.py \\",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded -o \\",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded /tmp/tmpqy1t8dp3 \\",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded -i \\",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded /tmp/tmpla2utn2c/stgb5787338-4a34-4771-88c0-cae95f4d82dd/test_nc_array.json",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:41] INFO [cwltool] [job jsonarray2netcdf] Max memory used: 36MiB",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:41] INFO [cwltool] [job jsonarray2netcdf] completed success",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:32:41] INFO [wps_package.jsonarray2netcdf] 95% running Package execution done.",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:33:53] INFO [wps_package.jsonarray2netcdf] 98% running Generate package outputs done.",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded [2020-03-24 17:33:55] INFO [wps_package.jsonarray2netcdf] 100% succeeded Package complete.",
"[2020-03-24 21:33:59] INFO [weaver.datatype.Job] 0:01:26 90% succeeded Job succeeded (status: Package complete.).",
"[2020-03-24 21:34:45] INFO [weaver.datatype.Job] 0:01:26 90% succeeded Job succeeded.",
"[2020-03-24 21:34:45] INFO [weaver.datatype.Job] 0:01:26 100% succeeded Job task complete."
]
Special Weaver EMS use-cases¶
This section highlight the additional behaviour available only through an EMS-configured Weaver instance. Some other points are already described in other sections, but are briefly indicated here for conciseness.
ADES dispatching using Data-Sources¶
Todo
add details, data-source defines where to send request of known ADES
Todo
reference config weaver.data_sources
Application Package¶
The Application Package defines the internal script definition and configuration that will be executed by a Process. This package is based on Common Workflow Language (CWL). Using the extensive CWL Specification as backbone for internal execution of the process allows it to run multiple type of applications, whether they are referenced to by Docker image, scripts (bash, python, etc.), some remote Process and more.
Note
The large community and use cases covered by CWL makes it extremely versatile. If you encounter any issue running your Application Package in Weaver (such as file permissions for example), chances are that there exists a workaround somewhere in the CWL Specification. Most typical problems are usually handled by some flag or argument in the CWL definition, so this reference should be explored first. Please also refer to FAQ section as well as existing Weaver issues. Ultimately if no solution can be found, open an new issue about your specific problem.
All processes deployed locally into Weaver using a CWL package definition will have their full package
definition available with GET {WEAVER_URL}/processes/{id}/package
(Package) request.
Note
The package request is a Weaver-specific implementation, and therefore, is not necessarily available on other ADES/EMS implementation as this feature is not part of OGC API - Processes specification.
Typical CWL Package Definition¶
CWL CommandLineTool¶
Following CWL package definition represents the weaver.processes.builtin.jsonarray2netcdf
process.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
# target the installed python pointing to weaver conda env to allow imports
baseCommand: python
arguments:
- "${WEAVER_ROOT_DIR}/weaver/processes/builtin/jsonarray2netcdf.py"
- "-o"
- "$(runtime.outdir)"
inputs:
input:
type: File
format: iana:application/json
inputBinding:
position: 1
prefix: "-i"
outputs:
output:
format: edam:format_3650
type:
type: array
items: File
outputBinding:
glob: "*.nc"
$namespaces:
iana: "https://www.iana.org/assignments/media-types/"
edam: "http://edamontology.org/"
|
The first main components is the class: CommandLineTool
that tells Weaver it will be a base process
(contrarily to CWL Workflow presented later).
The other important sections are inputs
and outputs
. These define which parameters will be expected and
produced by the described application. Weaver supports most formats and types as specified by CWL Specification.
See Inputs/Outputs Type for more details.
CWL Workflow¶
Weaver also supports CWL class: Workflow
. When an Application Package is defined this way, the
Process deployment operation will attempt to resolve each step
as another process. The reference to the CWL
definition can be placed in any location supported as for the case of atomic processes
(see details about supported package locations).
The following CWL definition demonstrates an example Workflow
process that would resolve each step
with
local processes of match IDs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | {
"cwlVersion": "v1.0",
"class": "Workflow",
"requirements": [
{
"class": "StepInputExpressionRequirement"
}
],
"inputs": {
"tasmax": {
"type": {
"type": "array",
"items": "File"
}
},
"lat0": "float",
"lat1": "float",
"lon0": "float",
"lon1": "float",
"freq": {
"default": "YS",
"type": {
"type": "enum",
"symbols": ["YS", "MS", "QS-DEC", "AS-JUL"]
}
}
},
"outputs": {
"output": {
"type": "File",
"outputSource": "ice_days/output_netcdf"
}
},
"steps": {
"subset": {
"run": "ColibriFlyingpigeon_SubsetBbox.cwl",
"in": {
"resource": "tasmax",
"lat0": "lat0",
"lat1": "lat1",
"lon0": "lon0",
"lon1": "lon1"
},
"out": ["output"]
},
"json2nc": {
"run": "jsonarray2netcdf",
"in": {
"input": "subset/output"
},
"out": ["output"]
},
"ice_days": {
"run": "Finch_IceDays.cwl",
"in": {
"tasmax": "json2nc/output",
"freq": "freq"
},
"out": ["output_netcdf"]
}
}
}
|
For instance, the jsonarray2netcdf
(Builtin) middle step in this example corresponds to the
CWL CommandLineTool process presented in previous section. Other processes referenced in this Workflow
can be
found in Weaver Test Resources.
Steps processes names are resolved using the variations presented below. Important care also needs to be given to inputs and outputs definitions between each step.
Step Reference¶
In order to resolve referenced processes as steps, Weaver supports 3 formats.
- Process ID explicitly given.Any visible process from
GET {WEAVER_URL}/processes
(GetCapabilities) response should be resolved this way.(e.g.:jsonarray2netcdf
resolves to pre-deployedweaver.processes.builtin.jsonarray2netcdf
). Full URL to the process description endpoint, provided that it also offers a
GET {WEAVER_URL}/processes/{id}/package
(Package) endpoint (Weaver-specific).Full URL to the explicit CWL file (usually corresponding to (2) or the
href
provided in deployment body).
When an URL to the CWL process “file” is provided with an extension, it must be one of the supported values
defined in weaver.processes.wps_package.PACKAGE_EXTENSIONS
. Otherwise, Weaver will refuse it as it cannot
figure out how to parse it.
Because Weaver and the underlying CWL executor need to resolve all steps in order to validate their input and
output definitions correspond (id, format, type, etc.) in order to chain them, all intermediate processes MUST
be available. This means that you cannot Register a new process (Deploy) nor Execution of a process (Execute) a Workflow
-flavored
Application Package until all referenced steps have themselves been deployed and made visible.
Warning
Because Weaver needs to convert given CWL documents into equivalent WPS process definition,
embedded CWL processes within a Workflow
step are not supported currently. This is a known limitation
of the implementation, but not much can be done against it without major modifications to the code base.
See also issue #56.
See also
Step Inputs/Outputs¶
Inputs and outputs of connected steps are required to match types and formats in order for the workflow to be valid.
This means that a process that produces an output of type String
cannot be directly chained to a process that takes
as input a File
, even if the String
of the first process represents an URL that could be resolved to a valid
file reference. In order to chain two such processes, an intermediate operation would need to be defined to explicitly
convert the String
input to the corresponding File
output. This is usually accomplished using Builtin
processes, such as in the previous example.
Since formats must also match (e.g.: a process producing application/json
cannot be mapped to one producing
application/x-netcdf
), all mismatching formats must also be converted with an intermediate step if such operation
is desired. This ensures that workflow definitions are always explicit and that as little interpretation, variation or
assumptions are possible between each execution. Because of this, all application generated by Weaver will attempt to
preserve and enforce matching input/output format
definition in both CWL and WPS as long as it does
not introduce ambiguous results (see File Format for more details).
Correspondence between CWL and WPS fields¶
Because CWL definition and WPS process description inherently provide “duplicate” information, many fields can be mapped between one another. In order to handle any provided metadata in the various supported locations by both specifications, as well as to extend details of deployed processes, each Application Package get its details merged with complementary WPS description.
In some cases, complementary details are only documentation-related, but some information directly affect the format or
execution behaviour of some parameters. A common example is the maxOccurs
field provided by WPS that does
not have an exactly corresponding specification in CWL (any-sized array). On the other hand, CWL also
provides data preparation steps such as initial staging (i.e.: InitialWorkDirRequirement
) that doesn’t have an
equivalent under the WPS process description. For this reason, complementary details are merged and reflected
on both sides (as applicable), when non-ambiguous resolution is possible.
In case of conflicting metadata, the CWL specification will most of the time prevail over the WPS
metadata fields simply because it is expected that a strict CWL specification is provided upon deployment.
The only exceptions to this situation are when WPS specification help resolve some ambiguity or when
WPS enforces the parametrisation of some elements, such as with maxOccurs
field.
Note
Metadata merge operation between CWL and WPS is accomplished on per-mapped-field basis. In other
words, more explicit details such as maxOccurs
could be obtained from WPS and simultaneously the
same input’s format
could be obtained from the CWL side. Merge occurs bidirectionally for corresponding
information.
The merging strategy of process specifications also implies that some details can be omitted from one context if they
can be inferred from corresponding elements in the other. For example, the CWL and WPS context both
define keywords
(with minor naming variation) as a list of strings. Specifying this metadata in both locations
is redundant and only makes the process description longer. Therefore, the user is allowed to provide only one of the
two and Weaver will take care to propagate the information to the lacking location.
In order to help understand the resolution methodology between the contexts, following sub-section will cover supported mapping between the two specifications, and more specifically, how each field impacts the mapped equivalent metadata.
Warning
Merging of corresponding fields between CWL and WPS is a Weaver-specific implementation. The same behaviour is not necessarily supported by other implementations. For this reason, any converted information between the two contexts will be transferred to the other context if missing in order for both specification to reflect the similar details as closely as possible, wherever context the metadata originated from.
Inputs/Outputs ID¶
Inputs and outputs (I/O) id
from the CWL context will be respectively matched against corresponding
id
or identifier
field from I/O of WPS context. In the CWL definition, all of the allowed I/O
structures are supported, whether they are specified using an array list with explicit definitions, using “shortcut”
variant, or using key-value pairs (see CWL Mapping for more details). Regardless of array or mapping format,
CWL requires that all I/O have unique id
. On the WPS side, a list of I/O is always expected.
This is because WPS I/O with multiple values (array in CWL) are specified by repeating the id
with
each value instead of defining the value as a list of those values during Execution of a process (Execute) request (see also
Multiple Inputs).
To summarize, the following CWL and WPS I/O definitions are all equivalent and will result into the
same process definition after deployment. For simplification purpose, below examples omit all but mandatory fields
(only of the inputs
and outputs
portion of the full deployment body) to produce the same result.
Other fields are discussed afterward in specific sections.
|
|
|
The WPS example above requires a format
field for the corresponding CWL File
type in order to
distinguish it from a plain string. More details are available in Inputs/Outputs Type below about this requirement.
Finally, it is to be noted that above CWL and WPS definitions can be specified in the Register a new process (Deploy) request body with any of the following variations:
Both are simultaneously fully specified (valid although extremely verbose).
Both partially specified as long as sufficient complementary information is provided.
Only CWL I/O is fully provided (with empty or even unspecified
inputs
oroutputs
section from WPS).
Warning
Weaver assumes that its main purpose is to eventually execute an Application Package and will therefore
prioritize specification in CWL over WPS. Because of this, any unmatched id
from the WPS
context against provided CWL id
s of the same I/O section will be dropped, as they ultimately would
have no purpose during CWL execution.
This does not apply in the case of referenced WPS-1/2 processes since no CWL is available in the first place.
Inputs/Outputs Type¶
In the CWL context, the type
field indicates the type of I/O. Available types are presented in the
CWLType Symbols portion of the specification.
Warning
Weaver has two unsupported CWL type
, namely Any
and Directory
. This limitation is
intentional as WPS does not offer equivalents. Furthermore, both of these types make the process
description too ambiguous. For instance, most processes expect remote file references, and providing a
Directory
doesn’t indicate an explicit reference to which files to retrieve during stage-in operation of
a job execution.
In the WPS context, three data types exist, namely Literal
, BoundingBox
and Complex
data.
As presented in the example of the previous section, I/O in the WPS context does not require an explicit
indication of the type from one of Literal
, BoundingBox
and Complex
data. Instead, WPS type is
inferred using the matched API schema of the I/O. For instance, Complex
I/O (i.e.: file reference) requires the
formats
field to distinguish it from a plain string
. Therefore, specifying either format
in CWL
or formats
in WPS immediately provides all needed information for Weaver to understand that this I/O is
expected to be a file reference. A crs
field would otherwise indicate a BoundingBox
I/O
(see note). If none of the two previous schemas are matched, the I/O type resolution falls back
to Literal
data of string
type. To employ another primitive data type such as Integer
, an explicit
indication needs to be provided as follows.
1 2 3 4 5 6 | {
"id": "input",
"literalDataDomains": [
{"dataType": {"name": "integer"}}
]
}
|
Obviously, the equivalent CWL definition is simpler in this case (i.e.: only type: int
is required).
It is therefore recommended to take advantage of Weaver’s merging strategy in this case by providing only the
details through the CWL definition and have the corresponding WPS I/O type automatically deduced by
the generated process. If desired, literalDataDomains
can still be explicitly provided as above to ensure that
it gets parsed as intended type.
Note
As of the current version of Weaver, WPS data type BoundingBox
is not supported. The schema definition
exists in WPS context but is not handled by any CWL type conversion yet. This feature is reflected
by issue #51. It is possible to use a Literal
data of
type string
corresponding to WKT 1, 2 in the meantime.
File Format¶
An input or output resolved as CWL File
type, equivalent to a WPS ComplexData
, supports
format
specification. Every mimeType
field nested under formats
entries of the WPS definition
will be mapped against corresponding namespaced format
of CWL.
For example, the following input definitions are equivalent in both contexts.
|
|
As demonstrated, both contexts accept multiple formats for inputs. These effectively represent supported formats by
the underlying application. The two MIME-types selected for this example are chosen specifically to demonstrate
how CWL formats must be specified. More precisely, CWL requires a real schema definition referencing to
an existing ontology to validate formats, specified through the $namespaces
section. Each format entry is then
defined as a mapping of the appropriate namespace to the identifier of the ontology. Alternatively, you can also provide
the full URL of the ontology reference in the format string.
Like many other fields, this information can become quite rapidly redundant and difficult to maintain. For this reason,
Weaver will automatically fill the missing detail if only one of the two corresponding information between CWL
and WPS is provided. In other words, an application developer could only specify the I/O’s formats
in the WPS portion during process deployment, and Weaver will take care to update the matching CWL
definition without any user intervention. This makes it also easier for the user to specify supported formats since it
is generally easier to remember names of MIME-types than full ontology references. Weaver has a large set of
commonly employed MIME-types that it knows how to convert to corresponding ontologies. Also, Weaver will look
for new MIME-types it doesn’t explicitly know about onto either the IANA or the EDAM ontologies
in order to attempt automatically resolving them.
When formats are resolved between the two contexts, Weaver applies information in a complimentary fashion. This means
for example that if the user provided application/x-netcdf
on the WPS side and iana:application/json
on
the CWL side, both resulting contexts will have both of those formats combined. Weaver will not favour one
location over the other, but will rather merge them if they can be resolved into different and valid entities.
Since format
is a required field for WPS ComplexData
definitions (see Inputs/Outputs Type) and
that MIME-types are easier to provide in this context, it is recommended to provide all of them in the
WPS definition.
Output File Format¶
Although WPS definition allows multiple supported formats for output that are later resolved to the applied
one onto the produced result of the job, CWL only considers the output format
that directly indicates the
applied schema. There is no concept of supported format in the CWL world. This is simply because CWL
cannot predict nor reliably determine which output will be produced by a given application execution without running it,
and therefore cannot expose consistent output specification before running the process. Because CWL requires to
validate the full process integrity before it can be executed, this means that only a single output format is
permitted in its context (providing many will raise a validation error when parsing the CWL definition).
To ensure compatibility with multiple supported formats outputs of WPS, any output that has more that one
format will have its format
field dropped in the corresponding CWL definition. Without any format
on
the CWL side, the validation process will ignore this specification and will effectively accept any type of
file. This will not break any execution operation with CWL, but it will remove the additional validation layer
of the format (which especially deteriorates process resolution when chaining processes inside a CWL Workflow).
If the WPS output only specifies a single MIME-type, then the equivalent format (after being resolved to a valid ontology) will be preserved on the CWL side since the result is ensured to be the unique one provided. For this reason, processes with specific single-format output are be preferred whenever possible. This also removes ambiguity in the expected output format, which usually requires a toggle input specifying the desired type for processes providing a multi-format output. It is instead recommended to produce multiple processes with a fixed output format for each case.
Allowed Values¶
Allowed values in the context of WPS LiteralData
provides a mean for the application developer to restrict
inputs to a specific set of values. In CWL, the same can be achieved using an enum
definition. Therefore,
the following two variants are equivalent and completely interchangeable.
|
|
Weaver will ensure to propagate such definitions bidirectionally in order to update the CWL or WPS
correspondingly with the provided information in the other context if missing. The primitive type to apply to a missing
WPS specification when resolving it from a CWL definition is automatically inferred with the best
matching type from provided values in the enum
list.
Note that enum
such as these will also be applied on top of Multiple and Optional Values definitions
presented next.
Multiple and Optional Values¶
Inputs that take multiple values or references can be specified using minOccurs
and maxOccurs
in WPS
context, while they are specified using the array
type in CWL. While the same minOccurs
parameter with a
value of zero (0
) can be employed to indicate an optional input, CWL requires the type to specify null
or to use the shortcut ?
character suffixed to the base type to indicate optional input. Resolution between
WPS and CWL for the merging strategy implies all corresponding parameter combinations and checks in
this case.
Because CWL does not take an explicit amount of maximum occurrences, information in this case are not
necessarily completely interchangeable. In fact, WPS is slightly more verbose and easier to define in this case
than CWL because all details are contained within the same two parameters. Because of this, it is often
preferable to provide the minOccurs
and maxOccurs
in the WPS context, and let Weaver infer the
array
and/or null
type requirements automatically. Also, because of all implied parameters in this situation to
specify the similar details, it is important to avoid providing contradicting specifications as Weaver will have
trouble guessing the intended result when merging specifications. If unambiguous guess can be made, CWL will be
employed as deciding definition to resolve erroneous mismatches (as for any other corresponding fields).
Todo
update warning according to Weaver issue #25
Warning
Parameters minOccurs
and maxOccurs
are not permitted for outputs in the WPS context. Native
WPS therefore does not permit multiple output reference files. This can be worked around using a
Metalink file, but this use case is not covered by Weaver yet as it requires special mapping with CWL
that does support array
type as output (see issue #25).
Note
Although WPS multi-value inputs are defined as a single entity during deployment, special care must be taken to the format in which to specify these values during execution. Please refer to Multiple Inputs section of Execution of a process (Execute) request.
Following are a few examples of equivalent WPS and CWL definitions to represent multiple values under a given input. Some parts of the following definitions are purposely omitted to better highlight the concise details of multiple and optional information.
|
|
Todo
minOccurs/maxOccurs + array + WPS repeats IDs vs CWL as list
Todo
example multi-value + enum
It can be noted from the examples that minOccurs
and maxOccurs
can be either an integer
or a string
representing one. This is to support backward compatibility of older WPS specification that always employed
strings although representing numbers. Weaver understands and handles both cases. Also, maxOccurs
can have the
special string value "unbounded"
, in which case the input is considered to be allowed an unlimited amount if
entries (although often capped by another implicit machine-level limitation such as memory capacity). In the case of
CWL, an array
is always considered as unbounded, therefore WPS is the only context that can limit
this amount.
Metadata¶
Todo
(s:)keywords field, doc/label vs abstract/title per-I/O and overall process, etc?
Example: cwl-metadata
Process and Application Package Examples¶
The principal source of examples can be found directly within Weaver functional tests. Most Process listed
in this repository employ an Application Package defined using a locally provided CWL. Some other
cases will refer to pre-deployed WPS processes. Refer to corresponding Deploy request payloads,
also provided in that location, that will indicate the kind of Process definition employed through their
executionUnit
specification. Once successfully deployed on a ADES or EMS, the also provided
Execute request body can be employed as format reference to run the operation (input values can be modified).
The general naming convention is:
DeployProcess_<PROCESS_ID>.json
for the Deploy request payload.
Execute_<PROCESS_ID>.json
for the Execute request payload.
<PROCESS_ID>.cwl
for the CWL Application Package when applicable.
Note
There can be minor variations (camel/snake case, upper/lower case) of the exact <PROCESS_ID>
employed in the
file names according to the different reference repositories.
Further examples are also available following OGC Testbeds developments. The produced applications in this case can be found in OGC-Testbeds Applications. In that repository, the above naming convention will sometime be employed, but each Process is contained within its own sub-directory. Another naming conversion is sometime used, although the files provide equivalent details:
<PROCESS_ID>/deploy.json
for the Deploy request payload.
<PROCESS_ID>/execute.json
for the Execute request payload.
<PROCESS_ID>/package.cwl
for the CWL Application Package when applicable.
OpenAPI Specification¶
API Reference¶
This page contains auto-generated API reference documentation 1.
weaver
¶
Subpackages¶
weaver.database
¶
weaver.database.base
¶-
class
weaver.database.base.
DatabaseInterface
(_)[source]¶ Return the unique identifier of db type matching settings.
-
static
_get_store_type
(store_type: StoreSelector) → str[source]¶
-
abstract
reset_store
(self: StoreSelector, store_type) → None[source]¶
-
static
weaver.database.mongodb
¶-
class
weaver.database.mongodb.
MongoDatabase
(container)[source]¶ Return the unique identifier of db type matching settings.
-
get_store
(self: Union[str, Type[weaver.store.base.StoreInterface], AnyMongodbStoreType], store_type: Any, *store_args: Any, **store_kwargs) → AnyMongodbStore[source]¶ Retrieve a store from the database.
- Parameters
store_type – type of the store to retrieve/create.
store_args – additional arguments to pass down to the store.
store_kwargs – additional keyword arguments to pass down to the store.
-
-
weaver.database.
get_db
(container: weaver.typedefs.AnySettingsContainer, reset_connection: bool = False) → mongodb.MongoDatabase[source]¶ Obtains the database connection from configured application settings.
If
reset_connection
isTrue
, thecontainer
must be the applicationRegistry
or any container that can retrieve it to accomplish reference reset. Otherwise, any settings container can be provided.
weaver.processes
¶
weaver.processes.builtin
¶weaver.processes.builtin.file2string_array
¶weaver.processes.builtin.jsonarray2netcdf
¶-
weaver.processes.builtin.
register_builtin_processes
(container: weaver.typedefs.AnySettingsContainer) → None[source]¶ Registers every
builtin
CWL package to the processes database.CWL definitions must be located within the
weaver.processes.builtin
module.
weaver.processes.constants
¶weaver.processes.convert
¶-
weaver.processes.convert.
WPS_FIELD_FORMAT
= ['formats', 'supported_formats', 'supported_values', 'default'][source]¶
-
weaver.processes.convert.
complex2json
(data: Union[owslib.wps.ComplexData, Any]) → Union[weaver.typedefs.JSON, Any][source]¶ Obtains the JSON representation of a
ComplexData
or simply return the unmatched type.
-
weaver.processes.convert.
metadata2json
(meta: Union[ANY_Metadata_Type, Any], force: bool = False) → Union[weaver.typedefs.JSON, Any][source]¶ Retrieve metadata information and generate its JSON representation.
Obtains the JSON representation of a
OWS_Metadata
orpywps.app.Common.Metadata
. Otherwise, simply return the unmatched type. If requested, can enforce parsing a dictionary for the corresponding keys.
-
weaver.processes.convert.
ows2json_field
(ows_field: Union[owslib.wps.ComplexData, owslib.wps.Metadata, weaver.typedefs.AnyValueType]) → Union[weaver.typedefs.JSON, weaver.typedefs.AnyValueType][source]¶ Obtains the JSON or raw value from an
owslib.wps
I/O field.
-
weaver.processes.convert.
ows2json_io
(ows_io: OWS_IO_Type) → JSON_IO_Type[source]¶ Converts I/O definition from
owslib.wps
to JSON.
-
weaver.processes.convert.
ows2json_output_data
(output: owslib.wps.Output, process_description: owslib.wps.Process, container: Optional[weaver.typedefs.AnySettingsContainer] = None) → weaver.typedefs.JSON[source]¶ Utility method to convert an
owslib.wps
process execution output data (result) to JSON.In the case that a
reference
output of JSON content-type is specified and that it refers to a file that contains an array list of URL references to simulate a multiple-output, this specific output gets expanded to contain both the original URLreference
field and the loaded URL list underdata
field for easier access from the response body.Referenced file(s) are fetched in order to store them locally if executed on a remote process, such that they can become accessible as local job result for following reporting or use by other processes in a workflow chain.
If the
dataType
details is missing from the data output (depending on servers that might omit it), theprocess_description
is employed to retrieve the original description with expected result details.- Parameters
output – output with data value or reference according to expected result for the corresponding process.
process_description – definition of the process producing the specified output following execution.
container – container to retrieve application settings (for request options during file retrieval as needed).
- Returns
converted JSON result data and additional metadata as applicable based on data-type and content-type.
-
weaver.processes.convert.
_get_multi_json_references
(output: owslib.wps.Output, container: Optional[weaver.typedefs.AnySettingsContainer]) → Optional[List[weaver.typedefs.JSON]][source]¶ Obtains the JSON contents of a single output corresponding to multi-file references.
Since WPS standard does not allow to return multiple values for a single output, a lot of process actually return a JSON array containing references to these outputs.
Because the multi-output references are contained within this JSON file, it is not very convenient to retrieve the list of URLs as one always needs to open and read the file to get them. This function goal is to detect this particular format and expand the references to make them quickly available in the job output response.
- Returns
Array of HTTP(S) references if the specified output is effectively a JSON containing that,
None
otherwise.
-
weaver.processes.convert.
any2cwl_io
(wps_io: Union[JSON_IO_Type, WPS_IO_Type, OWS_IO_Type], io_select: str) → Tuple[CWL_IO_Type, Dict[str, str]][source]¶ Converts a WPS-like I/O to CWL corresponding I/O.
Because of CWL I/O of type File with format field, the applicable namespace is also returned.
- Returns
converted I/O and namespace dictionary with corresponding format references as required
-
weaver.processes.convert.
wps2cwl_requirement
(wps_service_url: Union[str, urllib.parse.ParseResult], wps_process_id: str) → weaver.typedefs.JSON[source]¶ Obtains the CWL requirements definition needed for parsing by a remote WPS provider as an Application Package.
-
weaver.processes.convert.
ows2json
(wps_process: owslib.wps.Process, wps_service_name: str, wps_service_url: Union[str, urllib.parse.ParseResult], wps_provider_name: Optional[str] = None) → Tuple[weaver.typedefs.CWL, weaver.typedefs.JSON][source]¶ Generates the CWL package and process definitions from a
owslib.wps.Process
hosted under WPS location.
-
weaver.processes.convert.
xml_wps2cwl
(wps_process_response: requests.models.Response, settings: weaver.typedefs.AnySettingsContainer) → Tuple[weaver.typedefs.CWL, weaver.typedefs.JSON][source]¶ Obtains the
CWL
definition that corresponds to a XML WPS-1 process.Converts a WPS-1 ProcessDescription XML tree structure to an equivalent WPS-3 Process JSON. and builds the associated CWL package in conformance to weaver.processes.wps_package.CWL_REQUIREMENT_APP_WPS1.
- Parameters
wps_process_response – valid response (XML, 200) from a WPS-1 ProcessDescription.
settings – application settings to retrieve additional request options.
-
weaver.processes.convert.
is_cwl_file_type
(io_info: CWL_IO_Type) → bool[source]¶ Identifies if the provided CWL input/output corresponds to one, many or potentially a
File
type(s).When multiple distinct atomic types are allowed for a given I/O (e.g.:
[string, File]
) and that one of them is aFile
, the result will beTrue
even if other types are notFiles
. PotentialFile
when other base type is"null"
will also returnTrue
.
-
weaver.processes.convert.
is_cwl_array_type
(io_info: CWL_IO_Type) → Tuple[bool, str, pywps.validator.mode.MODE, Union[pywps.inout.literaltypes.AnyValue, List[Any]]][source]¶ Verifies if the specified I/O corresponds to one of various CWL array type definitions.
- returns
tuple(is_array, io_type, io_mode, io_allow)
where: is_array
: specifies if the I/O is of array type.io_type
: array element type ifis_array
is True, type ofio_info
otherwise.io_mode
: validation mode to be applied if sub-element requires it, defaults toMODE.NONE
.io_allow
: validation values to be applied if sub-element requires it, defaults toAnyValue
.
- Raises
PackageTypeError – if the array element doesn’t have the required values and valid format.
- returns
-
weaver.processes.convert.
is_cwl_enum_type
(io_info: CWL_IO_Type) → Tuple[bool, str, int, Union[List[str], None]][source]¶ Verifies if the specified I/O corresponds to a CWL enum definition.
- returns
tuple(is_enum, io_type, io_allow)
where: is_enum
: specifies if the I/O is of enum type.io_type
: enum base type ifis_enum=True
, type ofio_info
otherwise.io_mode
: validation mode to be applied if input requires it, defaults toMODE.NONE
.io_allow
: validation values of the enum.
- Raises
PackageTypeError – if the enum doesn’t have the required parameters and valid format.
- returns
-
weaver.processes.convert.
get_cwl_io_type
(io_info: CWL_IO_Type) → Tuple[str, bool][source]¶ Obtains the basic type of the CWL input and identity if it is optional.
CWL allows multiple shorthand representation or combined types definition. The base type must be extracted in order to identify the expected data format and supported values.
Obtains real type if
"default"
or shorthand"<type>?"
was in CWL, which can also be defined as type["null", <type>]
.CWL allows multiple distinct types (e.g.:
string
andint
simultaneously), but not WPS inputs. WPS allows only different amount of same type throughminOccurs
andmaxOccurs
. Considering WPS conversion, we can also have following definition["null", <type>, <array-type>]
(same type). Whether single or array-like type, the base type can be extracted.- Parameters
io_info – definition of the CWL input.
- Returns
tuple of guessed base type and flag indicating if it can be null (optional input).
-
weaver.processes.convert.
cwl2wps_io
(io_info: CWL_IO_Type, io_select: str) → WPS_IO_Type[source]¶ Converts input/output parameters from CWL types to WPS types.
- Parameters
io_info – parsed IO of a CWL file
io_select –
WPS_INPUT
orWPS_OUTPUT
to specify desired WPS type conversion.
- Returns
corresponding IO in WPS format
-
weaver.processes.convert.
any2cwl_literal_datatype
(io_type: str) → Union[str, Type[weaver.utils.null]][source]¶ Solves common literal data-type names to supported ones for CWL.
-
weaver.processes.convert.
any2wps_literal_datatype
(io_type: weaver.typedefs.AnyValueType, is_value: bool) → Union[str, Type[weaver.utils.null]][source]¶ Solves common literal data-type names to supported ones for WPS.
Verification is accomplished by name when
is_value=False
, otherwise with pythontype
whenis_value=True
.
-
weaver.processes.convert.
any2json_literal_allowed_value
(io_allow: Union[pywps.inout.literaltypes.AllowedValue, weaver.typedefs.JSON, str, float, int, bool]) → Union[weaver.typedefs.JSON, str, str, float, int, bool, Type[weaver.utils.null]][source]¶ Converts an
AllowedValues
definition from different packages into standardized JSON representation of OGC-API.
-
weaver.processes.convert.
any2json_literal_data_domains
(io_info: ANY_IO_Type) → Union[Type[weaver.utils.null], List[weaver.typedefs.JSON]][source]¶ Extracts allowed value constrains from the input definition and generate the expected literal data domains.
The generated result, if applicable, corresponds to a list of a single instance of schema definition
weaver.wps_restapi.swagger_definitions.LiteralDataDomainList
with following structure.default: bool defaultValue: float, int, bool, str dataType: {name: string, <reference: url: string>} uom: string valueDefinition: oneOf: - string - url-string - {anyValue: bool} - [float, int, bool, str] - [{minimum, maximum, spacing, closure}]
-
weaver.processes.convert.
json2wps_datatype
(io_info: JSON_IO_Type) → str[source]¶ Converts a JSON input definition into the corresponding
pywps
parameters.Guesses the literal data-type from I/O JSON information in order to allow creation of the corresponding I/O WPS. Defaults to
string
if no suitable guess can be accomplished.
-
weaver.processes.convert.
json2wps_field
(field_info: JSON_IO_Type, field_category: str) → Any[source]¶ Converts an I/O field from a JSON literal data, list, or dictionary to corresponding WPS types.
- Parameters
field_info – literal data or information container describing the type to be generated.
field_category – one of
WPS_FIELD_MAPPING
keys to indicate how to parsefield_info
.
-
weaver.processes.convert.
json2wps_allowed_values
(io_info: JSON_IO_Type) → Union[Type[weaver.utils.null], List[pywps.inout.literaltypes.AllowedValue]][source]¶ Obtains the allowed values constrains for the literal data type from a JSON I/O definition.
Converts the
literalDataDomains
definition intoallowed_values
understood bypywps
. Handles explicitallowed_values
if available and not previously defined byliteralDataDomains
.See also
Function
any2json_literal_data_domains()
defines generatedliteralDataDomains
JSON definition.
-
weaver.processes.convert.
json2wps_io
(io_info: JSON_IO_Type, io_select: str) → WPS_IO_Type[source]¶ Converts an I/O from a JSON dict to PyWPS types.
- Parameters
io_info – I/O in JSON dict format.
io_select –
WPS_INPUT
orWPS_OUTPUT
to specify desired WPS type conversion.
- Returns
corresponding I/O in WPS format.
-
weaver.processes.convert.
wps2json_io
(io_wps: WPS_IO_Type) → JSON_IO_Type[source]¶ Converts a PyWPS I/O into a dictionary based version with keys corresponding to standard names (WPS 2.0).
-
weaver.processes.convert.
wps2json_job_payload
(wps_request: pywps.app.WPSRequest, wps_process: pywps.Process) → weaver.typedefs.JSON[source]¶ Converts the input and output values of a
pywps
WPSExecute
request to corresponding WPS-REST job.The inputs and outputs must be parsed from XML POST payload or KVP GET query parameters, and converted to data container defined by
pywps
based on the process definition.
-
weaver.processes.convert.
get_field
(io_object: Any, field: str, search_variations: bool = False, only_variations: bool = False, pop_found: bool = False, default: Any = null) → Any[source]¶ Gets a field by name from various I/O object types.
Default value is
null
used for most situations to differentiate from literalNone
which is often used as default for parameters. TheNullType
allows to explicitly tell that there was ‘no field’ and not ‘no value’ in existing field. If you provided another value, it will be returned if not found within the input object.When
search_variation
is enabled and thatfield
could not be found within the object, field lookup will employ the values under thefield
entry withinWPS_FIELD_MAPPING
as additional field names to search for an existing property or key. Search continues until the first match is found, respecting order within the variations listing, and finally usesdefault
if no match was found.- Parameters
io_object – Any I/O representation, either as a class instance or JSON container.
field – Name of the field to look for, either as property or key name based on input object type.
search_variations – If enabled, search for all variations to the field name to attempt search until matched.
only_variations – If enabled, skip the first ‘basic’ field and start search directly with field variations.
pop_found – If enabled, whenever a match is found by field or variations, remove that entry from the object.
default – Alternative default value to return if no match could be found.
- Returns
Matched value (including search variations if enabled), or
default
.
-
weaver.processes.convert.
set_field
(io_object: Union[ANY_IO_Type, ANY_Format_Type], field: str, value: Any, force: bool = False) → None[source]¶ Sets a field by name into various I/O object types.
Field value is set only if not
null
to avoid inserting data considered invalid. Ifforce=True
, verification ofnull
value is ignored.
-
weaver.processes.convert.
_are_different_and_set
(item1: Any, item2: Any) → bool[source]¶ Verifies if two items are set and are different of different “representative” value.
Compares two value representations and returns
True
only if both are notnull
, are of sametype
and of different representative value. By “representative”, we consider here the visual representation of byte/unicode strings rather than literal values to support XML/JSON and Python 2/3 implementations. Other non string-like types are verified with literal (usual) equality method.
-
weaver.processes.convert.
is_equal_formats
(format1: Union[pywps.inout.formats.Format, weaver.typedefs.JSON], format2: Union[pywps.inout.formats.Format, weaver.typedefs.JSON]) → bool[source]¶ Verifies for matching formats.
-
weaver.processes.convert.
merge_io_formats
(wps_formats: List[ANY_Format_Type], cwl_formats: List[ANY_Format_Type]) → List[ANY_Format_Type][source]¶ Merges I/O format definitions by matching
mime-type
field.In case of conflict, preserve the WPS version which can be more detailed (for example, by specifying
encoding
).Verifies if
DEFAULT_FORMAT_MISSING
was written to a single CWL format caused by a lack of any value provided as input. In this case, only WPS formats are kept.In the event that
DEFAULT_FORMAT_MISSING
was written to the CWL formats and that no WPS format was specified, theDEFAULT_FORMAT
is returned.- Raises
PackageTypeError – if inputs are invalid format lists
-
weaver.processes.convert.
merge_package_io
(wps_io_list: List[ANY_IO_Type], cwl_io_list: List[WPS_IO_Type], io_select: str) → List[WPS_IO_Type][source]¶ Merges corresponding parameters of different I/O definitions from CWL/WPS sources.
Update I/O definitions to use for process creation and returned by GetCapabilities, DescribeProcess. If WPS I/O definitions where provided during deployment, update CWL-to-WPS converted I/O with the WPS I/O complementary details. Otherwise, provide minimum field requirements that can be retrieved from CWL definitions.
Removes any deployment WPS I/O definitions that don’t match any CWL I/O by ID. Adds missing deployment WPS I/O definitions using expected CWL I/O IDs.
- Parameters
wps_io_list – list of WPS I/O (as json) passed during process deployment.
cwl_io_list – list of CWL I/O converted to WPS-like I/O for counter-validation.
io_select –
WPS_INPUT
orWPS_OUTPUT
to specify desired WPS type conversion.
- Returns
list of validated/updated WPS I/O for the process matching CWL I/O requirements.
weaver.processes.esgf_process
¶-
class
weaver.processes.esgf_process.
ESGFProcess
(provider: str, process: str, request: pywps.app.WPSRequest, update_status: weaver.typedefs.UpdateStatusPartialFunction)[source]¶ Common interface for WpsProcess to be used in
CWL
jobs.-
execute
(self: weaver.typedefs.JSON, workflow_inputs: str, out_dir: Dict[str, str], expected_outputs) → None[source]¶ Execute an ESGF process from cwl inputs.
-
_prepare_inputs
(self: weaver.typedefs.JSON, workflow_inputs) → List[cwt.Variable][source]¶ Convert inputs from cwl inputs to ESGF format.
-
static
_get_files_urls
(workflow_inputs: weaver.typedefs.JSON) → List[Tuple[str, str]][source]¶ Get all netcdf files from the cwl inputs.
-
static
_get_variable
(workflow_inputs: weaver.typedefs.JSON) → str[source]¶ Get all netcdf files from the cwl inputs.
-
_run_process
(self: str, api_key: List[cwt.Variable], inputs: Optional[cwt.Domain], domain=None) → cwt.Process[source]¶ Run an ESGF process.
-
_wait
(self: cwt.Process, esgf_process: float, sleep_time=2) → bool[source]¶ Wait for an ESGF process to finish, while reporting its status.
-
weaver.processes.execution
¶-
weaver.processes.execution.
make_results_relative
(results: List[weaver.typedefs.JSON], settings: weaver.typedefs.SettingsType) → List[weaver.typedefs.JSON][source]¶ Converts file references to a pseudo-relative location to allow the application to dynamically generate paths.
Redefines job results to be saved in database as pseudo-relative paths to configured WPS output directory. This allows the application to easily adjust the exposed result HTTP path according to the service configuration (i.e.: relative to
weaver.wps_output_dir
and/orweaver.wps_output_url
) and it also avoids rewriting the database job results entry if those settings are changed later on following reboot of the web application.Only references prefixed with
weaver.wps_output_dir
,weaver.wps_output_url
or a corresponding resolution fromweaver.wps_output_path
withweaver.url
will be modified to pseudo-relative paths. Other references (file/URL endpoints that do not correspond to Weaver) will be left untouched for literal remote reference. Results that do not correspond to a reference are also unmodified.Note
The references are not real relative paths (i.e.: starting with
./
), as those could also be specified as input, and there would be no way to guarantee proper differentiation from paths already handled and stored in the database. Instead, pseudo-relative paths employ an explicit absolute-like path (i.e.: starting with/
) and are assumed to always require to be prefixed by the configured WPS locations (i.e.:weaver.wps_output_dir
orweaver.wps_output_url
based on local or HTTP response context).With this approach, data persistence with mapped volumes into the dockerized Weaver service can be placed anywhere at convenience. This is important because sibling docker execution require exact mappings such that volume mount
/data/path:/data/path
resolve correctly on both sides (host and image path must be identical). If volumes get remapped differently, ensuring thatweaver.wps_output_dir
setting follows the same remapping update will automatically resolve to the proper location for both local references and exposed URL endpoints.- Parameters
results – JSON mapping of data results as
{"<id>": <definition>}
entries where a reference can be found.settings – container to retrieve current application settings.
-
weaver.processes.execution.
map_locations
(job: weaver.datatype.Job, settings: weaver.typedefs.SettingsType) → None[source]¶ Maps directory locations between
pywps
process execution and produced jobs storage.Generates symlink references from the Job UUID to PyWPS UUID results (outputs directory, status and log locations). Update the Job’s WPS ID if applicable (job executed locally). Assumes that all results are located under the same reference UUID.
-
weaver.processes.execution.
submit_job
(request: pyramid.request.Request, reference: Union[weaver.datatype.Service, weaver.datatype.Process], tags: Optional[List[str]] = None) → weaver.typedefs.JSON[source]¶ Generates the job submission from details retrieved in the request.
See also
submit_job_handler()
to provide elements pre-extracted from requests or from other parsing.
-
weaver.processes.execution.
_validate_job_parameters
(json_body)[source]¶ Tests supported parameters not automatically validated by colander deserialize.
-
weaver.processes.execution.
submit_job_handler
(payload: Ellipsis, settings: weaver.typedefs.SettingsType, service_url: str, provider_id: Optional[str] = None, process_id: str = None, is_workflow: bool = False, is_local: bool = True, visibility: Optional[str] = None, language: Optional[str] = None, auth: Optional[weaver.typedefs.HeaderCookiesType] = None, tags: Optional[List[str]] = None, user: Optional[int] = None) → weaver.typedefs.JSON[source]¶ Submits the job to the Celery worker with provided parameters.
Assumes that parameters have been pre-fetched and validated, except for the input payload.
weaver.processes.opensearch
¶-
weaver.processes.opensearch.
alter_payload_after_query
(payload)[source]¶ When redeploying the package on ADES, strip out any EOImage parameter.
-
weaver.processes.opensearch.
query_eo_images_from_wps_inputs
(wps_inputs: Ellipsis, eoimage_source_info: Dict[str, Dict], accept_mime_types: Dict[str, List[str]], settings: Optional[weaver.typedefs.AnySettingsContainer] = None) → Dict[str, Deque][source]¶ Query OpenSearch using parameters in inputs and return file links.
- Parameters
wps_inputs – inputs containing info to query
eoimage_source_info – data source info of eoimages
accept_mime_types – dict of list of accepted mime types, ordered by preference
settings – application settings to retrieve request options as necessary.
-
weaver.processes.opensearch.
replace_with_opensearch_scheme
(link)[source]¶ Replaces
file://
scheme byopensearch://
scheme.
-
class
weaver.processes.opensearch.
OpenSearchQuery
(collection_identifier: str, osdd_url: str, catalog_search_field: str = 'parentIdentifier', settings: Optional[weaver.typedefs.AnySettingsContainer] = None)[source]¶ Container to handle OpenSearch queries.
- Parameters
collection_identifier – Collection ID to query
osdd_url – Global OSDD url for OpenSearch queries.
catalog_search_field – Name of the field for the collection identifier.
settings – application settings to retrieve request options as necessary.
-
_prepare_query_url
(self: str, template_url: Dict, params) → Tuple[str, Dict][source]¶ Prepare the URL for the OpenSearch query.
- Parameters
template_url – url containing query parameters.
params – parameters to insert in formatted URL.
-
_query_features_paginated
(self: Dict, params) → Iterable[Dict, str][source]¶ Iterates over paginated results until all features are retrieved.
- Parameters
params – query parameters
-
query_datasets
(self: Dict, params: Tuple, accept_schemes: List, accept_mime_types) → Iterable[str][source]¶ Query the specified datasets.
Loop on every OpenSearch result feature and yield URL matching required mime-type and scheme. Log a warning if a feature cannot yield a valid URL (either no compatible mime-type or scheme)
- Parameters
params – query parameters
accept_schemes – only return links of this scheme
accept_mime_types – list of accepted mime types, ordered by preference
- Raises
KeyError – If the feature doesn’t contain a json data section or an atom alternative link
-
weaver.processes.opensearch.
get_additional_parameters
(input_data: Dict) → List[Tuple[str, str]][source]¶ Retrieve the values from the
additionalParameters
of the input.- Parameters
input_data – Dict containing or not the “additionalParameters” key
-
class
weaver.processes.opensearch.
EOImageDescribeProcessHandler
(inputs)[source]¶ -
-
static
make_toi
(id_, start_date=True)[source]¶ Generate the Time-Of-Interest definition.
- Parameters
id – ID of the input.
start_date – (Default value = True)
-
to_opensearch
(self: bool, unique_aoi: bool, unique_toi) → List[Dict][source]¶ Convert the inputs with OpenSearch request parameters considering Area-Of-Interest and Time-Of-Interest.
- Parameters
unique_aoi – indicate if a single/global AOI must be applied or individual ones for each input.
unique_toi – indicate if a single/global TOI must be applied or individual ones for each input.
-
static
-
weaver.processes.opensearch.
get_original_collection_id
(payload: Dict, wps_inputs: Dict[str, collections.deque]) → Dict[str, collections.deque][source]¶ Obtains modified WPS inputs considering mapping to known OpenSearch collection IDs.
When we deploy a Process that contains OpenSearch parameters, the collection identifier is modified:
Ex: files -> collection Ex: s2 -> collection_s2, probav -> collection_probav
This function changes the ID in the execute request to the one from the deployed Process description.
- Parameters
payload –
wps_inputs –
- Returns
-
weaver.processes.opensearch.
get_eo_images_data_sources
(payload: Dict, wps_inputs: Dict[str, collections.deque]) → Dict[str, Dict][source]¶ Resolve the data source of an
EOImage
input reference.- Parameters
payload – Deploy payload
wps_inputs – Execute inputs
- Returns
Data source of the
EOImage
.
-
weaver.processes.opensearch.
get_eo_images_mime_types
(payload: Dict) → Dict[str, List][source]¶ Get the accepted media-types from the deployment payload.
- Parameters
payload – Deploy payload.
- Returns
Accepted media-type.
-
weaver.processes.opensearch.
insert_max_occurs
(payload: Dict, wps_inputs: Dict[str, Deque]) → None[source]¶ Insert maxOccurs value in wps inputs using the deploy payload.
- Parameters
payload – Deploy payload.
wps_inputs – WPS inputs.
weaver.processes.sources
¶-
weaver.processes.sources.
DATA_SOURCES
[source]¶ Data sources configuration.
Unless explicitly overridden, the configuration will be loaded from file as specified by``weaver.data_sources`` setting. Following JSON schema format is expected (corresponding YAML also supported):
{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Data Sources", "type": "object", "patternProperties": { ".*": { "type": "object", "required": [ "netloc", "ades" ], "additionalProperties": false, "properties": { "netloc": { "type": "string", "description": "Net location of a data source url use to match this data source." }, "ades": { "type": "string", "description": "ADES endpoint where the processing of this data source can occur." }, "default": { "type": "string", "description": "True indicate that if no data source match this one should be used (Use the first default)." } } } } }
weaver.processes.types
¶weaver.processes.utils
¶-
weaver.processes.utils.
get_process
(process_id: Optional[str] = None, request: Optional[pyramid.request.Request] = None, settings: Optional[weaver.typedefs.SettingsType] = None, store: Optional[weaver.store.base.StoreProcesses] = None) → weaver.datatype.Process[source]¶ Obtain the specified process and validate information, returning appropriate HTTP error if invalid.
Process identifier must be provided from either the request path definition or literal ID. Database must be retrievable from either the request, underlying settings, or direct store reference.
Different parameter combinations are intended to be used as needed or more appropriate, such that redundant operations can be reduced where some objects are already fetched from previous operations.
-
weaver.processes.utils.
get_job_submission_response
(body: weaver.typedefs.JSON) → pyramid.httpexceptions.HTTPCreated[source]¶ Generates the successful response from contents returned by job submission process.
-
weaver.processes.utils.
map_progress
(progress: weaver.typedefs.Number, range_min: weaver.typedefs.Number, range_max: weaver.typedefs.Number) → weaver.typedefs.Number[source]¶ Calculates the relative progression of the percentage process within min/max values.
-
weaver.processes.utils.
_check_deploy
(payload)[source]¶ Validate minimum deploy payload field requirements with exception handling.
-
weaver.processes.utils.
_validate_deploy_process_info
(process_info, reference, package, settings)[source]¶ Obtain the process definition from deploy payload with exception handling.
-
weaver.processes.utils.
deploy_process_from_payload
(payload: weaver.typedefs.JSON, container: weaver.typedefs.AnyContainer, overwrite: bool = False) → pyramid.httpexceptions.HTTPException[source]¶ Deploy the process after resolution of all references and validation of the parameters from payload definition.
Adds a
weaver.datatype.Process
instance to storage using the provided JSONpayload
matchingweaver.wps_restapi.swagger_definitions.ProcessDescription
.- Parameters
payload – JSON payload that was specified during the process deployment request.
container – container to retrieve application settings.
overwrite – whether to allow override of an existing process definition if conflict occurs.
- Returns
HTTPOk if the process registration was successful.
- Raises
HTTPException – for any invalid process deployment step.
-
weaver.processes.utils.
parse_wps_process_config
(config_entry: Union[weaver.typedefs.JSON, str]) → Tuple[str, str, List[str], bool][source]¶ Parses the available WPS provider or process entry to retrieve its relevant information.
- Returns
WPS provider name, WPS service URL, and list of process identifier(s).
- Raises
ValueError – if the entry cannot be parsed correctly.
-
weaver.processes.utils.
register_wps_processes_static
(service_url: str, service_name: str, service_visibility: bool, service_processes: List[str], container: weaver.typedefs.AnySettingsContainer) → None[source]¶ Register WPS-1 Process under a service Provider as static references.
For a given WPS provider endpoint, either iterates over all available processes under it to register them one by one, or limit itself only to those of the reduced set specified by
service_processes
.The registered WPS-1 processes generate a static reference, meaning that metadata of each process as well as any other modifications to the real remote reference will not be tracked, including validation of even their actual existence, or modifications to inputs/outputs. The Application Package will only point to it assuming it remains valid.
Each of the deployed processes using static reference will be accessible directly under Weaver endpoints:
/processes/<service-name>_<process-id>
The service is NOT deployed as Provider since the processes are registered directly.
See also
- Parameters
service_url – WPS-1 service location (where
GetCapabilities
andDescribeProcess
requests can be made).service_name – Identifier to employ for generating the full process identifier.
service_visibility – Visibility flag of the provider.
service_processes – process IDs under the service to be registered, or all if empty.
container – settings to retrieve required configuration settings.
-
weaver.processes.utils.
register_wps_processes_dynamic
(service_name: str, service_url: str, service_visibility: bool, container: weaver.typedefs.AnySettingsContainer) → None[source]¶ Register a WPS service
provider
such thatprocesses
under it are dynamically accessible on demand.The registered WPS-1 provider generates a dynamic reference to processes under it. Only the Provider reference itself is actually registered. No Process are directly registered following this operation.
When information about the offered processes, descriptions of those processes or their execution are requested, Weaver will query the referenced Provider for details and convert the corresponding Process dynamically. This means that latest metadata of the Process, and any modification to it on the remote service will be immediately reflected on Weaver without any need to re-deploy processes.
Each of the deployed processes using dynamic reference will be accessible under Weaver endpoints:
/providers/<service-name>/processes/<process-id>
The processes are NOT deployed locally since the processes are retrieved from the Provider itself.
See also
- Parameters
service_url – WPS-1 service location (where
GetCapabilities
andDescribeProcess
requests can be made).service_name – Identifier to employ for registering the provider identifier.
service_visibility – Visibility flag of the provider.
container – settings to retrieve required configuration settings.
-
weaver.processes.utils.
register_wps_processes_from_config
(wps_processes_file_path: Optional[weaver.typedefs.FileSystemPathType], container: weaver.typedefs.AnySettingsContainer) → None[source]¶ Registers remote WPS providers and/or processes as specified from the configuration file.
Loads a wps_processes.yml file and registers WPS-1 providers processes to the current Weaver instance as equivalent WPS-2 processes.
References listed under
processes
are registered. When the reference is a service (provider), registration of each WPS process is done individually for each of the specified providers with ID[service]_[process]
per listed process byGetCapabilities
.New in version 1.14.0: When references are specified using
providers
section instead ofprocesses
, the registration only saves the remote WPS provider endpoint to dynamically populate WPS processes on demand.See also
weaver.wps_processes.yml.example for additional file format details
weaver.processes.wps1_process
¶-
class
weaver.processes.wps1_process.
Wps1Process
(provider: str, process: str, request: pywps.app.WPSRequest, update_status: weaver.typedefs.UpdateStatusPartialFunction)[source]¶ Common interface for WpsProcess to be used in
CWL
jobs.-
get_input_values
(self: weaver.typedefs.ProcessOWS, process: weaver.typedefs.CWL_RuntimeInputsMap, workflow_inputs) → weaver.typedefs.OWS_InputDataValues[source]¶ Convert submitted CWL workflow inputs into corresponding
OWSLib.wps
representation for execution.- Parameters
process – original OWS process definition to retrieve expected inputs’ formats, values and types.
workflow_inputs – mapping of input IDs and values submitted to the workflow.
:return converted OWS inputs ready for submission to remote WPS process.
-
execute
(self, workflow_inputs, out_dir, expected_outputs)[source]¶ Execute a remote process using the given inputs.
The function is expected to monitor the process and update the status. Retrieve the expected outputs and store them in the
out_dir
.- Parameters
workflow_inputs – CWL job dict
out_dir – directory where the outputs must be written
expected_outputs – expected value outputs as {‘id’: ‘value’}
-
weaver.processes.wps3_process
¶-
class
weaver.processes.wps3_process.
Wps3Process
(step_payload: weaver.typedefs.JSON, joborder: weaver.typedefs.JSON, process: str, request: pywps.app.WPSRequest, update_status: weaver.typedefs.UpdateStatusPartialFunction)[source]¶ Common interface for WpsProcess to be used in
CWL
jobs.-
is_visible
(self: Ellipsis) → Union[bool, None][source]¶ Gets the process visibility.
- Returns
True/False correspondingly for public/private if visibility is retrievable, False if authorized access but process cannot be found, None if forbidden access.
-
execute
(self, workflow_inputs, out_dir, expected_outputs)[source]¶ Execute a remote process using the given inputs.
The function is expected to monitor the process and update the status. Retrieve the expected outputs and store them in the
out_dir
.- Parameters
workflow_inputs – CWL job dict
out_dir – directory where the outputs must be written
expected_outputs – expected value outputs as {‘id’: ‘value’}
-
weaver.processes.wps_default
¶-
class
weaver.processes.wps_default.
HelloWPS
(*_, **__)[source]¶ - Parameters
handler – A callable that gets invoked for each incoming request. It should accept a single
pywps.app.WPSRequest
argument and return apywps.app.WPSResponse
object.identifier (string) – Name of this process.
title (string) – Human readable title of process.
abstract (string) – Brief narrative description of the process.
keywords (list) – Keywords that characterize a process.
inputs – List of inputs accepted by this process. They should be
LiteralInput
andComplexInput
andBoundingBoxInput
objects.outputs – List of outputs returned by this process. They should be
LiteralOutput
andComplexOutput
andBoundingBoxOutput
objects.metadata – List of metadata advertised by this process. They should be
pywps.app.Common.Metadata
objects.translations (dict[str,dict[str,str]]) – The first key is the RFC 4646 language code, and the nested mapping contains translated strings accessible by a string property. e.g. {“fr-CA”: {“title”: “Mon titre”, “abstract”: “Une description”}}
weaver.processes.wps_package
¶Representation of WPS process with an internal CWL package definition.
Functions and classes that offer interoperability and conversion between corresponding elements defined as CWL CommandLineTool/Workflow and WPS ProcessDescription in order to generate ADES/EMS deployable Application Package.
See also
weaver.wps_restapi.api
conformance details
-
weaver.processes.wps_package.
get_status_location_log_path
(status_location: str, out_dir: Optional[str] = None) → str[source]¶
-
weaver.processes.wps_package.
retrieve_package_job_log
(execution: owslib.wps.WPSExecution, job: weaver.datatype.Job, progress_min: weaver.typedefs.Number = 0, progress_max: weaver.typedefs.Number = 100) → None[source]¶ Obtains the underlying WPS execution log from the status file to add them after existing job log entries.
-
weaver.processes.wps_package.
get_process_location
(process_id_or_url: Union[Dict[str, Any], str], data_source: Optional[str] = None) → str[source]¶ Obtains the URL of a WPS REST DescribeProcess given the specified information.
- Parameters
process_id_or_url – process “identifier” or literal URL to DescribeProcess WPS-REST location.
data_source – identifier of the data source to map to specific ADES, or map to localhost if
None
.
- Returns
URL of EMS or ADES WPS-REST DescribeProcess.
-
weaver.processes.wps_package.
get_package_workflow_steps
(package_dict_or_url: Union[Dict[str, Any], str]) → List[Dict[str, str]][source]¶ Obtain references to intermediate steps of a CWL workflow.
- Parameters
package_dict_or_url – process package definition or literal URL to DescribeProcess WPS-REST location.
- Returns
list of workflow steps as {“name”: <name>, “reference”: <reference>} where name is the generic package step name, and reference is the id/url of a registered WPS package.
-
weaver.processes.wps_package.
_fetch_process_info
(process_info_url: str, fetch_error: Type[Exception]) → weaver.typedefs.JSON[source]¶ Fetches the JSON process information from the specified URL and validates that it contains something.
- Raises
fetch_error – provided exception with URL message if the process information could not be retrieved.
-
weaver.processes.wps_package.
_get_process_package
(process_url: str) → Tuple[weaver.typedefs.CWL, str][source]¶ Retrieves the WPS process package content from given process ID or literal URL.
- Parameters
process_url – process literal URL to DescribeProcess WPS-REST location.
- Returns
tuple of package body as dictionary and package reference name.
-
weaver.processes.wps_package.
_get_process_payload
(process_url: str) → weaver.typedefs.JSON[source]¶ Retrieves the WPS process payload content from given process ID or literal URL.
- Parameters
process_url – process literal URL to DescribeProcess WPS-REST location.
- Returns
payload body as dictionary.
-
weaver.processes.wps_package.
_get_package_type
(package_dict: weaver.typedefs.CWL) → Union[weaver.processes.types.PROCESS_APPLICATION, weaver.processes.types.PROCESS_WORKFLOW][source]¶
-
weaver.processes.wps_package.
_get_package_requirements_as_class_list
(requirements: AnyCWLRequirements) → ListCWLRequirements[source]¶ Converts CWL package
requirements
orhints
into list representation.Uniformization CWL requirements into the list representation, whether the input definitions where provided using the dictionary definition as
{"<req-class>": {<params>}}
or the list of dictionary requirements[{<req-class+params>}]
each with aclass
key.
-
weaver.processes.wps_package.
_get_package_ordered_io
(io_section: Union[List[weaver.typedefs.JSON], Dict[str, Union[weaver.typedefs.JSON, str]]], order_hints: Optional[List[weaver.typedefs.JSON]] = None) → List[weaver.typedefs.JSON][source]¶ Reorders and converts CWL I/O from any representation and considering specified ordering hints.
First, converts CWL package I/O definitions defined as dictionary to an equivalent
list
representation, in order to work only with a single representation method. Thelist
is chosen overdict
because sequences can enforce a specific order, while mapping have no particular order. The list representation ensures that I/O order is preserved when written to file and reloaded afterwards regardless of each server and/or library’s implementation of the mapping container.If this function fails to correctly order any I/O or cannot correctly guarantee such result because of the provided parameters (e.g.: no hints given when required), the result will not break nor change the final processing behaviour of the CWL engine. This is merely cosmetic adjustments to ease readability of I/O to avoid always shuffling their order across multiple Application Package reporting.
The important result of this function is to provide the CWL I/O as a consistent list of objects so it is less cumbersome to compare/merge/iterate over the elements with all functions that will follow.
Note
When defined as a dictionary, an
OrderedDict
is expected as input to ensure preserved field order. Prior to Python 3.7 or CPython 3.5, preserved order is not guaranteed for builtindict
. In this case theorder_hints
is required to ensure same order.- Parameters
io_section – Definition contained under the CWL
inputs
oroutputs
package fields.order_hints – Optional/partial list of WPS I/O definitions hinting an order to sort CWL unsorted-dict I/O.
- Returns
I/O specified as list of dictionary definitions with preserved order (as best as possible).
-
weaver.processes.wps_package.
_check_package_file
(cwl_file_path_or_url: str) → Tuple[str, bool][source]¶ Validates that the specified CWL file path or URL points to an existing and allowed file format.
- Parameters
cwl_file_path_or_url – one of allowed file types path on disk, or an URL pointing to one served somewhere.
- Returns
absolute_path, is_url: absolute path or URL, and boolean indicating if it is a remote URL file.
- Raises
PackageRegistrationError – in case of missing file, invalid format or invalid HTTP status code.
-
weaver.processes.wps_package.
_load_package_file
(file_path: str) → weaver.typedefs.CWL[source]¶ Loads the package in YAML/JSON format specified by the file path.
-
weaver.processes.wps_package.
_load_package_content
(package_dict: Ellipsis, package_name: str = PACKAGE_DEFAULT_FILE_NAME, data_source: Optional[str] = None, only_dump_file: bool = False, tmp_dir: Optional[str] = None, loading_context: Optional[cwltool.context.LoadingContext] = None, runtime_context: Optional[cwltool.context.RuntimeContext] = None, process_offering: Optional[weaver.typedefs.JSON] = None) → Optional[Tuple[cwltool.factory.Callable, str, Dict[str, str]]][source]¶ Loads CWL package definition using various contextual resources.
Following operations are accomplished to validate the package:
Starts by resolving any intermediate sub-packages steps if the parent package is a Workflow (CWL class), in order to recursively generate and validate their process and package, potentially using remote reference. Each of those operations are applied to every step.
Package I/O are reordered using any reference process offering hints if provided to generate consistent results.
The resulting package definition is dumped to a temporary JSON file, to validate the content can be serialized.
Optionally, the CWL factory is employed to create the application runner, validating any provided loading and runtime contexts, and considering all Workflow steps if applicable, or the single application otherwise.
- Parameters
package_dict – package content representation as a json dictionary.
package_name – name to use to create the package file.
data_source – identifier of the data source to map to specific ADES, or map to localhost if
None
.only_dump_file – specify if the
CWLFactoryCallable
should be validated and returned.tmp_dir – location of the temporary directory to dump files (deleted on exit).
loading_context – cwltool context used to create the cwl package (required if
only_dump_file=False
)runtime_context – cwltool context used to execute the cwl package (required if
only_dump_file=False
)process_offering – JSON body of the process description payload (used as I/O hint ordering)
- Returns
if
only_dump_file
isTrue
:None
otherwise, tuple of:instance of
CWLFactoryCallable
package type (
PROCESS_WORKFLOW
orPROCESS_APPLICATION
)mapping of each step ID with their package name that must be run
Warning
Specified
tmp_dir
will be deleted on exit.
-
weaver.processes.wps_package.
_merge_package_inputs_outputs
(wps_inputs_list: Ellipsis, cwl_inputs_list: List[weaver.processes.convert.WPS_Input_Type], wps_outputs_list: List[weaver.processes.convert.ANY_IO_Type], cwl_outputs_list: List[weaver.processes.convert.WPS_Output_Type]) → Tuple[List[weaver.processes.convert.JSON_IO_Type], List[weaver.processes.convert.JSON_IO_Type]][source]¶ Merges corresponding metadata of I/O definitions from CWL and WPS sources.
Merges I/O definitions to use for process creation and returned by
GetCapabilities
,DescribeProcess
using the WPS specifications (from requestPOST
) and CWL specifications (extracted from file).Note
Parameters
cwl_inputs_list
andcwl_outputs_list
are expected to be in WPS-like format (ie: CWL I/O converted to corresponding WPS I/O).
-
weaver.processes.wps_package.
_get_package_io
(package_factory: cwltool.factory.Callable, io_select: str, as_json: bool) → List[weaver.processes.convert.PKG_IO_Type][source]¶ Retrieves I/O definitions from a validated
CWLFactoryCallable
.See also
Factory can be obtained with validation using
_load_package_content()
.- Parameters
package_factory – CWL factory that contains I/O references to the package definition.
io_select – either
WPS_INPUT
orWPS_OUTPUT
according to what needs to be processed.as_json – toggle to specific the desired output type.
- Returns
I/O format depends on value
as_json
. IfTrue
, converts the I/O definitions into JSON representation. IfFalse
, converts the I/O definitions into WPS objects.
-
weaver.processes.wps_package.
_get_package_inputs_outputs
(package_factory: Ellipsis, as_json: bool = False) → Tuple[List[weaver.processes.convert.PKG_IO_Type], List[weaver.processes.convert.PKG_IO_Type]][source]¶ Generates WPS-like
(inputs, outputs)
tuple using parsed CWL package definitions.
-
weaver.processes.wps_package.
_update_package_metadata
(wps_package_metadata: weaver.typedefs.JSON, cwl_package_package: weaver.typedefs.CWL) → None[source]¶ Updates the package WPS metadata dictionary from extractable CWL package definition.
-
weaver.processes.wps_package.
_generate_process_with_cwl_from_reference
(reference: str) → Tuple[weaver.typedefs.CWL, weaver.typedefs.JSON][source]¶ Resolves the
reference
type (CWL, WPS-1, WPS-2, WPS-3) and generates a CWLpackage
from it.Additionally provides minimal process details retrieved from the
reference
. The number of details obtained from the process will depend on available parameters from its description as well as the number of metadata that can be mapped between it and the generated CWL package.
-
weaver.processes.wps_package.
get_application_requirement
(package: weaver.typedefs.CWL) → Dict[str, Any][source]¶ Retrieve the principal requirement that allows mapping to the appropriate process implementation.
Obtains the first item in CWL package
requirements
orhints
that corresponds to a Weaver-specific application type as defined inCWL_REQUIREMENT_APP_TYPES
.- Returns
dictionary that minimally has
class
field, and optionally other parameters from that requirement.
-
weaver.processes.wps_package.
check_package_instance_compatible
(package: weaver.typedefs.CWL) → Optional[str][source]¶ Verifies if an Application Package definition is valid for the employed Weaver instance configuration.
Given that the CWL is invalid for the active application, explains the reason why that package always require remote execution.
When a package can sometimes be executed locally (ADES) or remotely (EMS) depending on the instance configuration, such as in the case of a
CWL_REQUIREMENT_APP_DOCKER
, returnNone
. This function instead detects cases where a remote server is mandatory without ambiguity related to the current Weaver instance, regardless whether remote should be an ADES or a remote Provider (WPS or ESGF-CWT).- Parameters
package – CWL definition for the process.
:returns reason message if must be executed remotely or
None
if it could be executed locally.
-
weaver.processes.wps_package.
get_process_definition
(process_offering: weaver.typedefs.JSON, reference: Optional[str] = None, package: Optional[weaver.typedefs.CWL] = None, data_source: Optional[str] = None) → weaver.typedefs.JSON[source]¶ Resolve the process definition considering corresponding metadata from the offering, package and references.
Returns an updated process definition dictionary ready for storage using provided WPS
process_offering
and a package definition passed byreference
orpackage
CWL content. The returned process information can be used later on to load an instance ofweaver.wps_package.WpsPackage
.- Parameters
process_offering – WPS REST-API (WPS-3) process offering as JSON.
reference – URL to CWL package definition, WPS-1 DescribeProcess endpoint or WPS-3 Process endpoint.
package – literal CWL package definition (YAML or JSON format).
data_source – where to resolve process IDs (default: localhost if
None
).
- Returns
updated process definition with resolved/merged information from
package
/reference
.
-
class
weaver.processes.wps_package.
WpsPackage
(**kw)[source]¶ - Parameters
handler – A callable that gets invoked for each incoming request. It should accept a single
pywps.app.WPSRequest
argument and return apywps.app.WPSResponse
object.identifier (string) – Name of this process.
title (string) – Human readable title of process.
abstract (string) – Brief narrative description of the process.
keywords (list) – Keywords that characterize a process.
inputs – List of inputs accepted by this process. They should be
LiteralInput
andComplexInput
andBoundingBoxInput
objects.outputs – List of outputs returned by this process. They should be
LiteralOutput
andComplexOutput
andBoundingBoxOutput
objects.metadata – List of metadata advertised by this process. They should be
pywps.app.Common.Metadata
objects.translations (dict[str,dict[str,str]]) – The first key is the RFC 4646 language code, and the nested mapping contains translated strings accessible by a string property. e.g. {“fr-CA”: {“title”: “Mon titre”, “abstract”: “Une description”}}
Creates a WPS-3 Process instance to execute a CWL application package definition.
Process parameters should be loaded from an existing
weaver.datatype.Process
instance generated usingweaver.wps_package.get_process_definition()
.Provided
kw
should correspond toweaver.datatype.Process.params_wps()
-
setup_loggers
(self: bool, log_stdout_stderr=True) → None[source]¶ Configures useful loggers to catch most of the common output and/or error messages during package execution.
-
insert_package_log
(self: Union[CWLResults, cwltool.factory.WorkflowStatus], result) → List[str][source]¶ Retrieves additional CWL sub-process logs captures to retrieve internal application output and/or errors.
After execution of this method, the WPS output log (which can be obtained by
retrieve_package_job_log()
) will have additionalstderr/stdout
entries extracted from the underlying application package tool execution.The outputs and errors are inserted as best as possible in the logical order to make reading of the merged logs appear as a natural and chronological order. In the event that both output and errors are available, they are appended one after another as merging in an orderly fashion cannot be guaranteed by outside CWL runner.
Note
In case of any exception, log reporting is aborted and ignored.
Todo
Improve for realtime updates when using async routine (https://github.com/crim-ca/weaver/issues/131)
- Parameters
result – output results returned by successful CWL package instance execution or raised CWL exception.
- Returns
captured execution log lines retrieved from files
-
update_requirements
(self)[source]¶ Inplace modification of
package
to adjust invalid items that would break behaviour we must enforce.
-
update_effective_user
(self)[source]¶ Update effective user/group for the Application Package to be executed.
FIXME: (experimental) update user/group permissions
Reducing permissions is safer inside docker application since weaver/cwltool could be running as root but this requires that mounted volumes have the required permissions so euid:egid can use them.
Overrides
cwltool
’s function to retrieve user/group id for ones we enforce.
-
update_status
(self: str, message: weaver.typedefs.Number, progress: weaver.status.AnyStatusType, status) → None[source]¶ Updates the PyWPS real job status from a specified parameters.
-
step_update_status
(self: str, message: weaver.typedefs.Number, progress: weaver.typedefs.Number, start_step_progress: weaver.typedefs.Number, end_step_progress: str, step_name: pywps.inout.literaltypes.AnyValue, target_host: str, status) → None[source]¶
-
log_message
(self: weaver.status.AnyStatusType, status: str, message: Optional[weaver.typedefs.Number], progress: int = None, level=logging.INFO) → None[source]¶
-
exception_message
(self: Type[Exception], exception_type: Optional[Exception], exception: str = None, message: weaver.status.AnyStatusType = 'no message', status: int = STATUS_EXCEPTION, level=logging.ERROR) → Exception[source]¶ Logs to the job the specified error message with the provided exception type.
- Returns
formatted exception with message to be raised by calling function.
-
classmethod
map_step_progress
(cls: int, step_index: int, steps_total) → weaver.typedefs.Number[source]¶ Calculates the percentage progression of a single step of the full process.
Note
The step procession is adjusted according to delimited start/end of the underlying CWL execution to provide a continuous progress percentage over the complete execution. Otherwise, we would have values that jump around according to whichever progress the underlying remote WPS or monitored CWL employs, if any is provided.
-
_handler
(self: pywps.app.WPSRequest, request: pywps.response.execute.ExecuteResponse, response) → pywps.response.execute.ExecuteResponse[source]¶ Method called when process receives the WPS execution request.
-
must_fetch
(self: str, input_ref) → bool[source]¶ Figures out if file reference should be fetched immediately for local execution.
If anything else than local script/docker, remote ADES/WPS process will fetch it. S3 are handled here to avoid error on remote WPS not supporting it.
See also
-
make_inputs
(self: Ellipsis, wps_inputs: Dict[str, Deque[weaver.processes.convert.WPS_Input_Type]], cwl_inputs_info: Dict[str, weaver.processes.convert.CWL_Input_Type]) → Dict[str, weaver.typedefs.ValueType][source]¶ Converts WPS input values to corresponding CWL input values for processing by CWL package instance.
The WPS inputs must correspond to
pywps
definitions. Multiple values are adapted to arrays as needed. WPSComplex
types (files) are converted to appropriate locations based on data or reference specification.- Parameters
wps_inputs – actual WPS inputs parsed from execution request
cwl_inputs_info – expected CWL input definitions for mapping
- Returns
CWL input values
-
make_location_input
(self: str, input_type: pywps.inout.ComplexInput, input_definition) → Optional[weaver.typedefs.JSON][source]¶ Generates the JSON content required to specify a CWL
File
input definition from a location.Note
If the process requires
OpenSearch
references that should be preserved as is, use scheme defined byweaver.processes.constants.OPENSEARCH_LOCAL_FILE_SCHEME
prefix instead ofhttp(s)://
.
-
make_outputs
(self: CWLResults, cwl_result) → None[source]¶ Maps CWL result outputs to corresponding WPS outputs.
-
make_location_output
(self: CWLResults, cwl_result: str, output_id) → None[source]¶ Rewrite the WPS output with required location using result path from CWL execution.
Configures the parameters such that PyWPS will either auto-resolve the local paths to match with URL defined by
weaver.wps_output_url
or upload it to S3 bucket fromweaver.wps_output_s3_bucket
and provide reference directly.See also
weaver.wps.load_pywps_config()
-
make_tool
(self: weaver.typedefs.ToolPathObjectType, toolpath_object: cwltool.context.LoadingContext, loading_context) → cwltool.process.Process[source]¶
-
get_job_process_definition
(self: str, jobname: weaver.typedefs.JSON, joborder: weaver.typedefs.CWL, tool) → WpsPackage[source]¶ Obtain the execution job definition for the given process.
This function is called before running an ADES job (either from a workflow step or a simple EMS dispatch). It must return a
weaver.processes.wps_process.WpsProcess
instance configured with the properCWL
package definition, ADES target and cookies to access it (if protected).- Parameters
jobname – The workflow step or the package id that must be launched on an ADES
string
joborder – The params for the job
dict {input_name: input_value}
input_value is one of input_object or array [input_object] input_object is one of string or dict {class: File, location: string} in our case input are expected to be File objecttool – Whole CWL config including hints requirement (see:
weaver.processes.constants.CWL_REQUIREMENT_APP_TYPES
)
weaver.processes.wps_process_base
¶-
class
weaver.processes.wps_process_base.
WpsProcessInterface
(request)[source]¶ Common interface for WpsProcess to be used in
CWL
jobs.-
abstract
execute
(self, workflow_inputs: weaver.typedefs.CWL_RuntimeInputsMap, out_dir: str, expected_outputs: Dict[str, str])[source]¶ Execute a remote process using the given inputs.
The function is expected to monitor the process and update the status. Retrieve the expected outputs and store them in the
out_dir
.- Parameters
workflow_inputs – CWL job dict
out_dir – directory where the outputs must be written
expected_outputs – expected value outputs as {‘id’: ‘value’}
-
abstract
weaver.processes.wps_workflow
¶-
weaver.processes.wps_workflow.
default_make_tool
(toolpath_object: Ellipsis, loading_context: cwltool.context.LoadingContext, get_job_process_definition: weaver.typedefs.GetJobProcessDefinitionFunction) → cwltool.process.Process[source]¶
-
class
weaver.processes.wps_workflow.
CallbackJob
(job: Callable[[Any, Any], Any], output_callback: cwltool.builder.Builder, cachebuilder: Text, jobcache)[source]¶
-
class
weaver.processes.wps_workflow.
WpsWorkflow
(toolpath_object: cwltool.context.LoadingContext, loading_context: weaver.typedefs.GetJobProcessDefinitionFunction, get_job_process_definition)[source]¶ Definition of a CWL
workflow
that can executeWPS
application packages as intermediate job steps.Steps are expected to be defined as individual
weaver.processes.wps_package.WpsPackage
references.Build a Process object from the provided dictionary.
-
job
(self: Ellipsis, joborder: Dict[Text, weaver.typedefs.AnyValue], output_callbacks: Callable[[Any, Any], Any], runtime_context: cwltool.context.RuntimeContext) → Generator[Union[cwltool.job.JobBase, CallbackJob], None, None][source]¶ Workflow job generator.
- Parameters
joborder – inputs of the job submission
output_callbacks – method to fetch step outputs and corresponding step details
runtime_context – configs about execution environment
- Returns
-
-
class
weaver.processes.wps_workflow.
WpsWorkflowJob
(builder: cwltool.builder.Builder, joborder: Dict[Text, Union[Dict[Text, Any], List, Text, None]], requirements: List[Dict[Text, Text]], hints: List[Dict[Text, Text]], name: Text, wps_process: weaver.processes.wps_process_base.WpsProcessInterface, expected_outputs: List[weaver.typedefs.ExpectedOutputType])[source]¶ Initialize the job object.
-
run
(self: Ellipsis, runtimeContext: cwltool.context.RuntimeContext, tmpdir_lock: Optional[threading.Lock] = None) → None[source]¶
-
weaver.store
¶
weaver.store.base
¶-
class
weaver.store.base.
StoreServices
[source]¶ -
-
abstract
save_service
(self: weaver.datatype.Service, service: bool, overwrite=True) → weaver.datatype.Service[source]¶
-
abstract
list_services
(self) → List[weaver.datatype.Service][source]¶
-
abstract
fetch_by_name
(self: str, name: Optional[str], visibility=None) → weaver.datatype.Service[source]¶
-
abstract
fetch_by_url
(self: str, url) → weaver.datatype.Service[source]¶
-
abstract
-
class
weaver.store.base.
StoreProcesses
[source]¶ -
-
abstract
save_process
(self: Union[weaver.datatype.Process, pywps.Process], process: bool, overwrite=True) → weaver.datatype.Process[source]¶
-
abstract
list_processes
(self: Optional[str], visibility=None) → List[weaver.datatype.Process][source]¶
-
abstract
fetch_by_id
(self: str, process_id: Optional[str], visibility=None) → weaver.datatype.Process[source]¶
-
abstract
-
class
weaver.store.base.
StoreJobs
[source]¶ -
-
abstract
save_job
(self: Ellipsis, task_id: str, process: str, service: Optional[str] = None, inputs: Optional[List[Any]] = None, is_workflow: bool = False, is_local: bool = False, user_id: Optional[int] = None, execute_async: bool = True, custom_tags: Optional[List[str]] = None, access: Optional[str] = None, notification_email: Optional[str] = None, accept_language: Optional[str] = None, created: Optional[datetime.datetime] = None) → weaver.datatype.Job[source]¶
-
abstract
update_job
(self: weaver.datatype.Job, job) → weaver.datatype.Job[source]¶
-
abstract
fetch_by_id
(self: str, job_id) → weaver.datatype.Job[source]¶
-
abstract
list_jobs
(self) → List[weaver.datatype.Job][source]¶
-
abstract
find_jobs
(self: Ellipsis, process: Optional[str] = None, service: Optional[str] = None, tags: Optional[List[str]] = None, access: Optional[str] = None, notification_email: Optional[str] = None, status: Optional[str] = None, sort: Optional[str] = None, page: int = 0, limit: int = 10, datetime: Optional[weaver.typedefs.DatetimeIntervalType] = None, group_by: Optional[Union[str, List[str]]] = None, request: Optional[pyramid.request.Request] = None) → Union[JobListAndCount, JobCategoriesAndCount][source]¶
-
abstract
-
class
weaver.store.base.
StoreQuotes
[source]¶ -
-
abstract
save_quote
(self: weaver.datatype.Quote, quote) → weaver.datatype.Quote[source]¶
-
abstract
fetch_by_id
(self: str, quote_id) → weaver.datatype.Quote[source]¶
-
abstract
list_quotes
(self: Ellipsis) → List[weaver.datatype.Quote][source]¶
-
abstract
-
class
weaver.store.base.
StoreBills
[source]¶ -
-
abstract
save_bill
(self: weaver.datatype.Bill, bill) → weaver.datatype.Bill[source]¶
-
abstract
fetch_by_id
(self: str, bill_id) → weaver.datatype.Bill[source]¶
-
abstract
list_bills
(self: Ellipsis) → List[weaver.datatype.Bill][source]¶
-
abstract
weaver.store.mongodb
¶Stores to read/write data to from/to MongoDB using pymongo.
-
class
weaver.store.mongodb.
MongodbStore
(collection: Optional[Dict[str, Any]], sane_name_config=None)[source]¶ Base class extended by all concrete store implementations.
-
classmethod
get_args_kwargs
(cls: Any, *args: Any, **kwargs) → Tuple[Tuple, Dict][source]¶ Filters
MongodbStore
-specific arguments to safely pass them down its__init__
.
-
classmethod
-
class
weaver.store.mongodb.
MongodbServiceStore
(*args, **kwargs)[source]¶ Registry for OWS services.
Uses MongoDB to store service url and attributes.
-
save_service
(self: weaver.datatype.Service, service: bool, overwrite=True) → weaver.datatype.Service[source]¶ Stores an OWS service in mongodb.
-
list_services
(self) → List[weaver.datatype.Service][source]¶ Lists all services in MongoDB storage.
-
fetch_by_name
(self: str, name: Optional[str], visibility=None) → weaver.datatype.Service[source]¶ Gets service for given
name
from MongoDB storage.
-
fetch_by_url
(self: str, url) → weaver.datatype.Service[source]¶ Gets service for given
url
from MongoDB storage.
-
-
class
weaver.store.mongodb.
MongodbProcessStore
(*args, **kwargs)[source]¶ Registry for processes.
Uses MongoDB to store processes and attributes.
-
_register_defaults
(self: List[weaver.datatype.Process], processes) → None[source]¶ Default process registration to apply definition updates with duplicate entry handling.
-
_add_process
(self: weaver.typedefs.AnyProcess, process: bool, upsert=False) → None[source]¶ Stores the specified process to the database.
The operation assumes that any conflicting or duplicate process definition was pre-validated. Parameter
upsert=True
can be employed to allow exact replacement and ignoring duplicate errors. When usingupsert=True
, it is assumed that whichever the result (insert, update, duplicate error) arises, the final result of the stored process should be identical in each case.Note
Parameter
upsert=True
is useful for initialization-time of the storage with default processes that can sporadically generate clashing-inserts between multi-threaded/workers applications that all try adding builtin processes around the same moment.
-
static
_get_process_field
(process: weaver.typedefs.AnyProcess, function_dict: Union[Dict[weaver.typedefs.AnyProcessType, Callable[], Any]], Callable[], Any]]) → Any[source]¶ Obtain a field from a process instance after validation and using mapping of process implementation functions.
Takes a lambda expression or a dict of process-specific lambda expressions to retrieve a field. Validates that the passed process object is one of the supported types.
- Parameters
process – process to retrieve the field from.
function_dict – lambda or dict of lambda of process type.
- Returns
retrieved field if the type was supported.
- Raises
ProcessInstanceError – invalid process type.
-
save_process
(self: Union[weaver.datatype.Process, pywps.Process], process: bool, overwrite=True) → weaver.datatype.Process[source]¶ Stores a process in storage.
- Parameters
process – An instance of
weaver.datatype.Process
.overwrite – Overwrite the matching process instance by name if conflicting.
-
delete_process
(self: str, process_id: Optional[str], visibility=None) → bool[source]¶ Removes process from database, optionally filtered by visibility.
If
visibility=None
, the process is deleted (if existing) regardless of its visibility value.
-
list_processes
(self: Optional[str], visibility=None) → List[weaver.datatype.Process][source]¶ Lists all processes in database, optionally filtered by visibility.
- Parameters
visibility – One value amongst weaver.visibility.
-
fetch_by_id
(self: str, process_id: Optional[str], visibility=None) → weaver.datatype.Process[source]¶ Get process for given
process_id
from storage, optionally filtered byvisibility
.If
visibility=None
, the process is retrieved (if existing) regardless of its visibility value.- Parameters
process_id – process identifier
visibility – one value amongst
weaver.visibility
.
- Returns
An instance of
weaver.datatype.Process
.
-
get_visibility
(self: str, process_id) → str[source]¶ Get visibility of a process.
- Returns
One value amongst weaver.visibility.
-
set_visibility
(self: str, process_id: str, visibility) → None[source]¶ Set visibility of a process.
- Parameters
visibility – One value amongst weaver.visibility.
process_id –
- Raises
ValueError – when
visibility
is not one ofweaver.visibility.VISIBILITY_VALUES
.
-
-
class
weaver.store.mongodb.
MongodbJobStore
(*args, **kwargs)[source]¶ Registry for process jobs tracking.
Uses MongoDB to store job attributes.
-
save_job
(self: Ellipsis, task_id: str, process: str, service: Optional[str] = None, inputs: Optional[List[Any]] = None, is_workflow: bool = False, is_local: bool = False, user_id: Optional[int] = None, execute_async: bool = True, custom_tags: Optional[List[str]] = None, access: Optional[str] = None, notification_email: Optional[str] = None, accept_language: Optional[str] = None, created: Optional[datetime.datetime] = None) → weaver.datatype.Job[source]¶ Creates a new
Job
and stores it in mongodb.
-
update_job
(self: weaver.datatype.Job, job) → weaver.datatype.Job[source]¶ Updates a job parameters in MongoDB storage.
- Parameters
job – instance of
weaver.datatype.Job
.
-
fetch_by_id
(self: str, job_id) → weaver.datatype.Job[source]¶ Gets job for given
job_id
from MongoDB storage.
-
list_jobs
(self) → List[weaver.datatype.Job][source]¶ Lists all jobs in MongoDB storage.
For user-specific access to available jobs, use
MongodbJobStore.find_jobs()
instead.
-
find_jobs
(self: Ellipsis, process: Optional[str] = None, service: Optional[str] = None, tags: Optional[List[str]] = None, access: Optional[str] = None, notification_email: Optional[str] = None, status: Optional[str] = None, sort: Optional[str] = None, page: int = 0, limit: int = 10, datetime: Optional[weaver.store.base.DatetimeIntervalType] = None, group_by: Optional[Union[str, List[str]]] = None, request: Optional[pyramid.request.Request] = None) → Union[weaver.store.base.JobListAndCount, weaver.store.base.JobCategoriesAndCount][source]¶ Finds all jobs in MongoDB storage matching search filters to obtain results with requested paging or grouping.
Using paging (default), result will be in the form:
( [Job(1), Job(2), Job(3), ...], <total> )
Where
<total>
will indicate the complete count of matched jobs with filters, but the list of jobs will be limited only topage
index andlimit
specified.Using grouping with a list of field specified with
group_by
, results will be in the form:( [{category: {field1: valueA, field2: valueB, ...}, [Job(1), Job(2), ...], count: <count>}, {category: {field1: valueC, field2: valueD, ...}, [Job(x), Job(y), ...], count: <count>}, ... ], <total> )
Where
<total>
will again indicate all matched jobs by every category combined, and<count>
will indicate the amount of jobs matched for each individual category. Also,category
will indicate values of specified fields (fromgroup_by
) that compose corresponding jobs with matching values.- Parameters
request – request that lead to this call to obtain permissions and user id.
process – process name to filter matching jobs.
service – service name to filter matching jobs.
tags – list of tags to filter matching jobs.
access – access visibility to filter matching jobs (default:
VISIBILITY_PUBLIC
).notification_email – notification email to filter matching jobs.
status – status to filter matching jobs.
sort – field which is used for sorting results (default: creation date, descending).
page – page number to return when using result paging (only when not using
group_by
).limit – number of jobs per page when using result paging (only when not using
group_by
).datetime – field used for filtering data by creation date with a given date or interval of date.
group_by – one or many fields specifying categories to form matching groups of jobs (paging disabled).
- Returns
(list of jobs matching paging OR list of {categories, list of jobs, count}) AND total of matched job.
-
-
class
weaver.store.mongodb.
MongodbQuoteStore
(*args, **kwargs)[source]¶ Registry for quotes.
Uses MongoDB to store quote attributes.
-
save_quote
(self: weaver.datatype.Quote, quote) → weaver.datatype.Quote[source]¶ Stores a quote in mongodb.
-
fetch_by_id
(self: str, quote_id) → weaver.datatype.Quote[source]¶ Gets quote for given
quote_id
from MongoDB storage.
-
list_quotes
(self: Ellipsis) → List[weaver.datatype.Quote][source]¶ Lists all quotes in MongoDB storage.
-
find_quotes
(self: Optional[str], process_id: int = None, page: int = 0, limit: Optional[str] = 10, sort=None) → Tuple[List[weaver.datatype.Quote], int][source]¶ Finds all quotes in MongoDB storage matching search filters.
Returns a tuple of filtered
items
and theircount
, whereitems
can have paging and be limited to a maximum per page, butcount
always indicate the total number of matches.
-
-
class
weaver.store.mongodb.
MongodbBillStore
(*args, **kwargs)[source]¶ Registry for bills.
Uses MongoDB to store bill attributes.
-
save_bill
(self: weaver.datatype.Bill, bill) → weaver.datatype.Bill[source]¶ Stores a bill in mongodb.
-
fetch_by_id
(self: str, bill_id) → weaver.datatype.Bill[source]¶ Gets bill for given
bill_id
from MongoDB storage.
-
list_bills
(self: Ellipsis) → List[weaver.datatype.Bill][source]¶ Lists all bills in MongoDB storage.
-
find_bills
(self: Optional[str], quote_id: int = None, page: int = 0, limit: Optional[str] = 10, sort=None) → Tuple[List[weaver.datatype.Bill], int][source]¶ Finds all bills in MongoDB storage matching search filters.
Returns a tuple of filtered
items
and theircount
, whereitems
can have paging and be limited to a maximum per page, butcount
always indicate the total number of matches.
-
weaver.wps
¶
Views for WPS-XML endpoint implemented with pywps
.
weaver.wps.service
¶-
class
weaver.wps.service.
ReferenceStatusLocationStorage
(url_location: weaver.typedefs.SettingsType, settings)[source]¶ Simple storage that simply redirects to a pre-existing status location.
-
url
(self, *_, **__)[source]¶ - Parameters
destination – the name of the output to calculate the url for
- Returns
URL where file_name can be reached
-
location
(self, *_, **__)[source]¶ Provides a location for the specified destination. This may be any path, pathlike object, db connection string, URL, etc and it is not guaranteed to be accessible on the local file system :param destination: the name of the output to calculate
the location for
- Returns
location where file_name can be found
-
store
(self, *_, **__)[source]¶ - Parameters
output – of type IOHandler
- Returns
(type, store, url) where type - is type of STORE_TYPE - number store - string describing storage - file name, database connection url - url, where the data can be downloaded
-
write
(self, *_, **__)[source]¶ - Parameters
data – data to write to storage
destination – identifies the destination to write to storage generally a file name which can be interpreted by the implemented Storage class in a manner of its choosing
data_format – Optional parameter of type pywps.inout.formats.FORMAT describing the format of the data to write.
- Returns
url where the data can be downloaded
-
-
class
weaver.wps.service.
WorkerExecuteResponse
(wps_request: str, uuid: pywps.app.Process, process: str, job_url: weaver.typedefs.SettingsType, settings: Any, *_: Any, **__)[source]¶ XML response generator from predefined job status URL and executed process definition.
constructor
- Parameters
wps_request (pywps.app.WPSRequest.WPSRequest) –
process (pywps.app.Process.Process) –
uuid – string this request uuid
-
class
weaver.wps.service.
WorkerService
(*_, is_worker=False, settings=None, **__)[source]¶ Dispatches PyWPS requests from WPS-1/2 XML endpoint to WPS-REST as appropriate.
Note
For every WPS-Request type, the parsing of XML content is already handled by the PyWPS service for GET/POST. All data must be retrieved from parsed
WPSRequest
to avoid managing argument location and WPS versions.When
GetCapabilities
orDescribeProcess
requests are received, directly return to result as XML based on content (no need to subprocess as Celery task that gets resolved quickly with only the process(es) details). When JSON content is requested, instead return the redirect link to corresponding WPS-REST API endpoint.When receiving
Execute
request, convert the XML payload to corresponding JSON and dispatch it to the Celery Worker to actually process it after job setup for monitoring.-
_get_capabilities_redirect
(self: pywps.app.WPSRequest, wps_request: Any, *_: Any, **__) → Optional[Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid]][source]¶ Redirects to WPS-REST endpoint if requested
Content-Type
is JSON.
-
get_capabilities
(self: pywps.app.WPSRequest, wps_request: Any, *_: Any, **__) → Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid][source]¶ Redirect to WPS-REST endpoint if requested
Content-Type
is JSON or handleGetCapabilities
normally.
-
_describe_process_redirect
(self: pywps.app.WPSRequest, wps_request: Any, *_: Any, **__) → Optional[Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid]][source]¶ Redirects to WPS-REST endpoint if requested
Content-Type
is JSON.
-
describe
(self: pywps.app.WPSRequest, wps_request: Any, *_: Any, **__) → Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid][source]¶ Redirect to WPS-REST endpoint if requested
Content-Type
is JSON or handleDescribeProcess
normally.
-
_submit_job
(self: pywps.app.WPSRequest, wps_request) → Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid, weaver.typedefs.JSON][source]¶ Dispatch operation to WPS-REST endpoint, which in turn should call back the real Celery Worker for execution.
-
prepare_process_for_execution
(self: str, identifier) → pywps.app.Process[source]¶ Handles dispatched remote provider process preparation during execution request.
-
execute
(self: str, identifier: pywps.app.WPSRequest, wps_request: str, uuid) → Union[pywps.response.WPSResponse, weaver.typedefs.HTTPValid][source]¶ Submit WPS request to corresponding WPS-REST endpoint and convert back for requested
Accept
content-type.Overrides the original execute operation, that instead will get handled by
execute_job()
following callback from Celery Worker that handles process job creation and monitoring.If
Accept
is JSON, the result is directly returned from_submit_job()
. IfAccept
is XML or undefined,WorkerExecuteResponse
converts the received JSON with XML template.
-
execute_job
(self: str, process_id: List[weaver.processes.convert.WPS_Input_Type], wps_inputs: List[weaver.processes.convert.WPS_Output_Type], wps_outputs: str, mode: str, job_uuid: Optional[weaver.datatype.Process], remote_process: str, language) → owslib.wps.WPSExecution[source]¶ Real execution of the process by active Celery Worker.
-
weaver.wps.utils
¶-
weaver.wps.utils.
_get_settings_or_wps_config
(container: Ellipsis, weaver_setting_name: str, config_setting_section: str, config_setting_name: str, default_not_found: str, message_not_found: str) → str[source]¶
-
weaver.wps.utils.
get_wps_path
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the WPS path (without hostname).
Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_url
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the full WPS URL (hostname + WPS path).
Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_output_dir
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the WPS output directory path where to write XML and result files.
Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_output_path
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the WPS output path (without hostname) for staging XML status, logs and process outputs.
Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_output_url
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the WPS output URL that maps to WPS output directory path.
Searches directly in settings, then weaver.wps_cfg file, or finally, uses the default values if not found.
-
weaver.wps.utils.
get_wps_local_status_location
(url_status_location: str, container: weaver.typedefs.AnySettingsContainer, must_exist: bool = True) → Optional[str][source]¶ Attempts to retrieve the local XML file path corresponding to the WPS status location as URL.
- Parameters
url_status_location – URL reference pointing to some WPS status location XML.
container – any settings container to map configured local paths.
must_exist – return only existing path if enabled, otherwise return the parsed value without validation.
- Returns
found local file path if it exists,
None
otherwise.
-
weaver.wps.utils.
_describe_process_cached
(self: owslib.wps.WebProcessingService, identifier: str, xml: Optional[weaver.xml_util.XML] = None) → weaver.typedefs.ProcessOWS[source]¶
-
weaver.wps.utils.
_get_wps_client_cached
(url: str, headers: weaver.typedefs.HeadersType, verify: bool, language: Optional[str]) → owslib.wps.WebProcessingService[source]¶
-
weaver.wps.utils.
get_wps_client
(url: str, container: Optional[weaver.typedefs.AnySettingsContainer] = None, verify: bool = None, headers: Optional[weaver.typedefs.HeadersType] = None, language: Optional[str] = None) → owslib.wps.WebProcessingService[source]¶ Obtains a
WebProcessingService
with pre-configured request options for the given URL.- Parameters
url – WPS URL location.
container – request or settings container to retrieve headers and other request options.
verify – flag to enable SSL verification (overrides request options from container).
headers – specific headers to apply (overrides retrieved ones from container).
language – preferred response language if supported by the service.
- Returns
created WPS client object with configured request options.
-
weaver.wps.utils.
check_wps_status
(location: Ellipsis = None, response: Optional[weaver.xml_util.XML] = None, sleep_secs: int = 2, verify: bool = True, settings: Optional[weaver.typedefs.AnySettingsContainer] = None) → owslib.wps.WPSExecution[source]¶ Run
owslib.wps.WPSExecution.checkStatus()
with additional exception handling.- Parameters
location – job URL or file path where to look for job status.
response – WPS response document of job status.
sleep_secs – number of seconds to sleep before returning control to the caller.
verify – flag to enable SSL verification.
settings – application settings to retrieve any additional request parameters as applicable.
- Returns
OWSLib.wps.WPSExecution object.
-
weaver.wps.utils.
load_pywps_config
(container: weaver.typedefs.AnySettingsContainer, config: Optional[Union[str, Dict[str, str]]] = None) → configparser.ConfigParser[source]¶ Loads and updates the PyWPS configuration using Weaver settings.
-
weaver.wps.utils.
set_wps_language
(wps: owslib.wps.WebProcessingService, accept_language: Optional[str] = None, request: Optional[weaver.typedefs.AnyRequestType] = None) → Optional[str][source]¶ Applies the best match between requested accept languages and supported ones by the WPS server.
Given the Accept-Language header value, match the best language to the supported languages retrieved from WPS. By default, and if no match is found, sets
WebProcessingService.language
property toNone
.See also
Details about the format of the
Accept-Language
header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-LanguageNote
This function considers quality-factor weighting and parsing resolution of
Accept-Language
header according to RFC 7231, section 5.3.2.- Parameters
wps – service for which to apply a supported language if matched.
accept_language (str) – value of the Accept-Language header.
request – request from which to extract Accept-Language header if not provided directly.
- Returns
language that has been set, or
None
if no match could be found.
weaver.wps_restapi
¶
weaver.wps_restapi.jobs
¶weaver.wps_restapi.jobs.jobs
¶-
weaver.wps_restapi.jobs.jobs.
get_job
(request: pyramid.request.Request) → weaver.datatype.Job[source]¶ Obtain a job from request parameters.
- Returns
Job information if found.
- Raises
HTTPNotFound – with JSON body details on missing/non-matching job, process, provider IDs.
-
weaver.wps_restapi.jobs.jobs.
get_job_list_links
(job_total: int, filters: Dict[str, weaver.typedefs.AnyValue], request: pyramid.request.Request) → List[weaver.typedefs.JSON][source]¶ Obtains a list of all relevant links for the corresponding job listing defined by query parameter filters.
-
weaver.wps_restapi.jobs.jobs.
get_results
(job: weaver.datatype.Job, container: weaver.typedefs.AnySettingsContainer, value_key: Optional[str] = None, ogc_api: bool = False) → Union[List[weaver.typedefs.JSON], weaver.typedefs.JSON][source]¶ Obtains the job results with extended full WPS output URL as applicable and according to configuration settings.
- Parameters
job – job from which to retrieve results.
container – any container giving access to instance settings (to resolve reference output location).
value_key – If not specified, the returned values will have the appropriate
data
/href
key according to the content. Otherwise, all values will have the specified key.ogc_api – If
True
, formats the results using theOGC-API - Processes
format.
- Returns
list of all outputs each with minimally an ID and value under the requested key.
-
weaver.wps_restapi.jobs.jobs.
validate_service_process
(request: pyramid.request.Request) → Tuple[Optional[str], Optional[str]][source]¶ Verifies that service or process specified by path or query will raise the appropriate error if applicable.
-
weaver.wps_restapi.jobs.jobs.
get_queried_jobs
(request)[source]¶ Retrieve the list of jobs which can be filtered, sorted, paged and categorized using query parameters.
-
weaver.wps_restapi.jobs.jobs.
cancel_job_task
(job: weaver.datatype.Job, container: weaver.typedefs.AnySettingsContainer) → weaver.datatype.Job[source]¶
-
weaver.wps_restapi.jobs.jobs.
cancel_job
(request)[source]¶ Dismiss a job.
- Note:
Will only stop tracking this particular process execution when not supported by underlying provider services such as WPS 1.0. Services supporting cancel operation could attempt to terminate remote jobs.
-
weaver.wps_restapi.jobs.jobs.
cancel_job_batch
(request)[source]¶ Dismiss multiple jobs.
- Note:
Will only stop tracking jobs when underlying remote provider services do not support cancel operation.
-
weaver.wps_restapi.jobs.jobs.
get_job_inputs
(request: pyramid.request.Request) → pyramid.httpexceptions.HTTPException[source]¶ Retrieve the inputs of a job.
-
weaver.wps_restapi.jobs.jobs.
get_job_outputs
(request: pyramid.request.Request) → pyramid.httpexceptions.HTTPException[source]¶ Retrieve the outputs of a job.
weaver.wps_restapi.processes
¶weaver.wps_restapi.processes.processes
¶-
weaver.wps_restapi.processes.processes.
get_processes_filtered_by_valid_schemas
(request: pyramid.request.Request) → Tuple[List[weaver.typedefs.JSON], List[str]][source]¶ Validates the processes summary schemas and returns them into valid/invalid lists.
- Returns
list of valid process summaries and invalid processes IDs for manual cleanup.
-
weaver.wps_restapi.processes.processes.
get_processes
(request)[source]¶ List registered processes (GetCapabilities).
Optionally list both local and provider processes.
-
weaver.wps_restapi.processes.processes.
add_local_process
(request)[source]¶ Register a local process.
-
weaver.wps_restapi.processes.processes.
get_local_process
(request)[source]¶ Get a registered local process information (DescribeProcess).
-
weaver.wps_restapi.processes.processes.
get_local_process_package
(request)[source]¶ Get a registered local process package definition.
-
weaver.wps_restapi.processes.processes.
get_local_process_payload
(request)[source]¶ Get a registered local process payload definition.
-
weaver.wps_restapi.processes.processes.
get_process_visibility
(request)[source]¶ Get the visibility of a registered local process.
-
weaver.wps_restapi.processes.processes.
set_process_visibility
(request)[source]¶ Set the visibility of a registered local process.
weaver.wps_restapi.providers
¶weaver.wps_restapi.providers.providers
¶-
weaver.wps_restapi.providers.providers.
add_provider
(request)[source]¶ Register a new service provider.
-
weaver.wps_restapi.providers.providers.
remove_provider
(request)[source]¶ Remove an existing service provider.
-
weaver.wps_restapi.providers.providers.
get_provider
(request)[source]¶ Get a provider definition (GetCapabilities).
-
weaver.wps_restapi.providers.providers.
get_provider_processes
(request)[source]¶ Retrieve available provider processes (GetCapabilities).
-
weaver.wps_restapi.providers.providers.
describe_provider_process
(request: pyramid.request.Request) → weaver.datatype.Process[source]¶ Obtains a remote service process description in a compatible local process format.
Note: this processes won’t be stored to the local process storage.
weaver.wps_restapi.providers.utils
¶-
weaver.wps_restapi.providers.utils.
get_provider_services
(container: weaver.typedefs.AnySettingsContainer, check: bool = True, ignore: bool = True) → List[weaver.datatype.Service][source]¶ Obtain the list of remote provider services.
- Parameters
container – definition to retrieve settings and database connection.
check – request that all provider services are remotely accessible to fetch metadata from them.
ignore – given that any provider service is not accessible, ignore it or raise the error.
-
weaver.wps_restapi.providers.utils.
forbid_local_only
(container: weaver.typedefs.AnySettingsContainer) → Any[source]¶ Raises an HTTP exception forbidding to resume the operation if invalid configuration is detected.
weaver.wps_restapi.quotation
¶weaver.wps_restapi.quotation.quotes
¶-
weaver.wps_restapi.quotation.quotes.
process_quote_estimator
(process: weaver.datatype.Process) → weaver.typedefs.JSON[source]¶ Simulate quote parameters for the process execution.
- Parameters
process – instance of
weaver.datatype.Process
for which to evaluate the quote.- Returns
dict of {price, currency, estimatedTime} values for the process quote.
weaver.wps_restapi.api
¶-
weaver.wps_restapi.api.
api_frontpage_body
(settings: weaver.typedefs.SettingsType) → weaver.typedefs.JSON[source]¶ Generates the JSON body describing the Weaver API and documentation references.
-
weaver.wps_restapi.api.
api_versions
(request: pyramid.request.Request) → pyramid.httpexceptions.HTTPException[source]¶ Weaver versions information.
-
weaver.wps_restapi.api.
api_conformance
(request: pyramid.request.Request) → pyramid.httpexceptions.HTTPException[source]¶ Weaver specification conformance information.
-
weaver.wps_restapi.api.
get_openapi_json
(http_scheme: str = 'http', http_host: str = 'localhost', base_url: Optional[str] = None, use_refs: bool = True, use_docstring_summary: bool = True, settings: Optional[weaver.typedefs.SettingsType] = None) → weaver.typedefs.JSON[source]¶ Obtains the JSON schema of Weaver OpenAPI from request and response views schemas.
- Parameters
http_scheme – Protocol scheme to use for building the API base if not provided by base URL parameter.
http_host – Hostname to use for building the API base if not provided by base URL parameter.
base_url – Explicit base URL to employ of as API base instead of HTTP scheme/host parameters.
use_refs – Generate schemas with
$ref
definitions or expand every schema content.use_docstring_summary – Extra function docstring to auto-generate the summary field of responses.
settings – Application settings to retrieve further metadata details to be added to the OpenAPI.
-
weaver.wps_restapi.api.
openapi_json
(request: pyramid.request.Request) → dict[source]¶ Weaver OpenAPI schema definitions.
-
weaver.wps_restapi.api.
api_swagger_ui
(request)[source]¶ Weaver OpenAPI schema definitions rendering using Swagger-UI viewer.
-
weaver.wps_restapi.api.
api_redoc_ui
(request)[source]¶ Weaver OpenAPI schema definitions rendering using Redoc viewer.
-
weaver.wps_restapi.api.
get_request_info
(request: pyramid.request.Request, detail: Optional[str] = None) → weaver.typedefs.JSON[source]¶ Provided additional response details based on the request and execution stack on failure.
-
weaver.wps_restapi.api.
ows_json_format
(function)[source]¶ Decorator that adds additional detail in the response’s JSON body if this is the returned content-type.
-
weaver.wps_restapi.api.
not_found_or_method_not_allowed
(request)[source]¶ Overrides the default is HTTPNotFound [404] by appropriate HTTPMethodNotAllowed [405] when applicable.
Not found response can correspond to underlying process operation not finding a required item, or a completely unknown route (path did not match any existing API definition). Method not allowed is more specific to the case where the path matches an existing API route, but the specific request method (GET, POST, etc.) is not allowed on this path.
Without this fix, both situations return [404] regardless.
Overrides the default is HTTPForbidden [403] by appropriate HTTPUnauthorized [401] when applicable.
Unauthorized response is for restricted user access according to credentials and/or authorization headers. Forbidden response is for operation refused by the underlying process operations.
Without this fix, both situations return [403] regardless.
weaver.wps_restapi.colander_extras
¶This module offers multiple utility schema definitions to be employed with colander
and cornice_swagger
.
The colander.SchemaNode
provided here can be used in-place of colander
ones, but giving you extended behaviour according to provided keywords. You can therefore
do the following and all will be applied without modifying your code base.
# same applies for Mapping and Sequence schemas
from colander_extras import ExtendedSchemaNode as SchemaNode
from colander import SchemaNode # instead of this
The schemas support extended cornice_swagger
type converters so that you
can generate OpenAPI-3 specifications. The original package support is limited
to Swagger-2. You will also need additional in-place modifications provided
here.
Since the intended usage is to generate JSON-deserialized data structures, the
base colander.SchemaNode
have some additional patches needed to handle
JSON-native type conversion that are not directly offered by colander
- The main classes extensions are:
Multiple <ExtensionType>SchemaNode
variants are provided. You can use them
as building blocks, gaining each of their respective feature, to make specific
schema that meets your desired behaviour. The Extended
-prefixed classes
combined all available <ExtensionType>
. Note that it is preferable to use
the full Extended
-prefixed classes over individual ones as they add
complementary support of one-another features.
Warning
All node extensions assume that they are used for JSON data. Deserialization of unknown types could result in invalid result. Most of the time, Python native iterators such as tuples and generators could work and be converted to the corresponding sequence array (ie: list), but this is not guaranteed.
Warning
When defining schema nodes, DO NOT use the name
keyword otherwise
most mapping will fail validation as they cannot retrieve the same key-name
from the passed dictionary for deserialize
validation. Let the API
figure out the name of the field automatically. Instead, use the keyword
or field title
for adjusting the displayed name in the Swagger UI.
The same value will also be used to generate the $ref
reference names
of generated OpenAPI model definitions. If not explicitly provided, the
value of title
WILL default to the name of the schema node class.
-
exception
weaver.wps_restapi.colander_extras.
SchemaNodeTypeError
[source]¶ Generic error indicating that the definition of a SchemaNode is invalid.
This usually means the user forgot to specify a required element for schema creation, or that a provided combination of keywords, sub-nodes and/or schema type don’t make any sense together, that they are erroneous, or that they cannot be resolved because of some kind of ambiguous definitions leading to multiple conflicting choices.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.wps_restapi.colander_extras.
ConversionTypeError
[source]¶ Conversion error due to invalid type.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.wps_restapi.colander_extras.
ConversionValueError
[source]¶ Conversion error due to invalid value.
Initialize self. See help(type(self)) for accurate signature.
-
class
weaver.wps_restapi.colander_extras.
OneOfCaseInsensitive
(choices, msg_err=_MSG_ERR)[source]¶ Validator that ensures the given value matches one of the available choices, but allowing case insensitive values.
-
class
weaver.wps_restapi.colander_extras.
StringRange
(min=None, max=None, **kwargs)[source]¶ Validator that provides the same functionalities as
colander.Range
for a numerical string value.
-
class
weaver.wps_restapi.colander_extras.
SchemeURL
(schemes=None, msg=None, flags=re.IGNORECASE)[source]¶ String representation of an URL with extended set of allowed URI schemes.
See also
colander.url
[remote http(s)/ftp(s)]colander.file_uri
[local file://]
-
class
weaver.wps_restapi.colander_extras.
SemanticVersion
(*args, v_prefix=False, rc_suffix=True, **kwargs)[source]¶ String representation that is valid against Semantic Versioning specification.
See also
-
class
weaver.wps_restapi.colander_extras.
ExtendedBoolean
(*args, true_choices=None, false_choices=None, **kwargs)[source]¶ A type representing a boolean object.
The constructor accepts these keyword arguments:
false_choices
: The set of strings representing aFalse
value on deserialization.true_choices
: The set of strings representing aTrue
value on deserialization.false_val
: The value returned on serialization of a False value.true_val
: The value returned on serialization of a True value.
During deserialization, a value contained in
false_choices
, will be consideredFalse
.The behaviour for values not contained in
false_choices
depends ontrue_choices
: if it’s empty, any value is consideredTrue
; otherwise, only values contained intrue_choices
are consideredTrue
, and an Invalid exception would be raised for values outside of bothfalse_choices
andtrue_choices
.Serialization will produce
true_val
orfalse_val
based on the value.If the
colander.null
value is passed to the serialize method of this class, thecolander.null
value will be returned.The subnodes of the
colander.SchemaNode
that wraps this type are ignored.Initializes the extended boolean schema node.
When arguments
true_choices
orfalse_choices
are provided, the corresponding string values are respectively considered as valid truthy/falsy values. Otherwise (default),strict
values only of explicit typebool
will be considered valid.When values are specified
colander
converts them to string lowercase to compare against truthy/falsy values it should accept. For real OpenAPI typing validation, do NOT add other values like"1"
to avoid conflict withExtendedInteger
type for schemas that support both variants. If an OpenAPI field is expected to support truthy/falsy values, it is recommended to explicitly define its schema using aoneOf
keyword of all relevant schemas it supports, an any applicable validators for explicit values. This is the safest way to ensure the generated OpenAPI schema corresponds to expected type validation.
-
class
weaver.wps_restapi.colander_extras.
ExtendedNumber
(*_, allow_string=False, strict=True, **__)[source]¶ Definition of a numeric value, either explicitly or implicit with permissive
str
representation.- Behaviour in each case:
strict=True
andallow_string=False
: Value can only be explicit numeric type that matches exactly the basenum
type (default). All implicit conversion betweenfloat
,int
orstr
are disallowed.strict=True
andallow_string=True
: Value can be the explicit numeric type (int
orfloat
) or a numericstr
value representing the corresponding base numeric type. Implicit conversion betweenfloat
andint
is still disallowed.strict=False
(allow_string
doesn’t matter): Value can be anything as long as it can be converted to the expected numeric type (int
orfloat
).
- Recommended usage:
When making OpenAPI schema definitions for JSON body elements within a request or response object, default parameters
strict=True
andallow_string=False
should be used to ensure the numeric type is respected. As for other literal data Extended schema types, keyword oneOf should be used when multiple similar value types are permitted for a field in order to document in OpenAPI the specific type definitions of expected data, which is automatically converted byjson
properties of request and response classes.When defining OpenAPI query parameters,
strict=True
andallow_string=True
should be used. This ensures that documented schemas still indicate only the numeric type as expected data format, although technically thepath
of the request will contain astr
representing the number. Queries are not automatically converted by request objects, but will be converted and validated as the explicit number following deserialization when using those configuration parameters.
-
class
weaver.wps_restapi.colander_extras.
ExtendedFloat
(*_, allow_string=False, strict=True, **__)[source]¶ Float definition with strict typing validation by default.
This is to distinguish it from explicit definitions of
float
-like numbers or strings. By default, values such as"1"
,1.0
,True
will not be automatically converted to equivalent1.0
.
-
class
weaver.wps_restapi.colander_extras.
ExtendedInteger
(*_, allow_string=False, strict=True, **__)[source]¶ Integer definition with strict typing validation by default.
This is to distinguish it from explicit definitions of
integer
-like numbers or strings. By default, values such as"1"
,1.0
,True
will not be automatically converted to equivalent1
.
-
class
weaver.wps_restapi.colander_extras.
ExtendedString
(encoding=None, allow_empty=False)[source]¶ A type representing a Unicode string.
This type constructor accepts two arguments:
encoding
Represents the encoding which should be applied to value serialization and deserialization, for example
utf-8
. Ifencoding
is passed asNone
, theserialize
method of this type will not do any special encoding of the appstruct it is provided, nor will thedeserialize
method of this type do any special decoding of the cstruct it is provided; inputs and outputs will be assumed to be Unicode.encoding
defaults toNone
.If
encoding
isNone
:A Unicode input value to
serialize
is returned untouched.A non-Unicode input value to
serialize
is run through theunicode()
function without anencoding
parameter (unicode(value)
) and the result is returned.A Unicode input value to
deserialize
is returned untouched.A non-Unicode input value to
deserialize
is run through theunicode()
function without anencoding
parameter (unicode(value)
) and the result is returned.
If
encoding
is notNone
:A Unicode input value to
serialize
is run through theunicode
function with the encoding parameter (unicode(value, encoding)
) and the result (astr
object) is returned.A non-Unicode input value to
serialize
is converted to a Unicode using the encoding (unicode(value, encoding)
); subsequently the Unicode object is re-encoded to astr
object using the encoding and returned.A Unicode input value to
deserialize
is returned untouched.A non-Unicode input value to
deserialize
is converted to astr
object usingstr(value
). The resulting str value is converted to Unicode using the encoding (unicode(value, encoding)
) and the result is returned.
A corollary: If a string (as opposed to a unicode object) is provided as a value to either the serialize or deserialize method of this type, and the type also has an non-None
encoding
, the string must be encoded with the type’s encoding. If this is not true, ancolander.Invalid
error will result.allow_empty
Boolean, if True allows deserialization of an empty string. If False (default), empty strings will deserialize to
colander.null
The subnodes of the
colander.SchemaNode
that wraps this type are ignored.
-
class
weaver.wps_restapi.colander_extras.
XMLObject
[source]¶ Object that provides mapping to known XML extensions for OpenAPI schema definition.
Name of the schema definition in the OpenAPI will use :prop:`prefix` and the schema class name. Prefix can be omitted from the schema definition name by setting it to
colander.drop
. The value oftitle
provided as option orSee also
-
class
weaver.wps_restapi.colander_extras.
ExtendedSchemaBase
(*args, **kwargs)[source]¶ Utility base node definition that initializes additional parameters at creation time of any other extended schema.
When no explicit
title
is specified by either keyword argument or field definition within container class, default it to the literal name of the class defining the schema node. This title can then be employed by other extended schema implementations to define cleaner schema references, notably in the case ofKeywordMapper
derived classes that do not necessarily have any explicit targetname
field.When the schema node is a simple field within a container schema (mapping, sequence, etc.), operation is skipped to avoid applying the generic
SchemaNode
orExtendedSchemaNode
name of the basic node class. In this case, converters already employ the targetname
of the class attribute of the container schema under which that node gets created.When the schema node is a generic
colander.String
without explicitvalidator
, but that one can be inferred from eitherpattern
orformat
OpenAPI definition, the correspondingvalidator
gets automatically generated.
-
class
weaver.wps_restapi.colander_extras.
DropableSchemaNode
(*args, **kwargs)[source]¶ Schema that can be dropped if the value is missing.
Drops the underlying schema node if
missing=drop
was specified and that the value representing it represents an empty value instead of raising a invalid schema error.In the case of nodes corresponding to literal schema type (i.e.: Integer, String, etc.), the empty value looked for is
None
. This is to make sure that0
or""
are preserved unless explicitly representing no-data. In the case of container schema types (i.e.: list, dict, etc.), it is simply considered empty if there are no element in it, without any more explicit verification.Original behaviour of schema classes that can have children nodes such as
colander.MappingSchema
andcolander.SequenceSchema
are to drop the sub-node only if its value is resolved ascolander.null
orcolander.drop
. This results in optional field definitions replaced byNone
in many implementations to raisecolander.Invalid
during deserialization. Inheriting this class in a schema definition will handle this situation automatically.Required schemas (without
missing=drop
, defaulting tocolander.required
) will still raise for undefined nodes.The following snippet shows the result that can be achieved using this schema class:
class SchemaA(DropableSchemaNode, MappingSchema): field = SchemaNode(String()) class SchemaB(MappingSchema): s1 = SchemaA(missing=drop) # optional s2 = SchemaA() # required SchemaB().deserialize({"s1": None, "s2": {"field": "ok"}}) # results: {'s2': {'field': 'ok'}}
-
deserialize
(self, cstruct)[source]¶ Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstruct
value is deserialized into anappstruct
unconditionally.If
appstruct
returned by type deserialization and preparation is the valuecolander.null
, do something special before attempting validation:If the
missing
attribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missing
attribute of this node has not been set explicitly, raise acolander.Invalid
exception error.
If the appstruct is not
colander.null
and cannot be validated , acolander.Invalid
exception will be raised.If a
cstruct
argument is not explicitly provided, it defaults tocolander.null
.
-
-
class
weaver.wps_restapi.colander_extras.
DefaultSchemaNode
(*args, **kwargs)[source]¶ Schema that will return the provided default value when the corresponding value is missing or invalid.
If
default
keyword is provided duringcolander.SchemaNode
creation, overrides the returned value by this default if missing from the structure duringdeserialize()
call.Original behaviour was to drop the missing value instead of replacing by
default
. Executes all othercolander.SchemaNode
operations normally.-
deserialize
(self, cstruct)[source]¶ Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstruct
value is deserialized into anappstruct
unconditionally.If
appstruct
returned by type deserialization and preparation is the valuecolander.null
, do something special before attempting validation:If the
missing
attribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missing
attribute of this node has not been set explicitly, raise acolander.Invalid
exception error.
If the appstruct is not
colander.null
and cannot be validated , acolander.Invalid
exception will be raised.If a
cstruct
argument is not explicitly provided, it defaults tocolander.null
.
-
-
class
weaver.wps_restapi.colander_extras.
VariableSchemaNode
(*args, **kwargs)[source]¶ Object schema that allows defining a field key as variable by name supporting deserialization validation.
This definition is useful for defining a dictionary where the key name can be any string value but contains an underlying schema that has a very specific structure to be validated, such as in the following example.
{ "<any-key-id>": { "name": "required", "value": "something" }, "<another-key-id>": { "name": "other required", "value": "same schema" } }
This is accomplished using the following definition:
class RequiredDict(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) value = ExtendedSchemaNode(String()) class ContainerAnyKey(ExtendedMappingSchema): var = RequiredDict(variable="{id}")
In the above example, the
var
node name that would normally be automatically generated and used to define the dictionary key will be replaced by{id}
(any string provided byvariable
keyword). The actual attribute namevar
could be replaced by anything.Warning
Since
variable
tells the deserialization converter to try matching any valid children node schema with the provided structure regardless of key name, you should ensure that the variable child node has at least onecolander.required
field (either directly or much deeper in the structure) to ensure it has something to validate against. Otherwise, anything will be matched (ie: drop all for empty structure would be considered as valid).The above statement also applies in case you provide more than one variable schema node under a mapping where both underlying schema are different. Without any required child node to distinguish between them, the sub-structure under each variable node could end up interchanged.
Note
It is recommended to use variable names that include invalid characters for class/attribute names (e.g.:
{}
or<>
) in order to ensure that any substitution when attempting to find the schema matching the variable doesn’t result in overrides. As presented in the following example,const
could get overridden if there was a structure to parse that contained both theconst
sub-structure and another one with an arbitrary key matched against<var>
.class ContainerAnyKeyWithName(ExtendedMappingSchema): var = RequiredDict(variable="const") # 'const' could clash with other below const = RequiredDict(String())
Using
<const>
instead would ensure that no override occurs as it is a syntax error to write<const> = RequiredDict(String())
in the class definition, but this value can still be used to create the internal mapping to evaluate sub-schemas without name clashes. As a plus, it also helps giving an indication that any key is accepted.See also
-
_mark_variable_children
(self)[source]¶ Ensures that any immediate children schema with variable key are detected.
Verifies if a
colander.MappingSchema
(or any of its extensions) contains childrenVariableSchemaNode
schema nodes for adequatedeserialize()
result later on.If children nodes are detected as variable, this schema is marked for special processing of the children nodes so they don’t get removed from the result (in case of optional field specified by
missing=drop
) nor raisecolander.Invalid
because they are supposed to becolander.required
.Note
Because mapping schema deserialization is normally processed by validating the content of a sub-node according to its
name
, it is not possible to use the normal approach (i.e.: get dictionary value under matching key-name and validate it against the sub-schema of same name). We must verify against every variable node available in the mapping (also ignoring constants nodes with explicitly named keys), then guess a valid match and finally return it with modified name corresponding to the expectedvariable
value in the parent mapping schema. Returning this modifiedname
withvariable
makes the value/sub-schema correspondence transparent to the parent mapping when dictionary get-by-key is called during the mapping validation.Warning
Because of the above reversed-processing method, all mapping nodes must derive from
VariableSchemaNode
to ensure they pre-process potential variable candidates.
-
deserialize
(self, cstruct)[source]¶ Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstruct
value is deserialized into anappstruct
unconditionally.If
appstruct
returned by type deserialization and preparation is the valuecolander.null
, do something special before attempting validation:If the
missing
attribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missing
attribute of this node has not been set explicitly, raise acolander.Invalid
exception error.
If the appstruct is not
colander.null
and cannot be validated , acolander.Invalid
exception will be raised.If a
cstruct
argument is not explicitly provided, it defaults tocolander.null
.
-
-
class
weaver.wps_restapi.colander_extras.
SortableMappingSchema
(*args, **kwargs)[source]¶ Adds sorting capabilities to mapping schema.
Extended schema nodes that inherit from
colander.Mapping
schema-type such that they can request ordering of resulting fields by overriding properties :prop:`_sort_first` and :prop:`_sort_after` within the schema definition with lists of fields names to sort.See also
-
deserialize
(self, cstruct)[source]¶ Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstruct
value is deserialized into anappstruct
unconditionally.If
appstruct
returned by type deserialization and preparation is the valuecolander.null
, do something special before attempting validation:If the
missing
attribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missing
attribute of this node has not been set explicitly, raise acolander.Invalid
exception error.
If the appstruct is not
colander.null
and cannot be validated , acolander.Invalid
exception will be raised.If a
cstruct
argument is not explicitly provided, it defaults tocolander.null
.
-
static
_order_deserialize
(cstruct: Dict[str, Any], sort_first: Optional[Sequence[str]] = None, sort_after: Optional[Sequence[str]] = None) → Dict[str, Any][source]¶ Enforces ordering of expected fields in deserialized result, regardless of specified children/inherited schema.
This function takes care of moving back items in a consistent order for better readability from API responses against different loaded definitions field order from remote servers, local database, pre-defined objects, etc.
This way, any field insertion order from both the input
cstruct
following deserialization operation, the internal mechanics thatcolander
(and extended OpenAPI schema definitions) employ to process this deserialization, and theresult
dictionary fields order obtained from it all don’t matter.Using this, the order of inheritance of schema children classes also doesn’t matter, removing the need to worry about placing classes in any specific order when editing and joining the already complicated structures of inherited schemas.
- Parameters
cstruct – JSON structure to be sorted that has already been processed by a schema’s
deserialize
call.sort_first – ordered list of fields to place first in the result.
sort_after – ordered list of fields to place last in the result.
- Returns
results formed from cstruct following order: (<fields_firsts> + <other_fields> + <fields_after>)
-
-
class
weaver.wps_restapi.colander_extras.
ExtendedSchemaNode
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
-
deserialize
(self, cstruct)[source]¶ Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstruct
value is deserialized into anappstruct
unconditionally.If
appstruct
returned by type deserialization and preparation is the valuecolander.null
, do something special before attempting validation:If the
missing
attribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missing
attribute of this node has not been set explicitly, raise acolander.Invalid
exception error.
If the appstruct is not
colander.null
and cannot be validated , acolander.Invalid
exception will be raised.If a
cstruct
argument is not explicitly provided, it defaults tocolander.null
.
-
-
class
weaver.wps_restapi.colander_extras.
DropableSequenceSchema
(*args, **kwargs)[source]¶ Sequence schema that supports the dropable functionality.
Extends
colander.SequenceSchema
to auto-handle dropping missing entry definitions when its value is eitherNone
,colander.null
orcolander.drop
.
-
class
weaver.wps_restapi.colander_extras.
DefaultSequenceSchema
(*args, **kwargs)[source]¶ Sequence schema that supports the default value functionality.
Extends
colander.SequenceSchema
to auto-handle replacing the result using the provideddefault
value when the deserialization results into a sequence that should normally be dropped.
-
class
weaver.wps_restapi.colander_extras.
ExtendedSequenceSchema
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
-
class
weaver.wps_restapi.colander_extras.
DropableMappingSchema
(*args, **kwargs)[source]¶ Mapping schema that supports the dropable functionality.
Override the default
colander.MappingSchema
to auto-handle dropping missing field definitions when the corresponding value is eitherNone
,colander.null
orcolander.drop
.
-
class
weaver.wps_restapi.colander_extras.
DefaultMappingSchema
(*args, **kwargs)[source]¶ Mapping schema that supports the default value functionality.
Override the default
colander.MappingSchema
to auto-handle replacing missing entries by their specifieddefault
during deserialization.
-
class
weaver.wps_restapi.colander_extras.
VariableMappingSchema
(*args, **kwargs)[source]¶ Mapping schema that supports the variable functionality.
Override the default
colander.MappingSchema
to auto-handle replacing missing entries by their specifiedvariable
during deserialization.
-
class
weaver.wps_restapi.colander_extras.
ExtendedMappingSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
-
class
weaver.wps_restapi.colander_extras.
PermissiveMappingSchema
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.colander_extras.
KeywordMapper
(*args, **kwargs)[source]¶ Generic keyword mapper for any sub-implementers.
Allows specifying multiple combinations of schemas variants for an underlying schema definition. Each implementer must provide the corresponding
keyword
it defines amongst OpenAPI specification keywords.-
_validate_keyword_schemas
(self)[source]¶ Validation of children schemas under keyword.
Validation of keyword sub-nodes to be only defined as schema objects if property
_keyword_schemas_only_object = True
(i.e.: any node that defines its schema type asMapping
).Validation of keyword sub-nodes to all have matching structure of container if
_keyword_schemas_same_struct = True
(i.e.: allcolander.Mapping
, all literal schema-types, etc.).
-
abstract
_deserialize_keyword
(self, cstruct)[source]¶ Deserialization and validation of a keyword-based schema definition.
This method must be implemented by the specific keyword to handle invalid subnodes according to the behaviour it offers.
See also
-
_deserialize_subnode
(self, node, cstruct, index)[source]¶ Deserialization and validation of sub-nodes under a keyword-based schema definition.
This method must be called by keyword deserialization implementers for deserialization of every sub-node in order to apply extended behaviour operations accordingly. The original
deserialize
method ofcolander
schema nodes should not be called directly, otherwise extensions will not be handled. This method will call it after resolving any applicable extension.Note
Because sub-nodes are within a non-schema node iterable, the SchemaMeta will not have extracted the destination name for us (ie: map key to compare against). Furthermore, the destination is not directly in the KeywordMapper class, but in its parent where its instance will be dumped according to the keyword resolution. Therefore, regardless of the child, they all have the same parent destination.
See also
-
deserialize
(self, cstruct)[source]¶ Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstruct
value is deserialized into anappstruct
unconditionally.If
appstruct
returned by type deserialization and preparation is the valuecolander.null
, do something special before attempting validation:If the
missing
attribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missing
attribute of this node has not been set explicitly, raise acolander.Invalid
exception error.
If the appstruct is not
colander.null
and cannot be validated , acolander.Invalid
exception will be raised.If a
cstruct
argument is not explicitly provided, it defaults tocolander.null
.
-
-
class
weaver.wps_restapi.colander_extras.
OneOfKeywordSchema
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
-
class
weaver.wps_restapi.colander_extras.
AllOfKeywordSchema
(*args, **kwargs)[source]¶ Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOf
specifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
-
class
weaver.wps_restapi.colander_extras.
AnyOfKeywordSchema
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchema
to succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
-
class
weaver.wps_restapi.colander_extras.
NotKeywordSchema
(*args, **kwargs)[source]¶ Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
not
specifier of OpenAPI specification.This is equivalent to OpenAPI object mapping with
additionalProperties: false
, but is more explicit in the definition of invalid or conflicting field names with explicit definitions during deserialization.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
-
class
weaver.wps_restapi.colander_extras.
KeywordTypeConverter
(dispatcher)[source]¶ Generic keyword converter that builds schema with a list of sub-schemas under the keyword.
-
class
weaver.wps_restapi.colander_extras.
OneOfKeywordTypeConverter
(dispatcher)[source]¶ Object converter that generates the
oneOf
keyword definition.This object does a bit more work than other
KeywordTypeConverter
as it handles the shorthand definition as described inOneOfKeywordSchema
See also
-
convert_type
(self: OneOfKeywordSchema, schema_node) → Dict[source]¶
-
-
class
weaver.wps_restapi.colander_extras.
AllOfKeywordTypeConverter
(dispatcher)[source]¶ Object converter that generates the
allOf
keyword definition.
-
class
weaver.wps_restapi.colander_extras.
AnyOfKeywordTypeConverter
(dispatcher)[source]¶ Object converter that generates the
anyOf
keyword definition.
-
class
weaver.wps_restapi.colander_extras.
NotKeywordTypeConverter
(dispatcher)[source]¶ Object converter that generates the
not
keyword definition.
-
class
weaver.wps_restapi.colander_extras.
VariableObjectTypeConverter
(dispatcher)[source]¶ Object convertor with
additionalProperties
for eachproperties
marked asVariableSchemaNode
.
-
class
weaver.wps_restapi.colander_extras.
OAS3TypeConversionDispatcher
(custom_converters=None, default_converter=None)[source]¶
-
weaver.wps_restapi.colander_extras.
_make_node_instance
(schema_node_or_class: Union[colander.SchemaNode, Type[colander.SchemaNode]]) → colander.SchemaNode[source]¶ Obtains a schema node instance in case it was specified only by type reference.
This helps being more permissive of provided definitions while handling situations like presented in the example below:
class Map(OneOfMappingSchema): # uses types instead of instances like 'SubMap1([...])' and 'SubMap2([...])' _one_of = (SubMap1, SubMap2)
-
weaver.wps_restapi.colander_extras.
_get_schema_type
(schema_node: Union[colander.SchemaNode, Type[colander.SchemaNode]], check: bool = False) → Optional[colander.SchemaType][source]¶ Obtains the schema-type from the provided node, supporting various initialization methods.
typ
is set by an instantiated node from specific schema (e.g.:colander.SchemaNode(colander.String())
)schema_type
can also be provided, either by type or instance if using class definition with property
- Parameters
schema_node – item to analyse
check – only attempt to retrieve the schema type, and if failing return
None
- Returns
found schema type
- Raises
ConversionTypeError – if no
check
requested and schema type cannot be found (invalid schema node)
-
weaver.wps_restapi.colander_extras.
_get_node_name
(schema_node: colander.SchemaNode, schema_name: bool = False) → str[source]¶ Obtains the name of the node with best available value.
- Parameters
schema_node – node for which to retrieve the name.
schema_name –
If
True
, prefer the schema definition (class) name over the instance or field name.Otherwise, return the field name, the title or as last result the class name.
- Returns
node name
weaver.wps_restapi.swagger_definitions
¶Schema definitions for OpenAPI generation and validation of data from received requests and returned responses.
This module should contain any and every definitions in use to build the Swagger UI and the OpenAPI JSON schema so that one can update the specification without touching any other files after the initial integration.
Schemas defined in this module are employed (through deserialize
method calls) to validate that data conforms to
reported definitions. This makes the documentation of the API better aligned with resulting code execution under it.
It also provides a reference point for external users to understand expected data structures with complete schema
definitions generated on the exposed endpoints (JSON and Swagger UI).
The definitions are also employed to generate the OpenAPI definitions reported in the documentation published on Weaver’s ReadTheDocs page.
-
weaver.wps_restapi.swagger_definitions.
CWL_REPO_URL
= https://github.com/common-workflow-language[source]¶
-
weaver.wps_restapi.swagger_definitions.
IO_INFO_IDS
= Identifier of the {first} {what}. To merge details between corresponding {first} and {second}...[source]¶
-
weaver.wps_restapi.swagger_definitions.
OGC_API_REPO_URL
= https://github.com/opengeospatial/ogcapi-processes[source]¶
-
weaver.wps_restapi.swagger_definitions.
OGC_API_SCHEMA_URL
= https://raw.githubusercontent.com/opengeospatial/ogcapi-processes[source]¶
-
weaver.wps_restapi.swagger_definitions.
PROCESS_DESCRIPTION_FIELD_FIRST
= ['id', 'title', 'version', 'description', 'keywords', 'metadata', 'inputs', 'outputs'][source]¶
-
weaver.wps_restapi.swagger_definitions.
PROCESS_DESCRIPTION_FIELD_AFTER
= ['processDescriptionURL', 'processEndpointWPS1', 'executeEndpoint', 'links'][source]¶
-
weaver.wps_restapi.swagger_definitions.
PROCESS_DESCRIPTION_FIELD_FIRST_OLD_SCHEMA
= ['process'][source]¶
-
weaver.wps_restapi.swagger_definitions.
PROCESS_DESCRIPTION_FIELD_AFTER_OLD_SCHEMA
= ['links'][source]¶
-
weaver.wps_restapi.swagger_definitions.
PROCESS_IO_FIELD_FIRST
= ['id', 'title', 'description', 'minOccurs', 'maxOccurs'][source]¶
-
weaver.wps_restapi.swagger_definitions.
PROCESS_IO_FIELD_AFTER
= ['literalDataDomains', 'formats', 'crs', 'bbox'][source]¶
-
weaver.wps_restapi.swagger_definitions.
PROVIDER_DESCRIPTION_FIELD_FIRST
= ['id', 'title', 'version', 'description', 'url', 'type', 'public', 'keywords', 'metadata'][source]¶
-
class
weaver.wps_restapi.swagger_definitions.
SLUG
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
URL
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
MediaType
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
DateTimeInterval
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
S3Bucket
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
FileLocal
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
FileURL
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
ReferenceURL
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchema
to succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
UUID
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
AnyIdentifier
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
ProcessIdentifier
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchema
to succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
Version
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
ContentTypeHeader
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
AcceptHeader
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
AcceptLanguageHeader
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JsonHeader
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
HtmlHeader
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
XmlHeader
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
RequestContentTypeHeader
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResponseContentTypeHeader
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
RequestHeaders
(*args, **kwargs)[source]¶ Headers that can indicate how to adjust the behavior and/or result the be provided in the response.
-
class
weaver.wps_restapi.swagger_definitions.
ResponseHeaders
(*args, **kwargs)[source]¶ Headers describing resulting response.
-
class
weaver.wps_restapi.swagger_definitions.
RedirectHeaders
(*args, **kwargs)[source]¶ Headers describing resulting response.
-
class
weaver.wps_restapi.swagger_definitions.
NoContent
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
KeywordList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Language
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
ValueLanguage
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LinkLanguage
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
MetadataBase
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
MetadataRole
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LinkRelationshipType
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
LinkRelationship
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LinkBase
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Link
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
MetadataValue
(*args, **kwargs)[source]¶ Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
not
specifier of OpenAPI specification.This is equivalent to OpenAPI object mapping with
additionalProperties: false
, but is more explicit in the definition of invalid or conflicting field names with explicit definitions during deserialization.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchema
AllOfKeywordSchema
AnyOfKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
MetadataContent
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
Metadata
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
MetadataList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LinkList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LandingPage
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FormatSchema
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
deserialize
(self, cstruct)[source]¶ Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstruct
value is deserialized into anappstruct
unconditionally.If
appstruct
returned by type deserialization and preparation is the valuecolander.null
, do something special before attempting validation:If the
missing
attribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missing
attribute of this node has not been set explicitly, raise acolander.Invalid
exception error.
If the appstruct is not
colander.null
and cannot be validated , acolander.Invalid
exception will be raised.If a
cstruct
argument is not explicitly provided, it defaults tocolander.null
.
-
class
weaver.wps_restapi.swagger_definitions.
FormatMimeType
(*args, **kwargs)[source]¶ Used to respect
mimeType
field to work with pre-existing processes.
-
class
weaver.wps_restapi.swagger_definitions.
Format
(*args, **kwargs)[source]¶ Used to respect
mediaType
field as suggested per OGC-API.
-
class
weaver.wps_restapi.swagger_definitions.
DeployFormatDefaultMimeType
(*args, **kwargs)[source]¶ Used to respect
mimeType
field to work with pre-existing processes.
-
class
weaver.wps_restapi.swagger_definitions.
DeployFormatDefault
(*args, **kwargs)[source]¶ Used to respect
mediaType
field as suggested per OGC-API.
-
class
weaver.wps_restapi.swagger_definitions.
FormatSelection
(*args, **kwargs)[source]¶ Validation against
mimeType
ormediaType
format.Note
Format are validated to be retro-compatible with pre-existing/deployed/remote processes.
-
class
weaver.wps_restapi.swagger_definitions.
FormatDescription
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FormatDefault
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionFormat
(*args, **kwargs)[source]¶ Used to respect
mediaType
field as suggested per OGC-API.
-
class
weaver.wps_restapi.swagger_definitions.
DeploymentFormat
(*args, **kwargs)[source]¶ Validation against
mimeType
ormediaType
format.Note
Format are validated to be retro-compatible with pre-existing/deployed/remote processes.
-
class
weaver.wps_restapi.swagger_definitions.
ResultFormat
(*args, **kwargs)[source]¶ Format employed for reference results respecting ‘OGC-API - Processes’ schemas.
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionFormatList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeploymentFormatList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameterUnique
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameterListing
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameterValues
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameterDefinition
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameterList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParametersMeta
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameters
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParametersItem
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchema
to succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParametersList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Content
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Offering
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSContext
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionBase
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionLinks
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessContext
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionExtra
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeploymentType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionMeta
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDeployMeta
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InputOutputDescriptionMeta
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
MinOccursDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
MaxOccursDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeMinMaxOccurs
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployMinMaxOccurs
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InputIdentifierType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputIdentifierType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeWithFormats
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployWithFormats
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeComplexInputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployComplexInputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SupportedCRS
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SupportedCRSList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BoundingBoxInputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyLiteralType
(*args, **kwargs)[source]¶ Submitted values that correspond to literal data.
-
class
weaver.wps_restapi.swagger_definitions.
NumberType
(*args, **kwargs)[source]¶ Represents a literal number, integer or float.
-
class
weaver.wps_restapi.swagger_definitions.
NumericType
(*args, **kwargs)[source]¶ Represents a numeric-like value.
-
class
weaver.wps_restapi.swagger_definitions.
LiteralReference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NameReferenceType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DataTypeSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
UomSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AllowedValuesList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AllowedRange
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AllowedRangesList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AllowedValues
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyValue
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ValuesReference
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchema
to succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ArrayLiteralType
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ArrayLiteralDataType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ArrayLiteralValueType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyLiteralDataType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyLiteralValueType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyLiteralDefaultType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralDataValueDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralDataDomain
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralDataDomainList
(*args, **kwargs)[source]¶ Constraints that apply to the literal data values.
-
class
weaver.wps_restapi.swagger_definitions.
LiteralDataType
(*args, **kwargs)[source]¶ Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
not
specifier of OpenAPI specification.This is equivalent to OpenAPI object mapping with
additionalProperties: false
, but is more explicit in the definition of invalid or conflicting field names with explicit definitions during deserialization.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchema
AllOfKeywordSchema
AnyOfKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralInputType
(*args, **kwargs)[source]¶ Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
not
specifier of OpenAPI specification.This is equivalent to OpenAPI object mapping with
additionalProperties: false
, but is more explicit in the definition of invalid or conflicting field names with explicit definitions during deserialization.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchema
AllOfKeywordSchema
AnyOfKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeInputTypeDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployInputTypeDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeInputType
(*args, **kwargs)[source]¶ Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOf
specifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeInputTypeWithID
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployInputType
(*args, **kwargs)[source]¶ Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOf
specifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployInputTypeWithID
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeInputTypeList
(*args, **kwargs)[source]¶ Listing of process inputs descriptions.
-
class
weaver.wps_restapi.swagger_definitions.
DescribeInputTypeMap
(*args, **kwargs)[source]¶ Description of all process inputs under mapping.
-
class
weaver.wps_restapi.swagger_definitions.
DeployInputTypeList
(*args, **kwargs)[source]¶ Listing of process input definitions to deploy.
-
class
weaver.wps_restapi.swagger_definitions.
DeployInputTypeMap
(*args, **kwargs)[source]¶ Definition of all process inputs under mapping.
-
class
weaver.wps_restapi.swagger_definitions.
DeployInputTypeAny
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralOutputType
(*args, **kwargs)[source]¶ Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
not
specifier of OpenAPI specification.This is equivalent to OpenAPI object mapping with
additionalProperties: false
, but is more explicit in the definition of invalid or conflicting field names with explicit definitions during deserialization.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchema
AllOfKeywordSchema
AnyOfKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
BoundingBoxOutputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeComplexOutputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployComplexOutputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeOutputTypeDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployOutputTypeDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeOutputType
(*args, **kwargs)[source]¶ Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOf
specifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeOutputTypeWithID
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescribeOutputTypeList
(*args, **kwargs)[source]¶ Listing of process outputs descriptions.
-
class
weaver.wps_restapi.swagger_definitions.
DescribeOutputTypeMap
(*args, **kwargs)[source]¶ Definition of all process outputs under mapping.
-
class
weaver.wps_restapi.swagger_definitions.
DeployOutputType
(*args, **kwargs)[source]¶ Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOf
specifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployOutputTypeWithID
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeployOutputTypeList
(*args, **kwargs)[source]¶ Listing of process output definitions to deploy.
-
class
weaver.wps_restapi.swagger_definitions.
DeployOutputTypeMap
(*args, **kwargs)[source]¶ Definition of all process outputs under mapping.
-
class
weaver.wps_restapi.swagger_definitions.
DeployOutputTypeAny
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobExecuteModeEnum
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JobControlOptionsEnum
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JobResponseOptionsEnum
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
TransmissionModeEnum
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JobStatusEnum
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JobSortEnum
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
QuoteSortEnum
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
LaunchJobQuerystring
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VisibilityValue
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JobAccess
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
Visibility
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuotePath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FrontpageEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VersionsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ConformanceEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OpenAPIEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SwaggerUIEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
RedocUIEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSNamespace
[source]¶ Object that provides mapping to known XML extensions for OpenAPI schema definition.
Name of the schema definition in the OpenAPI will use :prop:`prefix` and the schema class name. Prefix can be omitted from the schema definition name by setting it to
colander.drop
. The value oftitle
provided as option orSee also
-
class
weaver.wps_restapi.swagger_definitions.
WPSNamespace
[source]¶ Object that provides mapping to known XML extensions for OpenAPI schema definition.
Name of the schema definition in the OpenAPI will use :prop:`prefix` and the schema class name. Prefix can be omitted from the schema definition name by setting it to
colander.drop
. The value oftitle
provided as option orSee also
-
class
weaver.wps_restapi.swagger_definitions.
XMLNamespace
[source]¶ Object that provides mapping to known XML extensions for OpenAPI schema definition.
Name of the schema definition in the OpenAPI will use :prop:`prefix` and the schema class name. Prefix can be omitted from the schema definition name by setting it to
colander.drop
. The value oftitle
provided as option orSee also
-
class
weaver.wps_restapi.swagger_definitions.
XMLReferenceAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
MimeTypeAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
EncodingAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSVersion
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSAcceptVersions
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSLanguage
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSLanguageAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSService
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSServiceAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSVersionAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSLanguageAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSParameters
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOperationGetNoContent
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOperationPost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSGetCapabilitiesPost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSIdentifier
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSIdentifierList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSTitle
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSAbstract
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSMetadataLink
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSMetadata
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDescribeProcessPost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSExecuteDataInputs
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSExecutePost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSRequestBody
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSHeaders
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSEndpointGet
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSEndpointPost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
XMLBooleanAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
XMLString
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSString
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSKeywordList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSPhone
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSAddress
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSContactInfo
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSServiceContact
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSServiceProvider
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSServiceIdentification
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSOperationName
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OperationLink
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OperationRequest
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWS_HTTP
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWS_DCP
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Operation
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OperationsMetadata
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessVersion
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSProcessSummary
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessOfferings
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSLanguagesType
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSLanguageSpecification
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSResponseBaseType
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessVersion
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSInputDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSLiteralInputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSLiteralData
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSCRSsType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSSupportedCRS
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSSupportedCRSType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSBoundingBoxData
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSFormatDefinition
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSFileFormat
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSFormatList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSComplexInputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSComplexData
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSInputFormChoice
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSMinOccursAttribute
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSMaxOccursAttribute
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDataInputDescription
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDataInputItem
(*args, **kwargs)[source]¶ Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOf
specifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDataInputs
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessOutputs
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSGetCapabilities
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessDescriptionType
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessDescriptionList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDescribeProcess
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPSStatusLocationAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSServiceInstanceAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
CreationTimeAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSStatusSuccess
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSStatusFailed
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSStatus
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessSummary
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputBase
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputDefinitionItem
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputDefinitions
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputLiteral
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSReference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputReference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputData
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDataOutputItem
(*args, **kwargs)[source]¶ Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOf
specifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessOutputs
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSExecuteResponse
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPSXMLSuccessBodySchema
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionCodeAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionLocatorAttribute
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionText
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSException
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionReport
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSException
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkWPSResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ErrorWPSResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescriptionSchemaQuery
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderProcessEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessPackageEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessPayloadEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessVisibilityGetEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessVisibilityPutEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderJobEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessInputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderInputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobInputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessOutputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderOutputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessResultEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderResultEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobResultEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessResultsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderResultsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobResultsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderExceptionsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobExceptionsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessExceptionsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderLogsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobLogsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessLogsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderPublic
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreateProviderRequestBody
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputDataType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteOutputDataType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteOutputDefinition
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteOutputFilterList
(*args, **kwargs)[source]¶ Filter list of outputs to be obtained from execution.
-
class
weaver.wps_restapi.swagger_definitions.
ProviderSummarySchema
(*args, **kwargs)[source]¶ Service provider summary definition.
-
class
weaver.wps_restapi.swagger_definitions.
ProviderCapabilitiesSchema
(*args, **kwargs)[source]¶ Service provider detailed capabilities.
-
class
weaver.wps_restapi.swagger_definitions.
TransmissionModeList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobControlOptionsList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExceptionReportType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessControl
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessLocations
(*args, **kwargs)[source]¶ Additional endpoint locations specific to the process.
-
class
weaver.wps_restapi.swagger_definitions.
ProcessSummary
(*args, **kwargs)[source]¶ Summary process definition.
-
class
weaver.wps_restapi.swagger_definitions.
ProcessSummaryList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessNamesList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessListing
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessCollection
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessVisibility
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Process
(*args, **kwargs)[source]¶ Old nested process schema for process description.
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescriptionOLD
(*args, **kwargs)[source]¶ Old schema for process description.
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescriptionOGC
(*args, **kwargs)[source]¶ OGC-API schema for process description.
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescription
(*args, **kwargs)[source]¶ Supported schema representations of a process description (based on specified query parameters).
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDeployment
(*args, **kwargs)[source]¶ Summary process definition.
-
class
weaver.wps_restapi.swagger_definitions.
JobStatusInfo
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobEntrySchema
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobCollection
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedJobStatusSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedQuotedJobStatusSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetPagingJobsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobCategoryFilters
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
GroupedJobsCategorySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GroupedCategoryJobsSchema
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetGroupedJobsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetQueriedJobsSchema
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DismissedJobSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuoteProcessParametersSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AlternateQuotation
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AlternateQuotationList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DataEncodingAttributes
(*args, **kwargs)[source]¶ Validation against
mimeType
ormediaType
format.Note
Format are validated to be retro-compatible with pre-existing/deployed/remote processes.
-
class
weaver.wps_restapi.swagger_definitions.
Reference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ArrayReference
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ArrayReferenceValueType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputAnyType
(*args, **kwargs)[source]¶ Permissive variants that we attempt to parse automatically.
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputItem
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputListValues
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputInlineValue
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputObjectData
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputObject
(*args, **kwargs)[source]¶ Used to respect
mediaType
field as suggested per OGC-API.
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputArrayValues
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputInline
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputAny
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputMapValues
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecuteInputValues
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
Execute
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Quotation
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuoteProcessListSchema
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuoteSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuotationList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuotationListSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillListSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SupportedValues
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DefaultValues
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLClass
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
RequirementClass
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
DockerRequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
DockerRequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DockerRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
DockerGpuRequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
DockerGpuRequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DockerGpuRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
DirectoryListing
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
InitialWorkDirListing
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InitialWorkDirRequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
InitialWorkDirRequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InitialWorkDirRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
BuiltinRequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
BuiltinRequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BuiltinRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
ESGF_CWT_RequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
ESGF_CWT_RequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ESGF_CWT_RequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPS1RequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPS1RequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPS1RequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
UnknownRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLRequirementsMap
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchema
to succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLRequirementsItem
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLRequirementsList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLRequirements
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLHintsMap
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchema
to succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLHintsItem
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLHintsList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLHints
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLArguments
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeString
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeSymbolValues
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeSymbols
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeArray
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeEnum
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeBase
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLType
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyLiteralList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLDefault
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputObject
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeStringList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputType
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputMap
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputItem
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputsDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputBinding
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputObject
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputType
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputItem
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputsDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLCommandParts
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLCommand
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLVersion
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
CWL
(*args, **kwargs)[source]¶ Object schema that will allow any unknown field to remain present in the resulting deserialization.
This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
Unit
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
UndeploymentResult
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeploymentResult
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProvidersListSchema
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderNamesSchema
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderListing
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProvidersBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderProcessesSchema
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutputValue
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutput
(*args, **kwargs)[source]¶ Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOf
specifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutputList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultLiteral
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultLiteralList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ValueFormatted
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ValueFormattedList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultReference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultReferenceList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultData
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
Result
(*args, **kwargs)[source]¶ Result outputs obtained from a successful process job execution.
-
class
weaver.wps_restapi.swagger_definitions.
JobInputsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutputsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobException
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobExceptionsSchema
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobLogsSchema
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FrontpageParameterSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FrontpageParameters
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FrontpageSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SwaggerJSONSpecSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SwaggerUISpecSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VersionsSpecSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VersionsList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VersionsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ConformanceList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ConformanceSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PackageBody
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecutionUnit
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecutionUnitList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDeploymentOffering
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescriptionChoiceType
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOf
specifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize
) process will succeed if only one of the_one_of
variants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFields
in the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>])
.The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic expansion occurs during schema generationWarning
When calling
deserialize()
, because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminator
supports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"
is provided, the definition will be created automatically using theexample
(which should be only the matching value) of the corresponding field of each node within the_one_of
mapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
Deploy
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProcessesEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProcessJobsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetJobsQueries
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetJobsRequest
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetJobsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobIdentifierList
(*args, **kwargs)[source]¶ Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeleteJobsBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeleteJobsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProcessJobsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProviderJobsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProcessJobEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeleteProcessJobEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessQuotesEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessQuoteEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetQuotesQueries
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuotesEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuoteEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProcessQuote
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostQuote
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProcessQuoteRequestEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProvidersQuerySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProviders
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProvider
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProviderProcesses
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProviderProcess
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProviderProcessJobRequest
(*args, **kwargs)[source]¶ Launching a new process request definition.
-
class
weaver.wps_restapi.swagger_definitions.
ErrorDetail
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSErrorCode
(*args, **kwargs)[source]¶ Base schema node with support of extended functionalities.
Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionResponse
(*args, **kwargs)[source]¶ Error content in XML format.
-
class
weaver.wps_restapi.swagger_definitions.
ErrorJsonResponseBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BadRequestResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
UnprocessableEntityResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ForbiddenProcessAccessResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ForbiddenProviderAccessResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ForbiddenProviderLocalResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InternalServerErrorResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetFrontpageResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetSwaggerJSONResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetSwaggerUIResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetRedocUIResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetVersionsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetConformanceResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProvidersListResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProviderCapabilitiesSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NoContentDeleteProviderSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NotImplementedDeleteProviderResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProviderProcessesSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProcessesQuery
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProcessesEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessesListResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkPostProcessDeployBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkPostProcessesResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BadRequestGetProcessInfoResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessInfoResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessPackageSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessPayloadSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessVisibilityResponseBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessVisibilitySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkPutProcessVisibilitySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ForbiddenVisibilityUpdateResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkDeleteProcessUndeployBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkDeleteProcessResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProviderProcessDescriptionResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedPostProvider
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NotImplementedPostProviderResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedJobLocationHeader
(*args, **kwargs)[source]¶ Headers describing resulting response.
-
class
weaver.wps_restapi.swagger_definitions.
CreatedLaunchJobResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessJobResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkDeleteProcessJobResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetQueriedJobsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BatchDismissJobsBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkBatchDismissJobsResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkDismissJobResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobStatusResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NotFoundJobResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobInputsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobOutputsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
RedirectResultResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobResultsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedQuoteExecuteResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedQuoteRequestResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetQuoteInfoResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetQuoteListResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetBillDetailResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetBillListResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobExceptionsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobLogsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
SortableMappingSchema
PermissiveMappingSchema
-
weaver.wps_restapi.swagger_definitions.
service_api_route_info
(service_api: cornice.Service, settings: weaver.typedefs.SettingsType) → ViewInfo[source]¶ Automatically generates the view configuration parameters from the
cornice
service definition.- Parameters
service_api – cornice service with name and path definition.
settings – settings to obtain the base path of the application.
- Returns
view configuration parameters that can be passed directly to
config.add_route
call.
weaver.wps_restapi.utils
¶-
weaver.wps_restapi.utils.
wps_restapi_base_path
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶
-
weaver.wps_restapi.utils.
get_wps_restapi_base_url
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶
-
weaver.wps_restapi.utils.
get_schema_ref
(schema: colander.SchemaNode, container: weaver.typedefs.AnySettingsContainer, ref_type: str = '$schema', ref_name: True = True) → Dict[str, str][source]¶ Generates the JSON OpenAPI schema reference relative to the current Weaver instance.
The provided schema should be one of the items listed in
#/definitions
of the/json
endpoint. No validation is accomplished to avoid long processing of all references.If setting
weaver.schema_url
is set, this value will be used direct as fully-defined base URL. This could be used to refer to a static endpoint where schemas are hosted. Otherwise, the current Web Application resolved location is employed with JSON OpenAPI path.- Parameters
schema – schema-node instance or type for which to generate the OpenAPI reference.
container – application settings to retrieve the base URL of the schema location.
ref_type – key employed to form the reference (e.g.: “$schema”, “$ref”, “@schema”, etc.)
ref_name – indicate if the plain name should also be included under field
"schema"
.
- Returns
OpenAPI schema reference
Submodules¶
weaver.app
¶
Weaver Web Application (weaver-manager
).
weaver.config
¶
-
weaver.config.
get_weaver_configuration
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Obtains the defined operation configuration mode.
- Returns
one value amongst
weaver.config.WEAVER_CONFIGURATIONS
.
-
weaver.config.
get_weaver_config_file
(file_path: str, default_config_file: str, generate_default_from_example: bool = True) → str[source]¶ Validates that the specified configuration file can be found, or falls back to the default one.
Handles ‘relative’ paths for settings in
WEAVER_DEFAULT_INI_CONFIG
referring to other configuration files. Default file must be one ofWEAVER_DEFAULT_CONFIGS
.If both the specified file and the default file cannot be found, default file under
WEAVER_DEFAULT_INI_CONFIG
is auto-generated from the corresponding.example
file ifgenerate_default_from_example
isTrue
. If it isFalse
, an empty string is returned instead without generation since no existing file can be guaranteed, and it is up to the caller to handle this situation as it explicitly disabled generation.- Parameters
file_path – path to a configuration file (can be relative if resolvable or matching a default file name)
default_config_file – one of
WEAVER_DEFAULT_CONFIGS
.generate_default_from_example – enable fallback copy of default configuration file from corresponding example.
- Returns
absolute path of the resolved file.
weaver.datatype
¶
-
class
weaver.datatype.
Base
[source]¶ Dictionary with extended attributes auto-
getter
/setter
for convenience.Explicitly overridden
getter
/setter
attributes are called instead ofdict
-keyget
/set
-item to ensure corresponding checks and/or value adjustments are executed before applying it to the sub-dict
.Initialize self. See help(type(self)) for accurate signature.
-
abstract
json
(self) → weaver.typedefs.JSON[source]¶ Obtain the JSON data representation for response body.
Note
This method implementation should validate the JSON schema against the API definition whenever applicable to ensure integrity between the represented data type and the expected API response.
-
abstract
-
class
weaver.datatype.
Service
(*args, **kwargs)[source]¶ Dictionary that contains OWS services.
It always has
url
key.Initialize self. See help(type(self)) for accurate signature.
-
json
(self) → weaver.typedefs.JSON[source]¶ Obtain the JSON data representation for response body.
Note
This method implementation should validate the JSON schema against the API definition whenever applicable to ensure integrity between the represented data type and the expected API response.
-
params
(self) → Dict[str, Any][source]¶ Obtain the internal data representation for storage.
Note
This method implementation should provide a JSON-serializable definition of all fields representing the object to store.
-
wps
(self: weaver.typedefs.AnySettingsContainer, container: Any = None, **kwargs) → owslib.wps.WebProcessingService[source]¶ Obtain the remote WPS service definition and metadata.
Stores the reference locally to avoid re-fetching it needlessly for future reference.
-
links
(self: weaver.typedefs.AnySettingsContainer, container: bool, fetch=True) → List[weaver.typedefs.JSON][source]¶ Obtains the links relevant to the service provider.
-
metadata
(self: weaver.typedefs.AnySettingsContainer, container) → List[weaver.typedefs.JSON][source]¶ Obtains the metadata relevant to the service provider.
-
keywords
(self: weaver.typedefs.AnySettingsContainer, container=None) → List[str][source]¶ Obtains the keywords relevant to the service provider.
-
summary
(self: weaver.typedefs.AnySettingsContainer, container: bool, fetch: bool = True, ignore=False) → Optional[weaver.typedefs.JSON][source]¶ Obtain the summary information from the provider service.
When metadata fetching is disabled, the generated summary will contain only information available locally.
- Parameters
container – employed to retrieve application settings.
fetch – indicates whether metadata should be fetched from remote.
ignore – indicates if failing metadata retrieval/parsing should be silently discarded or raised.
- Returns
generated summary information.
-
processes
(self: weaver.typedefs.AnySettingsContainer, container) → List[Process][source]¶ Obtains a list of remote service processes in a compatible
weaver.datatype.Process
format.Note: remote processes won’t be stored to the local process storage.
-
-
class
weaver.datatype.
Job
(*args, **kwargs)[source]¶ Dictionary that contains OWS service jobs.
It always has
id
andtask_id
keys.Initialize self. See help(type(self)) for accurate signature.
-
_get_log_msg
(self: Optional[str], msg: Optional[str] = None, status: Optional[weaver.typedefs.Number] = None, progress=None) → str[source]¶
-
save_log
(self: Ellipsis, errors: Optional[Union[str, Exception, owslib.wps.WPSException, List[owslib.wps.WPSException]]] = None, logger: Optional[logging.Logger] = None, message: Optional[str] = None, level: int = INFO, status: Optional[str] = None, progress: Optional[weaver.typedefs.Number] = None) → None[source]¶ Logs the specified error and/or message, and adds the log entry to the complete job log.
For each new log entry, additional
Job
properties are added according toJob._get_log_msg()
and the format defined byget_job_log_msg()
.- Parameters
errors – An error message or a list of WPS exceptions from which to log and save generated message stack.
logger – An additional
Logger
for which to propagate logged messages on top saving them to the job.message – Explicit string to be logged, otherwise use the current
Job.status_message
is used.level – Logging level to apply to the logged
message
. This parameter is ignored iferrors
are logged.status – Override status applied in the logged message entry, but does not set it to the job object. Uses the current :prop:`Job.status` value if not specified. Must be one of
Weaver.status
values.progress – Override progress applied in the logged message entry, but does not set it to the job object. Uses the current :prop:`Job.progress` value if not specified.
Note
The job object is updated with the log but still requires to be pushed to database to actually persist it.
-
property
task_id
(self) → Optional[str][source]¶ Reference Task UUID attributed by the
Celery
worker that monitors and executes this job.
-
property
wps_id
(self) → Optional[str][source]¶ Reference WPS Request/Response UUID attributed by the executed
PyWPS
process.This UUID matches the status-location, log and output directory of the WPS process. This parameter is only available when the process is executed on this local instance.
See also
-
property
service
(self) → Optional[str][source]¶ Service identifier of the corresponding remote process.
See also
-
property
process
(self) → Optional[str][source]¶ Process identifier of the corresponding remote process.
See also
-
property
created
(self) → datetime.datetime[source]¶
-
property
started
(self) → Optional[datetime.datetime][source]¶
-
property
finished
(self) → Optional[datetime.datetime][source]¶
-
property
updated
(self) → datetime.datetime[source]¶
-
property
duration
(self) → Optional[datetime.timedelta][source]¶
-
property
request
(self) → Optional[str][source]¶ XML request for WPS execution submission as string (binary).
-
property
response
(self) → Optional[str][source]¶ XML status response from WPS execution submission as string (binary).
-
links
(self: Optional[weaver.typedefs.AnySettingsContainer], container: Optional[str] = None, self_link=None) → weaver.typedefs.JSON[source]¶ Obtains the JSON links section of many response body for jobs.
If
self_link
is provided (e.g.: “outputs”) the link for that corresponding item will also be added as self entry to the links. It must be a recognized job link field.- Parameters
container – object that helps retrieve instance details, namely the host URL.
self_link – name of a section that represents the current link that will be returned.
-
json
(self: Optional[weaver.typedefs.AnySettingsContainer], container: Optional[str] = None, self_link=None) → weaver.typedefs.JSON[source]¶ Obtains the JSON data representation for response body.
Note
Settings are required to update API shortcut URLs to job additional information. Without them, paths will not include the API host, which will not resolve to full URI.
-
-
class
weaver.datatype.
Process
(*args, **kwargs)[source]¶ Dictionary that contains a process definition for db storage.
It always has
identifier
(orid
alias) and apackage
definition. Parameters can be accessed by key or attribute, and appropriate validators or default values will be applied.Initialize self. See help(type(self)) for accurate signature.
-
property
inputs
(self) → Optional[List[Dict[str, Any]]][source]¶ Inputs of the process following backward-compatible conversion of stored parameters.
- According to OGC-API,
maxOccurs
andminOccurs
representations should be: maxOccurs
:int
or"unbounded"
minOccurs
:int
- And,
mediaType
should be in description as: mediaType
:string
Note
Because of pre-registered/deployed/retrieved remote processes, inputs are formatted in-line to respect valid OGC-API schema representation and apply any required correction transparently.
- According to OGC-API,
-
property
outputs
(self) → Optional[List[Dict[str, Any]]][source]¶ Outputs of the process following backward-compatible conversion of stored parameters.
- According to OGC-API,
mediaType
should be in description as: mediaType
:string
Note
Because of pre-registered/deployed/retrieved remote processes, inputs are formatted in-line to respect valid OGC-API schema representation and apply any required correction transparently.
- According to OGC-API,
-
property
type
(self) → str[source]¶ Type of process amongst
weaver.processes.types
definitions.
-
static
_recursive_replace
(pkg: weaver.typedefs.JSON, index_from: int, index_to: int) → weaver.typedefs.JSON[source]¶
-
params
(self) → Dict[str, Any][source]¶ Obtain the internal data representation for storage.
Note
This method implementation should provide a JSON-serializable definition of all fields representing the object to store.
-
property
params_wps
(self) → Dict[str, Any][source]¶ Values applicable to create an instance of
pywps.app.Process
.
-
json
(self) → weaver.typedefs.JSON[source]¶ Obtains the JSON serializable complete representation of the process.
-
links
(self: Optional[weaver.typedefs.AnySettingsContainer], container=None) → weaver.typedefs.JSON[source]¶ Obtains the JSON links section of many response body for the process.
- Parameters
container – object that helps retrieve instance details, namely the host URL.
-
offering
(self: str, schema='OGC') → weaver.typedefs.JSON[source]¶ Obtains the JSON serializable offering/description representation of the process.
- Parameters
schema – One of values defined by
sd.ProcessDescriptionSchemaQuery
to select which process description representation to generate (see each schema for details).
Note
Property name
offering
is employed to differentiate from the string processdescription
field. The result of this JSON representation is still theProcessDescription
schema.
-
summary
(self) → weaver.typedefs.JSON[source]¶ Obtains the JSON serializable summary representation of the process.
-
static
from_wps
(wps_process: pywps.Process, **extra_params: Any) → Process[source]¶ Converts a
pywps
Process into aweaver.datatype.Process
using provided parameters.
-
static
from_ows
(process: owslib.wps.Process, service: Service, container: weaver.typedefs.AnySettingsContainer, **kwargs: Any) → Process[source]¶ Converts a
owslib.wps
Process to local storageweaver.datatype.Process
.
-
property
service
(self) → Optional[str][source]¶ Name of the parent service provider under which this process resides.
See also
-
property
-
class
weaver.datatype.
Quote
(*args, **kwargs)[source]¶ Dictionary that contains quote information.
It always has
id
andprocess
keys.Initialize self. See help(type(self)) for accurate signature.
-
class
weaver.datatype.
Bill
(*args, **kwargs)[source]¶ Dictionary that contains bill information.
It always has
id
,user
,quote
andjob
keys.Initialize self. See help(type(self)) for accurate signature.
weaver.exceptions
¶
Some of these error inherit from weaver.owsexceptions.OWSException
and their derived classes to allow
pywps
to automatically understand and render those exception if raised by an underlying weaver
operation.
-
exception
weaver.exceptions.
WeaverException
[source]¶ Base class of exceptions defined by
weaver
package.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
InvalidIdentifierValue
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to an invalid identifier parameter.
Error indicating that an ID to be employed for following operations is not considered as valid to allow further processing or usage.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
MissingIdentifierValue
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to missing identifier parameter.
Error indicating that an ID to be employed for following operations was missing and cannot continue further processing or usage.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ServiceException
(detail=None, value=None, **kw)[source]¶ Base exception related to a
weaver.datatype.Service
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ServiceParsingError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to parsing issue of the reference service definition (incorrectly formed XML/JSON contents).
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ServiceNotAccessible
(detail=None, headers=None, comment=None, body_template=None, result=None, **kw)[source]¶ Error related to forbidden access to a service.
Error indicating that a WPS service exists but is not visible to retrieve from the storage backend of an instance of
weaver.store.ServiceStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ServiceNotFound
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to non existant service definition.
Error indicating that an OWS service could not be read from the storage backend by an instance of
weaver.store.ServiceStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ServiceRegistrationError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a registration issue for a service.
Error indicating that an OWS service could not be registered in the storage backend by an instance of
weaver.store.ServiceStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ProcessException
(detail=None, value=None, **kw)[source]¶ Base exception related to a
weaver.datatype.Process
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ProcessNotAccessible
(detail=None, headers=None, comment=None, body_template=None, result=None, **kw)[source]¶ Error related to forbidden access to a process.
Error indicating that a local WPS process exists but is not visible to retrieve from the storage backend of an instance of
weaver.store.ProcessStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ProcessNotFound
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a non existant process definition.
Error indicating that a local WPS process could not be read from the storage backend by an instance of
weaver.store.ProcessStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ProcessRegistrationError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a registration issue for a process.
Error indicating that a WPS process could not be registered in the storage backend by an instance of
weaver.store.ProcessStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
ProcessInstanceError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to an invalid process definition.
Error indicating that the process instance passed is not supported with storage backend by an instance of
weaver.store.ProcessStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
JobException
[source]¶ Base exception related to a
weaver.datatype.Job
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
JobNotFound
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a non existant job definition.
Error indicating that a job could not be read from the storage backend by an instance of
weaver.store.JobStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
JobInvalidParameter
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to an invalid search parameter to filter jobs.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
JobRegistrationError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a registration issue for a job.
Error indicating that a job could not be registered in the storage backend by an instance of
weaver.store.JobStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
JobUpdateError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to an update issue for a job.
Error indicating that a job could not be updated in the storage backend by an instance of
weaver.store.JobStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
PackageException
[source]¶ Base exception related to a
weaver.processes.wps_package.Package
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
PackageTypeError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to an invalid package definition.
Error indicating that an instance of
weaver.processes.wps_package.WpsPackage
could not properly parse input/output type(s) for package deployment or execution.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
PackageRegistrationError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a registration issue for a package.
Error indicating that an instance of
weaver.processes.wps_package.WpsPackage
could not properly be registered for package deployment because of invalid prerequisites.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
PackageExecutionError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a runtime issue during package execution.
Error indicating that an instance of
weaver.processes.wps_package.WpsPackage
could not properly execute the package using provided inputs and package definition.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
PackageNotFound
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a non existant package definition.
Error indicating that an instance of
weaver.processes.wps_package.WpsPackage
could not properly retrieve the package definition using provided references.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
PayloadNotFound
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a non existant deployment payload definition.
Error indicating that an instance of
weaver.processes.wps_package.WpsPackage
could not properly retrieve the package deploy payload using provided references.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
QuoteException
[source]¶ Base exception related to a
weaver.datatype.Quote
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
QuoteNotFound
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a non existant quote definition.
Error indicating that a quote could not be read from the storage backend by an instance of
weaver.store.QuoteStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
QuoteRegistrationError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to an invalid registration issue for a quote.
Error indicating that a quote could not be registered in the storage backend by an instance of
weaver.store.QuoteStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
QuoteInstanceError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to an invalid quote definition.
Error indicating that a given object doesn’t correspond to an expected instance of
weaver.datatype.Quote
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
BillException
[source]¶ Base exception related to a
weaver.datatype.Bill
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
BillNotFound
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a non existant bill definition.
Error indicating that a bill could not be read from the storage backend by an instance of
weaver.store.BillStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
BillRegistrationError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to a registration issue for a bill.
Error indicating that a bill could not be registered in the storage backend by an instance of
weaver.store.BillStore
.Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.exceptions.
BillInstanceError
(detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw)[source]¶ Error related to an invalid bill definition.
Error indicating that a given object doesn’t correspond to an expected instance of
weaver.datatype.Bill
.Initialize self. See help(type(self)) for accurate signature.
-
weaver.exceptions.
handle_known_exceptions
(function: Callable[[Any, Any], Any]) → Callable[source]¶ Decorator that catches lower-level raised exception that are known to
weaver
but not bypywps
.See also
weaver.wps.service.WorkerService
Without prior handling of known internal exception,
pywps
generates by default500
internal server error response since it doesn’t know how to interpret more specific exceptions defined inweaver
.The decorator simply returns the known exception such that
weaver.tweens.ows_response_tween()
can later handle it appropriately. Exceptions derived from :exception:`weaver.owsexceptions.OWSException` are employed since they themselves have base references topywps.exceptions
classes that the service can understand.Warning
In
pywps
,HTTPException
refers to :exception:`werkzeug.exceptions.HTTPException` while inweaver
, it is :exception:`pyramid.httpexceptions.HTTPException`. They both offer similar interfaces and functionalities (headers, body, status-code, etc.), but they are not intercepted in the same try/except blocks.
-
weaver.exceptions.
log_unhandled_exceptions
(logger: logging.Logger = LOGGER, message: str = 'Unhandled exception occurred.', exception: Type[Exception] = Exception, force: bool = False, require_http: bool = True, is_request: bool = True) → Callable[source]¶ Decorator for logging captured exceptions before re-raise.
Decorator that will raise
exception
with specifiedmessage
if an exception is caught while execution the wrapped function, after logging relevant details about the caught exception withlogger
.- Parameters
logger – logger to use for logging (default: use
weaver.exception.LOGGER
).message – message that will be logged with details and then raised with
exception
.exception – exception type to be raised instead of the caught exception.
force – force handling of any raised exception (default: only known unhandled exceptions are logged).
require_http – consider non HTTP-like exceptions as unknown and raise one instead (default:
True
and raisesHTTPInternalServerError
, unlessexception
is HTTP-like).is_request – specifies if the decorator is applied onto a registered request function to handle its inputs.
- Raises
exception – if an unknown exception was caught (or forced) during the decorated function’s execution.
Exception – original exception if it is known.
weaver.execute
¶
weaver.formats
¶
-
weaver.formats.
get_format
(mime_type: str, default: Optional[str] = None) → pywps.inout.formats.Format[source]¶ Obtains a
Format
with predefined extension and encoding details from known MIME-types.
-
weaver.formats.
get_extension
(mime_type: str) → str[source]¶ Retrieves the extension corresponding to
mime_type
if explicitly defined, or by parsing it.
-
weaver.formats.
get_cwl_file_format
(mime_type: str, make_reference: bool = False, must_exist: bool = True, allow_synonym: bool = True) → Union[Tuple[Optional[weaver.typedefs.JSON], Optional[str]], Optional[str]][source]¶ Obtains the extended schema reference from the media-type identifier.
Obtains the corresponding IANA/EDAM
format
value to be applied under a CWL I/OFile
from themime_type
(Content-Type header) using the first matched one.Lookup procedure is as follows:
- If
make_reference=False
: - If there is a match, returns
tuple({<namespace-name: namespace-url>}, <format>)
with: corresponding namespace mapping to be applied under
$namespaces
in the CWL.value of
format
adjusted according to the namespace to be applied toFile
in the CWL.
- If there is a match, returns
If there is no match but
must_exist=False
, returns a literal and non-existing definition astuple({"iana": <iana-url>}, <format>)
.If there is no match but
must_exist=True
ANDallow_synonym=True
, retry the call with the synonym if available, or move to next step. Skip this step ifallow_synonym=False
.Otherwise, returns
(None, None)
- If
- If
make_reference=True
: If there is a match, returns the explicit format reference as
<namespace-url>/<format>
.If there is no match but
must_exist=False
, returns the literal reference as<iana-url>/<format>
(N.B.: literal non-official MIME-type reference will be returned even if an official synonym exists).If there is no match but
must_exist=True
ANDallow_synonym=True
, retry the call with the synonym if available, or move to next step. Skip this step ifallow_synonym=False
.Returns a single
None
as there is not match (directly or synonym).
- If
- Note:
In situations where
must_exist=False
is used and that the namespace and/or full format URL cannot be resolved to an existing reference, CWL will raise a validation error as it cannot confirm theformat
. You must therefore make sure that the returned reference (or a synonym format) really exists when usingmust_exist=False
before providing it to the CWL I/O definition. Settingmust_exist=False
should be used only for literal string comparison or pre-processing steps to evaluate formats.
- Parameters
mime_type – Some reference, namespace’d or literal (possibly extended) MIME-type string.
make_reference – Construct the full URL reference to the resolved MIME-type. Otherwise return tuple details.
must_exist – Return result only if it can be resolved to an official MIME-type (or synonym if enabled), otherwise
None
. Non-official MIME-type can be enforced if disabled, in which case IANA namespace/URL is used as it preserves the original<type>/<subtype>
format.allow_synonym – Allow resolution of non-official MIME-type to an official MIME-type synonym if available. Types defined as synonym have semantically the same format validation/resolution for CWL. Requires
must_exist=True
, otherwise the non-official MIME-type is employed directly as result.
- Returns
Resolved MIME-type format for CWL usage, accordingly to specified arguments (see description details).
-
weaver.formats.
clean_mime_type_format
(mime_type: str, suffix_subtype: bool = False, strip_parameters: bool = False) → str[source]¶ Obtains a generic media-type identifier by cleaning up any additional parameters.
Removes any additional namespace key or URL from
mime_type
so that it corresponds to the generic representation (e.g.:application/json
) instead of the<namespace-name>:<format>
mapping variant used in CWL->inputs/outputs->File->format or the complete URL reference.According to provided arguments, it also cleans up additional parameters or extracts sub-type suffixes.
- Parameters
mime_type – MIME-type, full URL to MIME-type or namespace-formatted string that must be cleaned up.
suffix_subtype – Remove additional sub-type specializations details separated by
+
symbol such that an explicit format likeapplication/vnd.api+json
returns only its most basic suffix format defined as``application/json``.strip_parameters – Removes additional MIME-type parameters such that only the leading part defining the
type/subtype
are returned. For example, this will get rid of; charset=UTF-8
or; version=4.0
parameters.
Note
Parameters
suffix_subtype
andstrip_parameters
are not necessarily exclusive.
weaver.owsexceptions
¶
Exceptions are based on pyramid.httpexceptions
and pywps.exceptions
to handle more cases where they can
be caught whether the running process is via weaver
or through pywps
service.
Furthermore, interrelation with weaver.exceptions
classes (with base
:exception:`weaver.exceptions.WeaverException`) also employ specific :exception:`OWSExceptions` definitions to provide
specific error details.
-
exception
weaver.owsexceptions.
OWSException
(detail=None, value=None, **kw)[source]¶ Represents a WSGI response.
If no arguments are passed, creates a
Response
that uses a variety of defaults. The defaults may be changed by sub-classing theResponse
. See the sub-classing notes.- Variables
body (bytes or text_type) – If
body
is atext_type
, then it will be encoded using eithercharset
when provided ordefault_encoding
whencharset
is not provided if thecontent_type
allows for acharset
. This argument is mutually exclusive withapp_iter
.status (int or str) – Either an
int
or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.headerlist (list) – A list of HTTP headers for the response.
app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with
body
.content_type (str or None) – Sets the
Content-Type
header. If nocontent_type
is provided, and there is noheaderlist
, thedefault_content_type
will be automatically set. Ifheaderlist
is provided then this value is ignored.conditional_response (bool) – Used to change the behavior of the
Response
to check the original request for conditional response headers. Seeconditional_response_app()
for more information.charset (str or None) – Adds a
charset
Content-Type
parameter. If nocharset
is provided and theContent-Type
is text, then thedefault_charset
will automatically be added. Currently the onlyContent-Type
’s that allow for acharset
are defined to betext/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added. If aheaderlist
is provided this value is ignored.
All other response attributes may be set on the response by providing them as keyword arguments. A
TypeError
will be raised for any unexpected keywords.Sub-classing notes:
The
default_content_type
is used as the default for theContent-Type
header that is returned on the response. It istext/html
.The
default_charset
is used as the default character set to return on theContent-Type
header, if theContent-Type
allows for acharset
parameter. Currently the onlyContent-Type
’s that allow for acharset
are defined to be:text/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added.The
unicode_errors
is set tostrict
, and access on atext
will raise an error if it fails to decode thebody
.default_conditional_response
is set toFalse
. This flag may be set toTrue
so that allResponse
objects will attempt to check the original request for conditional response headers. Seeconditional_response_app()
for more information.default_body_encoding
is set to ‘UTF-8’ by default. It exists to allow users to get/set theResponse
object using.text
, even if nocharset
has been set for theContent-Type
.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.owsexceptions.
OWSAccessForbidden
(*args, **kwargs)[source]¶ Represents a WSGI response.
If no arguments are passed, creates a
Response
that uses a variety of defaults. The defaults may be changed by sub-classing theResponse
. See the sub-classing notes.- Variables
body (bytes or text_type) – If
body
is atext_type
, then it will be encoded using eithercharset
when provided ordefault_encoding
whencharset
is not provided if thecontent_type
allows for acharset
. This argument is mutually exclusive withapp_iter
.status (int or str) – Either an
int
or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.headerlist (list) – A list of HTTP headers for the response.
app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with
body
.content_type (str or None) – Sets the
Content-Type
header. If nocontent_type
is provided, and there is noheaderlist
, thedefault_content_type
will be automatically set. Ifheaderlist
is provided then this value is ignored.conditional_response (bool) – Used to change the behavior of the
Response
to check the original request for conditional response headers. Seeconditional_response_app()
for more information.charset (str or None) – Adds a
charset
Content-Type
parameter. If nocharset
is provided and theContent-Type
is text, then thedefault_charset
will automatically be added. Currently the onlyContent-Type
’s that allow for acharset
are defined to betext/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added. If aheaderlist
is provided this value is ignored.
All other response attributes may be set on the response by providing them as keyword arguments. A
TypeError
will be raised for any unexpected keywords.Sub-classing notes:
The
default_content_type
is used as the default for theContent-Type
header that is returned on the response. It istext/html
.The
default_charset
is used as the default character set to return on theContent-Type
header, if theContent-Type
allows for acharset
parameter. Currently the onlyContent-Type
’s that allow for acharset
are defined to be:text/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added.The
unicode_errors
is set tostrict
, and access on atext
will raise an error if it fails to decode thebody
.default_conditional_response
is set toFalse
. This flag may be set toTrue
so that allResponse
objects will attempt to check the original request for conditional response headers. Seeconditional_response_app()
for more information.default_body_encoding
is set to ‘UTF-8’ by default. It exists to allow users to get/set theResponse
object using.text
, even if nocharset
has been set for theContent-Type
.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.owsexceptions.
OWSNotFound
(*args, **kwargs)[source]¶ Represents a WSGI response.
If no arguments are passed, creates a
Response
that uses a variety of defaults. The defaults may be changed by sub-classing theResponse
. See the sub-classing notes.- Variables
body (bytes or text_type) – If
body
is atext_type
, then it will be encoded using eithercharset
when provided ordefault_encoding
whencharset
is not provided if thecontent_type
allows for acharset
. This argument is mutually exclusive withapp_iter
.status (int or str) – Either an
int
or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.headerlist (list) – A list of HTTP headers for the response.
app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with
body
.content_type (str or None) – Sets the
Content-Type
header. If nocontent_type
is provided, and there is noheaderlist
, thedefault_content_type
will be automatically set. Ifheaderlist
is provided then this value is ignored.conditional_response (bool) – Used to change the behavior of the
Response
to check the original request for conditional response headers. Seeconditional_response_app()
for more information.charset (str or None) – Adds a
charset
Content-Type
parameter. If nocharset
is provided and theContent-Type
is text, then thedefault_charset
will automatically be added. Currently the onlyContent-Type
’s that allow for acharset
are defined to betext/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added. If aheaderlist
is provided this value is ignored.
All other response attributes may be set on the response by providing them as keyword arguments. A
TypeError
will be raised for any unexpected keywords.Sub-classing notes:
The
default_content_type
is used as the default for theContent-Type
header that is returned on the response. It istext/html
.The
default_charset
is used as the default character set to return on theContent-Type
header, if theContent-Type
allows for acharset
parameter. Currently the onlyContent-Type
’s that allow for acharset
are defined to be:text/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added.The
unicode_errors
is set tostrict
, and access on atext
will raise an error if it fails to decode thebody
.default_conditional_response
is set toFalse
. This flag may be set toTrue
so that allResponse
objects will attempt to check the original request for conditional response headers. Seeconditional_response_app()
for more information.default_body_encoding
is set to ‘UTF-8’ by default. It exists to allow users to get/set theResponse
object using.text
, even if nocharset
has been set for theContent-Type
.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.owsexceptions.
OWSNotAcceptable
(*args, **kwargs)[source]¶ Represents a WSGI response.
If no arguments are passed, creates a
Response
that uses a variety of defaults. The defaults may be changed by sub-classing theResponse
. See the sub-classing notes.- Variables
body (bytes or text_type) – If
body
is atext_type
, then it will be encoded using eithercharset
when provided ordefault_encoding
whencharset
is not provided if thecontent_type
allows for acharset
. This argument is mutually exclusive withapp_iter
.status (int or str) – Either an
int
or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.headerlist (list) – A list of HTTP headers for the response.
app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with
body
.content_type (str or None) – Sets the
Content-Type
header. If nocontent_type
is provided, and there is noheaderlist
, thedefault_content_type
will be automatically set. Ifheaderlist
is provided then this value is ignored.conditional_response (bool) – Used to change the behavior of the
Response
to check the original request for conditional response headers. Seeconditional_response_app()
for more information.charset (str or None) – Adds a
charset
Content-Type
parameter. If nocharset
is provided and theContent-Type
is text, then thedefault_charset
will automatically be added. Currently the onlyContent-Type
’s that allow for acharset
are defined to betext/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added. If aheaderlist
is provided this value is ignored.
All other response attributes may be set on the response by providing them as keyword arguments. A
TypeError
will be raised for any unexpected keywords.Sub-classing notes:
The
default_content_type
is used as the default for theContent-Type
header that is returned on the response. It istext/html
.The
default_charset
is used as the default character set to return on theContent-Type
header, if theContent-Type
allows for acharset
parameter. Currently the onlyContent-Type
’s that allow for acharset
are defined to be:text/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added.The
unicode_errors
is set tostrict
, and access on atext
will raise an error if it fails to decode thebody
.default_conditional_response
is set toFalse
. This flag may be set toTrue
so that allResponse
objects will attempt to check the original request for conditional response headers. Seeconditional_response_app()
for more information.default_body_encoding
is set to ‘UTF-8’ by default. It exists to allow users to get/set theResponse
object using.text
, even if nocharset
has been set for theContent-Type
.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.owsexceptions.
OWSNoApplicableCode
(*args, **kwargs)[source]¶ WPS Bad Request Exception.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.owsexceptions.
OWSMissingParameterValue
(*args, **kwargs)[source]¶ MissingParameterValue WPS Exception.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.owsexceptions.
OWSInvalidParameterValue
(*args, **kwargs)[source]¶ InvalidParameterValue WPS Exception.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.owsexceptions.
OWSNotImplemented
(*args, **kwargs)[source]¶ Represents a WSGI response.
If no arguments are passed, creates a
Response
that uses a variety of defaults. The defaults may be changed by sub-classing theResponse
. See the sub-classing notes.- Variables
body (bytes or text_type) – If
body
is atext_type
, then it will be encoded using eithercharset
when provided ordefault_encoding
whencharset
is not provided if thecontent_type
allows for acharset
. This argument is mutually exclusive withapp_iter
.status (int or str) – Either an
int
or a string that is an integer followed by the status text. If it is an integer, it will be converted to a proper status that also includes the status text. Any existing status text will be kept. Non-standard values are allowed.headerlist (list) – A list of HTTP headers for the response.
app_iter (iterable) – An iterator that is used as the body of the response. Should conform to the WSGI requirements and should provide bytes. This argument is mutually exclusive with
body
.content_type (str or None) – Sets the
Content-Type
header. If nocontent_type
is provided, and there is noheaderlist
, thedefault_content_type
will be automatically set. Ifheaderlist
is provided then this value is ignored.conditional_response (bool) – Used to change the behavior of the
Response
to check the original request for conditional response headers. Seeconditional_response_app()
for more information.charset (str or None) – Adds a
charset
Content-Type
parameter. If nocharset
is provided and theContent-Type
is text, then thedefault_charset
will automatically be added. Currently the onlyContent-Type
’s that allow for acharset
are defined to betext/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added. If aheaderlist
is provided this value is ignored.
All other response attributes may be set on the response by providing them as keyword arguments. A
TypeError
will be raised for any unexpected keywords.Sub-classing notes:
The
default_content_type
is used as the default for theContent-Type
header that is returned on the response. It istext/html
.The
default_charset
is used as the default character set to return on theContent-Type
header, if theContent-Type
allows for acharset
parameter. Currently the onlyContent-Type
’s that allow for acharset
are defined to be:text/*
,application/xml
, and*/*+xml
. Any otherContent-Type
’s will not have acharset
added.The
unicode_errors
is set tostrict
, and access on atext
will raise an error if it fails to decode thebody
.default_conditional_response
is set toFalse
. This flag may be set toTrue
so that allResponse
objects will attempt to check the original request for conditional response headers. Seeconditional_response_app()
for more information.default_body_encoding
is set to ‘UTF-8’ by default. It exists to allow users to get/set theResponse
object using.text
, even if nocharset
has been set for theContent-Type
.
Initialize self. See help(type(self)) for accurate signature.
weaver.sort
¶
weaver.status
¶
-
weaver.status.
map_status
(wps_status: AnyStatusType, compliant: str = STATUS_COMPLIANT_OGC) → str[source]¶ Maps WPS execution statuses to between compatible values of different implementations.
Mapping is supported for values from
weaver.status
,OWSLib
,pywps
as well as some specific one-of values of custom implementations.For each compliant combination, unsupported statuses are changed to corresponding ones (with closest logical match). Statuses are returned following
weaver.status.JOB_STATUS_VALUES
format. Specifically, this ensures statues are lowercase and not prefixed byProcess
(as in XML response of OWS WPS likeProcessSucceeded
for example).- Parameters
wps_status – One of
weaver.status.JOB_STATUS_VALUES
to map to compliant standard or PyWPS int status.compliant – One of
STATUS_COMPLIANT_[...]
values.
- Returns
mapped status complying to the requested compliant category, or
STATUS_UNKNOWN
if no match found.
weaver.tweens
¶
-
weaver.tweens.
error_repr
(http_err: Union[pyramid.httpexceptions.HTTPException, weaver.owsexceptions.OWSException, Exception]) → str[source]¶ Returns a cleaned up representation string of the HTTP error.
Similar and even extended details relative to the HTTP error message are added to facilitate later debugging.
-
weaver.tweens.
ows_response_tween
(request, handler)[source]¶ Tween that wraps any API request with appropriate dispatch of error conversion to handle formatting.
-
weaver.tweens.
ows_response_tween_factory_excview
(handler, registry)[source]¶ Tween factory which produces a tween which transforms common exceptions into OWS specific exceptions.
weaver.utils
¶
-
weaver.utils.
get_weaver_url
(container: weaver.typedefs.AnySettingsContainer) → str[source]¶ Retrieves the home URL of the Weaver application.
-
weaver.utils.
get_any_id
(info: weaver.typedefs.JSON) → Union[str, None][source]¶ Retrieves a dictionary id-like key using multiple common variations
[id, identifier, _id]
.- Parameters
info – dictionary that potentially contains an id-like key.
- Returns
value of the matched id-like key or
None
if not found.
-
weaver.utils.
get_any_value
(info: weaver.typedefs.JSON) → weaver.typedefs.AnyValue[source]¶ Retrieves a dictionary value-like key using multiple common variations
[href, value, reference]
.- Parameters
info – dictionary that potentially contains a value-like key.
- Returns
value of the matched value-like key or
None
if not found.
-
weaver.utils.
get_any_message
(info: weaver.typedefs.JSON) → str[source]¶ Retrieves a dictionary ‘value’-like key using multiple common variations [message].
- Parameters
info – dictionary that potentially contains a ‘message’-like key.
- Returns
value of the matched ‘message’-like key or an empty string if not found.
-
weaver.utils.
get_registry
(container: weaver.typedefs.AnyRegistryContainer, nothrow: bool = False) → Optional[pyramid.registry.Registry][source]¶ Retrieves the application
registry
from various containers referencing to it.
-
weaver.utils.
get_settings
(container: Optional[weaver.typedefs.AnySettingsContainer] = None) → weaver.typedefs.SettingsType[source]¶ Retrieves the application
settings
from various containers referencing to it.
-
weaver.utils.
get_header
(header_name: str, header_container: weaver.typedefs.AnyHeadersContainer) → Union[str, None][source]¶ Searches for the specified header by case/dash/underscore-insensitive
header_name
insideheader_container
.
Looks for
cookie_header_name
header withinheader_container
.- Returns
new header container in the form
{'Cookie': <found_cookie>}
if it was matched, or empty otherwise.
-
weaver.utils.
get_url_without_query
(url: Union[str, urllib.parse.ParseResult]) → str[source]¶ Removes the query string part of an URL.
-
weaver.utils.
is_uuid
(maybe_uuid: Any) → bool[source]¶ Evaluates if the provided input is a UUID-like string.
-
weaver.utils.
parse_extra_options
(option_str: str) → Dict[str, str][source]¶ Parses the extra options parameter.
The option_str is a string with coma separated
opt=value
pairs. Example:tempdir=/path/to/tempdir,archive_root=/path/to/archive
- Parameters
option_str – A string parameter with the extra options.
- Returns
A dict with the parsed extra options.
-
weaver.utils.
fully_qualified_name
(obj: Union[Any, Type[Any]]) → str[source]¶ Obtains the
'<module>.<name>'
full path definition of the object to allow finding and importing it.
-
weaver.utils.
now
() → datetime.datetime[source]¶
-
weaver.utils.
localize_datetime
(dt: datetime.datetime, tz_name: Optional[str] = 'UTC') → datetime.datetime[source]¶ Provide a timezone-aware object for a given datetime and timezone name.
-
weaver.utils.
xml_strip_ns
(tree: weaver.xml_util.XML) → None[source]¶
-
weaver.utils.
ows_context_href
(href: str, partial: Optional[bool] = False) → weaver.typedefs.JSON[source]¶ Retrieves the complete or partial dictionary defining an
OWSContext
from a reference.
-
weaver.utils.
pass_http_error
(exception: Exception, expected_http_error: Union[Type[pyramid.httpexceptions.HTTPError], Iterable[Type[pyramid.httpexceptions.HTTPError]]]) → None[source]¶ Silently ignore a raised HTTP error that matches the specified error code of the reference exception class.
Given an HTTPError of any type (
pyramid
,requests
), ignores the exception if the actual error matches the status code. Other exceptions are re-raised. This is equivalent to capturing a specificException
within anexcept
block and callingpass
to drop it.- Parameters
exception – any Exception instance (“object” from a try..except exception as “object” block).
expected_http_error – single or list of specific pyramid HTTPError to handle and ignore.
- Raises
exception – if it doesn’t match the status code or is not an HTTPError of any module.
-
weaver.utils.
raise_on_xml_exception
(xml_node: weaver.xml_util.XML) → Optional[NoReturn][source]¶ Raises an exception with the description if the XML response document defines an ExceptionReport.
- Parameters
xml_node – instance of
XML
- Raises
Exception – on found ExceptionReport document.
-
weaver.utils.
str2bytes
(string: Union[str, bytes]) → bytes[source]¶ Obtains the bytes representation of the string.
-
weaver.utils.
bytes2str
(string: Union[str, bytes]) → str[source]¶ Obtains the unicode representation of the string.
-
weaver.utils.
get_path_kvp
(path: str, sep: str = ',', **params: weaver.typedefs.KVP_Item) → str[source]¶ Generates the URL with Key-Value-Pairs (KVP) query parameters.
- Parameters
path – WPS URL or Path
sep – separator to employ when multiple values are provided.
params – keyword parameters and their corresponding single or multi values to generate KVP.
- Returns
combined path and query parameters as KVP.
-
weaver.utils.
get_log_date_fmt
() → str[source]¶ Logging date format employed for job output reporting.
-
weaver.utils.
get_log_monitor_msg
(job_id: str, status: str, percent: weaver.typedefs.Number, message: str, location: str) → str[source]¶
-
weaver.utils.
get_job_log_msg
(status: str, message: str, progress: Optional[weaver.typedefs.Number] = 0, duration: Optional[str] = None) → str[source]¶
-
weaver.utils.
setup_loggers
(settings: weaver.typedefs.AnySettingsContainer, level: Optional[Union[int, str]] = None) → None[source]¶ Update logging configuration known loggers based on application settings.
When
weaver.log_level
exists in settings, it overrides any other INI configuration logging levels. Otherwise, undefined logger levels will be set according to whichever is found first betweenweaver.log_level
, thelevel
parameter or defaultlogging.INFO
.
-
weaver.utils.
make_dirs
(path, mode=493, exist_ok=False)[source]¶ Backward compatible
make_dirs
with reduced set of default mode flags.Alternative to
os.makedirs
withexists_ok
parameter only available forpython>3.5
. Also, using a reduced set of permissions755
instead of original default777
.Note
The method employed in this function is safer then
if os.pat.exists
orif os.pat.isdir
pre-check to callingos.makedirs
as this can result in race condition (between evaluation and actual creation).
-
weaver.utils.
get_caller_name
(skip=2, base_class=False)[source]¶ Find the name of a parent caller function or method.
The name is returned with respective formats
module.class.method
ormodule.function
.- Parameters
skip – specifies how many levels of stack to skip while getting the caller.
base_class – Specified if the base class should be returned or the top-most class in case of inheritance If the caller is not a class, this doesn’t do anything.
- Returns
An empty string if skipped levels exceed stack height; otherwise, the requested caller name.
-
weaver.utils.
setup_cache
(settings: weaver.typedefs.SettingsType) → None[source]¶ Prepares the settings with default caching options.
-
weaver.utils.
invalidate_region
(caching_args: Tuple[Callable, str, Tuple[Any]]) → None[source]¶ Caching region invalidation with handling to ignore errors generated by of unknown regions.
- Parameters
caching_args – tuple of (function, region, *function-args)
-
weaver.utils.
get_ssl_verify_option
(method: str, url: str, settings: weaver.typedefs.AnySettingsContainer, request_options: Optional[weaver.typedefs.SettingsType] = None) → bool[source]¶ Obtains the SSL verification option considering multiple setting definitions and the provided request context.
Obtains the SSL verification option from combined settings from
weaver.ssl_verify
and parsedweaver.request_options
file for the corresponding request.- Parameters
method – request method (GET, POST, etc.).
url – request URL.
settings – application setting container with pre-loaded request options specifications.
request_options – pre-processed request options for method/URL to avoid re-parsing the settings.
- Returns
SSL
verify
option to be passed down to somerequest
function.
-
weaver.utils.
get_no_cache_option
(request_headers: weaver.typedefs.HeadersType, request_options: weaver.typedefs.SettingsType) → bool[source]¶ Obtains the No-Cache result from request headers and configured request options.
See also
Request.headers()
- Parameters
request_headers – specific request headers that could indicate
Cache-Control: no-cache
request_options – specific request options that could define
cache: True|False
- Returns
whether to disable cache or not
-
weaver.utils.
get_request_options
(method: str, url: str, settings: weaver.typedefs.AnySettingsContainer) → weaver.typedefs.SettingsType[source]¶ Obtains the request options corresponding to the request from the configuration file.
The configuration file specified is expected to be pre-loaded within setting
weaver.request_options
. If no file was pre-loaded or no match is found for the request, an empty options dictionary is returned.- Parameters
method – request method (GET, POST, etc.).
url – request URL.
settings – application setting container with pre-loaded request options specifications.
- Returns
dictionary with keyword options to be applied to the corresponding request if matched.
-
weaver.utils.
retry_on_cache_error
(func: Callable[[Ellipsis], Any]) → Callable[source]¶ Decorator to handle invalid cache setup.
Any function wrapped with this decorator will retry execution once if missing cache setup was the cause of error.
-
weaver.utils.
_request_call
(method: str, url: str, kwargs: Dict[str, weaver.typedefs.AnyValue]) → requests.Response[source]¶ Request operation employed by
request_extra()
without caching.
-
weaver.utils.
_request_cached
(method: str, url: str, kwargs: Dict[str, weaver.typedefs.AnyValue]) → requests.Response[source]¶ Cached-enabled request operation employed by
request_extra()
.
-
weaver.utils.
request_extra
(method: Ellipsis, url: str, retries: Optional[int] = None, backoff: Optional[weaver.typedefs.Number] = None, intervals: Optional[List[weaver.typedefs.Number]] = None, retry_after: bool = True, allowed_codes: Optional[List[int]] = None, only_server_errors: bool = True, ssl_verify: Optional[bool] = None, settings: Optional[weaver.typedefs.AnySettingsContainer] = None, **request_kwargs) → weaver.typedefs.AnyResponseType[source]¶ Standard library
requests
with additional functional utilities.Retry operation¶ Implements request retry if the previous request failed, up to the specified number of retries. Using
backoff
factor, you can control the interval between request attempts such as:delay = backoff * (2 ^ retry)
Alternatively, you can explicitly define
intervals=[...]
with the list values being the number of seconds to wait between each request attempt. In this case,backoff
is ignored andretries
is overridden accordingly with the number of items specified in the list.Furthermore,
retry_after
(default:True
) indicates if HTTP status code429 (Too Many Requests)
should be automatically handled during retries. If enabled and provided in the previously failed request response through theRetry-After
header, the next request attempt will be executed only after the server-specified delay instead of following the calculated delay fromretries
andbackoff
, or from corresponding index ofinterval
, accordingly to specified parameters. This will avoid uselessly calling the server and automatically receive a denied response. You can disable this feature by passingFalse
, which will result into requests being retried blindly without consideration of the called server instruction.Because different request implementations use different parameter naming conventions, all following keywords are looked for:
Both variants of
backoff
andbackoff_factor
are accepted.All variants of
retires
,retry
andmax_retries
are accepted.
Note
Total amount of executed request attempts will be +1 the number of
retries
orintervals
items as first request is done immediately, and following attempts are done with the appropriate delay.File Transport Scheme¶ Any request with
file://
scheme or empty scheme (no scheme specified) will be automatically handled as potential local file path. The path should be absolute to ensure it to be correctly resolved.All access errors due to file permissions return 403 status code, and missing file returns 404. Any other
IOError
types are converted to a 400 responses.See also
FileAdapter
SSL Verification¶ Allows SSL verify option to be enabled or disabled according to configuration settings or explicit parameters. Any variation of
verify
orssl_verify
keyword arguments are considered. If they all resolve toTrue
, then application settings are retrieved fromweaver.ini
to parse additional SSL options that could disable it.- Following
weaver
settings are considered : weaver.ssl_verify = True|False
weaver.request_options = request_options.yml
Note
Argument
settings
must also be provided through any supported container byget_settings()
to retrieve and apply anyweaver
-specific configurations.- Parameters
method – HTTP method to set request.
url – URL of the request to execute.
retries – Number of request retries to attempt if first attempt failed (according to allowed codes or error).
backoff – Factor by which to multiply delays between retries.
intervals – Explicit intervals in seconds between retries.
retry_after – If enabled, honor
Retry-After
response header of provided by a failing request attempt.allowed_codes – HTTP status codes that are considered valid to stop retrying (default: any non-4xx/5xx code).
ssl_verify – Explicit parameter to disable SSL verification (overrides any settings, default: True).
settings – Additional settings from which to retrieve configuration details for requests.
only_server_errors – Only HTTP status codes in the 5xx values will be considered for retrying the request (default: True). This catches sporadic server timeout, connection error, etc., but 4xx errors are still considered valid results. This parameter is ignored if allowed codes are explicitly specified.
request_kwargs – All other keyword arguments are passed down to the request call.
-
weaver.utils.
fetch_file
(file_reference: str, file_outdir: str, settings: Optional[weaver.typedefs.AnySettingsContainer] = None, **request_kwargs: Any) → str[source]¶ Fetches a file from local path, AWS-S3 bucket or remote URL, and dumps it’s content to the output directory.
The output directory is expected to exist prior to this function call. The file reference scheme (protocol) determines from where to fetch the content. Output file name and extension will be the same as the original. Requests will consider
weaver.request_options
when usinghttp(s)://
scheme.- Parameters
file_reference – Local filesystem path (optionally prefixed with
file://
),s3://
bucket location orhttp(s)://
remote URL file reference. Referencehttps://s3.[...]
are also considered ass3://
.file_outdir – Output local directory path under which to place the fetched file.
settings – Additional request-related settings from the application configuration (notably request-options).
request_kwargs – Additional keywords to forward to request call (if needed).
- Returns
Path of the local copy of the fetched file.
- Raises
HTTPException – applicable HTTP-based exception if any occurred during the operation.
ValueError – when the reference scheme cannot be identified.
-
weaver.utils.
get_sane_name
(name: str, min_len: Optional[int] = 3, max_len: Optional[Union[int, None]] = None, assert_invalid: Optional[bool] = True, replace_character: str = '_') → Union[str, None][source]¶ Cleans up the name to allow only specified characters and conditions.
Returns a cleaned-up version of the
name
, replacing invalid characters not matched withREGEX_SEARCH_INVALID_CHARACTERS
byreplace_character
. Also, ensure that the resulting name respects specified length conditions.- Parameters
name – Value to clean.
min_len – Minimal length of
name`
to be respected, raises or returnsNone
on fail according toassert_invalid
.max_len – Maximum length of
name
to be respected, raises or returns trimmedname
on fail according toassert_invalid
. IfNone
, condition is ignored for assertion or fullname
is returned respectively.assert_invalid – If
True
, fail conditions or invalid characters will raise an error instead of replacing.replace_character – Single character to use for replacement of invalid ones if
assert_invalid
isFalse
.
-
weaver.utils.
assert_sane_name
(name, min_len=3, max_len=None)[source]¶ Asserts that the sane name respects conditions.
See also
argument details in
get_sane_name()
-
weaver.utils.
clean_json_text_body
(body: str, remove_newlines: bool = True, remove_indents: bool = True) → str[source]¶ Cleans a textual body field of superfluous characters to provide a better human-readable text in a JSON response.
-
weaver.utils.
transform_json
(json_data: Ellipsis, rename: Optional[Dict[weaver.typedefs.AnyKey, Any]] = None, remove: Optional[List[weaver.typedefs.AnyKey]] = None, add: Optional[Dict[weaver.typedefs.AnyKey, Any]] = None, replace_values: Optional[Dict[weaver.typedefs.AnyKey, Any]] = None, replace_func: Optional[Dict[weaver.typedefs.AnyKey, Callable[[Any], Any]]] = None) → Dict[str, weaver.typedefs.JSON][source]¶ Transforms the input JSON with different methods.
The transformations are applied in-place and in the same order as the arguments (rename, remove, add, etc.). All operations are applied onto the top-level fields of the mapping. No nested operations are applied, unless handled by replace functions.
Note
Because fields and values are iterated over the provided mappings, replacements of previous iterations could be re-replaced by following ones if the renamed item corresponds to a following item to match. For example, renaming
field1 -> field2
andfield2 -> field3` within the same operation type would result in successive replacements with ``field3
as result. The parameter order is important in this case as swapping the definitions would not findfield2
on the first iteration (not in mapping yet), and then findfield1
, making the result to befield2
.- Parameters
json_data – JSON mapping structure to transform.
rename – rename matched fields key name to the associated value name.
remove – remove matched fields by name.
add – add or override the fields names with associated values.
replace_values – replace matched values by the associated new values regardless of field names.
replace_func – Replace values under matched fields by name with the returned value from the associated function. Mapping functions will receive the original value as input. If the result is to be serialized to JSON, they should return a valid JSON-serializable value.
:return transformed JSON (same as modified in-place input JSON)
weaver.warning
¶
-
exception
weaver.warning.
TimeZoneInfoAlreadySetWarning
[source]¶ Warn when trying to obtain a localized time with already defined time-zone info.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.warning.
DisabledSSLCertificateVerificationWarning
[source]¶ Warn when an option to disable SSL certificate verification is employed for some operations.
Initialize self. See help(type(self)) for accurate signature.
-
exception
weaver.warning.
UnsupportedOperationWarning
[source]¶ Warn about an operation not yet implemented or unsupported according to context.
Initialize self. See help(type(self)) for accurate signature.
weaver.xml_util
¶
Package lxml
is employed directly even though some linters (e.g.: bandit
) report to employ defusedxml
instead, because that package’s extension with lxml
is marked as deprecated.
To use the module, import is as if importing lxml.etree
:
from weaver.xml_util import XML # ElementTree
from weaver import xml_util
data = xml_util.fromstring("<xml>content</xml>")
- 1
Created with sphinx-autoapi
Changes¶
4.2.0 (2021-10-19)¶
Changes:¶
Add execution endpoint
POST /provider/{id}/process/{id}/execution
corresponding to the OGC-API compliant endpoint for localProcess
definitions.Add multiple additional relation
links
forProcess
andJob
responses (resolves #234 and #267).Add convenience
DELETE /jobs
endpoint with input list ofJob
UUIDs in order todismiss
multiple entries simultaneously. This is useful for quickly removing a set ofJob
returned by filteredGET /jobs
contents.Update conformance link list for
dismiss
and relevant relationlinks
definitions (relates to #53 and #267).Add better support and reporting of
Job
statusdismissed
when operation is called from API on running task.Use explicit
started
status whenJob
has been picked up by a Celery worker instead of leaving it toaccepted
(same status that indicates theJob
“pending”, although a worker is processing it). Early modification of status is done in case setup operations (send WPS request, prepare files, etc.) take some time which would leave users under the impression theJob
is not getting picked up. Report explicitrunning
status inJob
once it has been sent to the remote WPS endpoint. The API will reportrunning
in both cases in order to support OGC API - Processes naming conventions, but internalJob
status will have more detail.Add
update
timestamp toJob
response to better track latest milestones saved to database. This avoids users having to compare many fields (created
,started
,finished
) depending on latest status.Apply stricter
Deploy
body schema validation and employ deserialized result directly. This ensures that preserved fields in the submitted content for deployment contain only known data elements with expected structures for respective schemas. Existing deployment body that contain invalid formats could start to fail or might generate inconsistentProcess
descriptions if not adjusted.Add improved reporting of erroneous inputs during
Process
deployment whenever possible to identify the cause.Add more documentation details about missing features such as
EOImage
inputs handled by OpenSearch requests.Add
weaver.celery
flag to internal application settings when auto-detecting that current runner iscelery
. This bypasses redundant API-only operations during application setup and startup not needed bycelery
worker.
Fixes:¶
Fix OGC-API compliant execution endpoint
POST /process/{id}/execution
not registered in API.Fix missing status for cancelled
Jobs
in order to properly supportdismiss
operation (resolves #145 and #228).Fix all known OGC-specific link relationships with URI prefix (resolves #266).
Fix incorrect rendering of some table cells in the documentation.
4.1.2 (2021-10-13)¶
Changes:¶
No change.
Fixes:¶
Add
celery worker
task events flag (-E
) to Docker command (weaver-worker
) to help detect submitted delayed tasks when requesting job executions.
4.1.1 (2021-10-12)¶
Changes:¶
No change.
Fixes:¶
Fix handling of default format field of WPS input definition incorrectly resolved as default data by
PyWPS
for Process that allows optional (minOccurs=0
) inputs ofComplex
type. Specific case is detected with relevant erroneous data and dropped silently because it should not be present (since omitted in WPS request) and should not generate a WPS input (relates to geopython/pywps#633).Fix resolution of CWL field
default
value erroneously inserted as"null"
literal string for inputs generated from WPS definition to avoid potential confusion with valid"null"
input or default string. Default behaviour to drop or ignore omitted inputs are handled by"null"
withintype
field in CWL definitions.Fix
Wps1Process
job runner for dispatched execution of WPS-1 Process assuming all provided inputs contain data or reference. Skip omitted optional inputs that are resolved withNone
value following above fixes.Resolve execution failure of WPS-1 Process
ncdump
underhummingbird
Provider (fixes issue identified in output logs from notebook in PR pavics-sdi#230).
4.1.0 (2021-09-29)¶
Changes:¶
Improve reporting of mismatching Weaver configuration for Process and Application Package definitions that always require remote execution. Invalid combinations will be raised during execution with detailed problem.
Forbid Provider and applicable Process definitions to be deployed, executed or queried when corresponding remote execution is not supported according to Weaver instance configuration since Provider must be accessed remotely.
Refactor endpoint views and utilities referring to Provider operations into appropriate modules.
Apply
weaver.configuration = HYBRID
by default in example INI configuration since it is the most common use case. Apply same configuration by default in tests. Default resolution still employsDEFAULT
for backward compatibility in case the setting was omitted completely from a custom INI file.Add query parameter
ignore
toGET /providers
listing in order to obtain full validation of remote providers (including XML contents parsing) to return200
. Invalid definitions will raise and return a[422] Unprocessable Entity
HTTP error.Add more explicit messages about the problem that produced an error (XML parsing, unreachable WPS, etc.) and which caused request failure when attempting registration of a remote Provider.
Fixes:¶
Fix reported
links
by processes nested under a providerService
. Generated URL references were omitting the/providers/{id}
portion.Fix documentation referring to incorrect setting name in some cases for WPS outputs configuration.
Fix strict XML parsing failing resolution of some remote WPS providers with invalid characters such as
<
,<=
within process description fields. Although invalid, those easily recoverable errors will be handled by the parser.Fix resolution and execution of WPS-1 remote Provider and validate it against end-to-end test procedure from scratch Service registration down to results retrieval (fixes #340).
Fix resolution of applicable Provider listing schema validation when none have been registered (fixes #339).
Fix incorrect schema definition of Process items for
GET /processes
response that did not report the alternative identifier-only listing whendetail=false
query is employed.Fix incorrect reporting of documented OpenAPI reference definitions for
query
parameters with same names shared across multiple endpoints. Fix is directly applied on relevant reference repository that generates OpenAPI schemas (see fmigneault/cornice.ext.swagger@70eb702).Fix
weaver.exception
definitions such that raising them directly will employ the correspondingHTTPException
code (if applicable) to generate the appropriate error response automatically when raising them directly without further handling. The order of class inheritance were always using500
due toWeaverException
definition.
4.0.0 (2021-09-21)¶
Changes:¶
Apply conformance updates to better align with expected
ProcessDescription
schema from OGC-API - Processes v1.0-draft6. The principal change introduced in this case is that process description contents will be directly at the root of the object returned by/processes/{id}
response instead of being nested under"process"
field. Furthermore,inputs
andoutputs
definitions are reported as mapping of{"<id>": {<parameters>}}
as specified by OGP-API instead of old listing format[{"id": "<id-value>", <key:val parameters>}]
. The old nested and listing format can still be obtained using request query parameterschema=OLD
, and will otherwise use OGC-API by default or whenschema=OGC
. Note that some duplicated metadata fields are dropped regardless of selected format in favor of OGC-API names. Some examples areabstract
that becomesdescription
,processVersion
that simply becomesversion
,mimeType
that becomesmediaType
, etc. Some of those changes are also reflected byProcessSummary
during listing of processes, as well as for corresponding provider-related endpoints (relates to #200).Add backward compatibility support of some metadata fields (
abstract
,mimeType
, etc.) forDeploy
operation of pre-existing processes. When those fields are detected, they are converted inplace in favor of their corresponding new names aligned with OGC-API.Update
mimeType
tomediaType
as format type representation according to OGC-API (relates to #211).Add explicit pattern validation (
type/subtype
) of format string definitions withMediaType
schema.Add sorting capability to generate mapping schemas for API responses using overrides of properties
_sort_first
and_sort_after
using lists of desired ordered field names.Improved naming of many ambiguous and repeated words across schema definitions that did not necessarily interact with each other although making use of similar naming convention, making their interpretation and debugging much more complicated. A stricter naming convention has been applied for consistent Deploy/Describe/Execute-related and Input/Output-related references.
Replace
list_remote_processes
function by methodprocesses
under theService
instance.Replace
get_capabilities
function by reusing and extending methodsummary
under theService
instance.Improve generation of metadata and content validation of
Service
provider responses (relates to OGC #200 and #266).Add query parameter
detail
to providers listing request to allow listing of names instead of their summary (similarly to the processes endpoint query parameter).Add query parameter
check
to providers listing request to retrieve all registeredService
regardless of their URL endpoint availability at the moment the request is executed (less metadata is retrieved in that case).Add
weaver.schema_url
configuration parameter andweaver.wps_restapi.utils.get_schema_ref
function to help generate$schema
definition and return reference to expected/provided schema in responses (relates to #157) Only utilities are added, not all routes provide the information yet.Add validation of
schema
field underFormat
schema (as per opengeospatial/ogcapi-processes schema format.yml) such that only URL formatted strings are allowed, or alternatively and explicit JSON definition. Previous definitions that would indicate an empty string schema are dropped sinceschema
is optional.Block unknown and
builtin
process types during deployment from the API (fixes #276). Typebuiltin
can only be registered by Weaver itself at startup. Other unknown types that have no indication for mapping to an appropriate Process implementation are preemptively validated.Add parsing and generation of additional
literalDataDomains
for specification of WPS I/O data constrains and provide corresponding definitions in process description responses (fixes #41, #211, #297).Add additional
maximumMegabyte
metadata detail toformats
of WPS I/O ofcomplex
type whenever available (requires geopython/OWSLib#796, futureOWSLIB==0.26.0
release).
Fixes:¶
Revert an incorrectly removed schema deserialization operation during generation of the
ProcessSummary
employed for populating process listing.Revert an incorrectly modified schema reference that erroneously replaced service provider
ProcessSummary
items during their listing by a singleProcessInputDescriptionSchema
(introduced since3.0.0
).Fix #203 with explicit validation test of
ProcessSummary
schema for providers response.Fix failing
minOccurs
andmaxOccurs
generation from a remote providerProcess
to support OGC-API format (relates to #263).Fix schemas references and apply deserialization to providers listing request.
Fix failing deserialization of
variable
children schema under mapping when this variable element is allowed to be undefined (i.e.: defined withmissing=drop
). Allows support of emptyinputs
mapping of OGC-API representation ofProcessDescription
that permits such processes (constant or random output generator).Fix some invalid definitions of execution inputs schemas under mapping with
value
sub-schema where key-based input IDs (usingadditionalProperties
) where replaced by the variable<input-id>
name instead of their original names in the request body (from #265 since3.4.0
).Fix parsing error raised from
wps_processes.yml
configuration file when it can be found but contains neither aprocesses
norproviders
section. Also, apply more validation of specifiedname
values.Fix parsing of
request_extra
function/setting parameters for specifically zero values corresponding toretries
andbackoff
options that were be ignored.Fix incorrect parsing of
default
field within WPS input whenliteral
data type is present and was assumed ascomplex
(fixes #297).Fix and test various invalid schema deserialization validation issues, notably regarding
PermissiveMappingSchema
, schema nodesExtendedFloat
,ExtendedInt
and their handling strategies when combined in mappings or keywords.Fix resolution of similar values that could be implicitly converted between
ExtendedString
,ExtendedFloat
,ExtendedInt
andExtendedBool
schema types to guarantee original data type explicitly defined are preserved.Fix
runningSeconds
field reporting to be offloat
type although implicitint
type conversion could occur.Fix validation of
Execute
inputs schemas to adequately distinguish between optional inputs and incorrect formats.Fix resolution of
Accept-Language
negotiation forwarded to local or remote WPS process execution.Fix XML security issue flagged within dependencies to
PyWPS
andOWSLib
by pinning requirements to versionspywps==4.5.0
andowslib==0.25.0
, and apply the same fix in Weaver code (see following for details: geopython/pywps#616, geopython/pywps#618, geopython/pywps#624, CVE-2021-39371).
3.5.0 (2021-08-19)¶
Changes:¶
No change.
Fixes:¶
Fix
weaver.datatype
objects auto-resolution of fields using either attributes (accessed asdict
) or properties (accessed asclass
) to ensure correct handling of additional operations on them.Fix
DuplicateKeyError
that could sporadically arise during initialprocesses
storage creation whenbuiltin
processes get inserted/updated on launch by parallel worker/threads running the application. Operation is relaxed only for defaultbuiltin
to allow equivalent process replacement (upsert
) instead of only explicit inserts, as they should be pre-validated for duplicate entries, and only new definitions should be registered during this operation (fixes #246).
3.4.0 (2021-08-11)¶
Changes:¶
Fixes:¶
Fix copy of headers when generating the WPS clients created for listing providers capabilities and processes.
3.3.0 (2021-07-16)¶
Changes:¶
Add support for array type as job inputs (relates to #233).
Remove automatic conversion of falsy/truthy
string
andinteger
type definitions toboolean
type to align with OpenAPIboolean
type definitions. Non explicitboolean
values will not be automatically converted tobool
anymore. They will require explicitfalse|true
values.
3.2.1 (2021-06-08)¶
Changes:¶
No change.
Fixes:¶
Fix backward compatibility of pre-deployed processes that did not define
jobControlOptions
that is now required. Missing definition are substituted in-place by default["execute-async"]
mode.
3.2.0 (2021-06-08)¶
Changes:¶
Add reference link to ReadTheDocs URL of Weaver in API landing page.
Add references to OGC-API Processes requirements and recommendations for eventual conformance listing (relates to #231).
Add
datetime
query parameter for job searches queries (relates to #236).Add
limit
query parameter validation and integration for jobs in retrieve queries (relates to #237).
Fixes:¶
Pin
pywps==4.4.3
and fix incompatibility introduced by its refactor of I/O base classes in #602 (specifically commit 343d825), which broke theComplexInput
work-around to avoid useless of file URLs (see issue #526).Fix default execution mode specification in process job control options (fixes #182).
Fix old OGC-API WPS REST bindings link in landing page for the more recent OGC-API Processes specification.
Fix invalid deserialization of schemas using
not
keyword that would result in all fields returned instead of limiting them to the expected fields from the schema definitions forLiteralInputType
in process description.Adjust
InputType
andOutputType
schemas to useallOf
instead ofanyOf
definition since all sub-schemas that define them must be combined, with their respectively required or optional fields.
3.1.0 (2021-04-23)¶
Changes:¶
Add caching of remote WPS requests according to
request-options.yml
and request headerCache-Control
to allow reduced query of pre-fetched WPS client definition.Add
POST /processes/{}/execution
endpoint that mimics its jobs counterpart to respect OGC-API Processes updates (see issue opengeospatial/ogcapi-processes#124 and PR opengeospatial/ogcapi-processes#159, resolves #235).Add OpenAPI schema examples for some of the most common responses.
Add missing schema definitions for WPS XML requests and responses.
Improve schema self-validation with their specified default values.
Add explicit options usage and expected parsing results for all test variations of OpenAPI schemas generation and
colander
object arguments for future reference intests.wps_restapi.test_colander_extras
.
Fixes:¶
Fix erroneous tags in job inputs schemas.
Fix handling of deeply nested schema validator raising for invalid format within optional parent schema.
Fix retrieval of database connection from registry reference.
Fix test mock according to installed
pyramid
version to avoid error with modified mixin implementations.
3.0.0 (2021-03-16)¶
Changes:¶
Provide HTTP links to corresponding items of job in JSON body of status, inputs and outputs routes (#58, #86).
Provide
Job.started
datetime and calculateJob.duration
from it to indicate the duration of the process execution instead of counting from the time the job was submitted (i.e.:Job.created
).Provide OGC compliant
<job-uri>/results
response schema as well as some expectedcode
/description
fields in case where the request fails.Add
<job-uri>/outputs
providing thedata
/href
formatted job results as well as<job-uri>/inputs
to retrieve the inputs that were provided during job submission (#86).Deprecate
<job-uri>/result
paths (indicated in OpenAPI schemas and UI) in favor of<job-uri>/outputs
which provides the same structure with additionallinks
references (#58). Result path requests are redirected automatically to outputs.Add more reference/documentation links to WPS-1/2 and update conformance references (#53).
Add some minimal caching support of routes.
Adjust job creation route to return
201
(created) as it is now correctly defined by the OGC API specification (#14).Add
Job.link
method that auto-generates all applicable links (inputs, outputs, logs, etc.).Add
image/jpeg
,image/png
,image/tiff
formats to supportedweaver.formats
(relates to #100).Handle additional trailing slash resulting in
HTTPNotFound [404]
to automatically resolve to corresponding valid route without the slash when applicable.Provide basic conda environment setup through
Makefile
for Windows bash-like shell (ie:MINGW
/MINGW64
).Update documentation for minimal adjustments needed to run under Windows.
Update OpenAPI template to not render the useless version selector since we only provide the current version.
Update Swagger definitions to reflect changes and better reuse existing schemas.
Update Swagger UI to provide the ReadTheDocs URL.
Add crim-ca/cwltool@docker-gpu as
cwltool
requirement to allow processing of GPU-enabled dockers with nvidia-docker.Add fmigneault/cornice.ext.swagger@openapi-3 as
cornice_swagger
requirement to allow OpenAPI-3 definitions support of schema generation and deserialization validation of JSON payloads.Disable default auto-generation of
request-options.yml
andwps_processes.yml
configuration files from a copy of their respective.example
files as these have many demo (and invalid values) that fail real execution of tests when no actual file was provided.Add per-request caching support when using
request_extra
function, and caching control according to request headers andrequest-options.yml
configuration.
Fixes:¶
Fix
weaver.config.get_weaver_config_file
called with empty path to be resolved just as requesting the default file path explicitly instead of returning an invalid directory.Fix CWL package path resolution under Windows incorrectly parsed partition as URL protocol.
Fix
AttributeError
ofpywps.inout.formats.Format
equality check compared tonull
object (using getter patch onnull
since fix #507 not released at this point).Fix potential invalid database state that could have saved an invalid process although the following
ProcessSummary
schema validation would fail and returnHTTPBadRequest [400]
. The process is now saved only after complete and successful schema validation.
2.2.0 (2021-03-03)¶
Changes:¶
Add
weaver.wps.utils.get_wps_client
function to handle the creation ofowslib.wps.WebProcessingService
client with appropriate request options configuration from application settings.
Fixes:¶
Fix job percent progress reported in logs to be more consistent with actual execution of the process (fixes #90).
Fix Job duration not stopped incrementing when its execution failed due to raised error (fixes #222).
Improve race condition handling of
builtin
process registration at application startup.
2.1.0 (2021-02-26)¶
Changes:¶
Ensure that configuration file definitions specified in
processes
andproviders
will override older database definitions respectively matched byid
andname
when starting Weaver if other parameters were modified.Support dynamic instantiation of WPS-1/2 processes from remote WPS providers to accomplish job execution.
Remove previously flagged duplicate code to handle
OWSLib
processes conversion toJSON
for OGC-API.Replace
GET
HTTP request byHEAD
for MIME-type check againstIANA
definitions (speed up).Improve handling of CWL input generation in combination with
minOccurs
,maxOccurs
,allowedValues
anddefault
empty ("null"
) value from WPS process from remote provider (fix #17).Add
HYBRID
mode that allows Weaver to simultaneously run local Application Packages and remote WPS providers.Rename
ows2json_output
toows2json_output_data
to emphasise its usage for parsing job result data rather than simple output definition as accomplished byows2json_io
.Remove function duplicating operations accomplished by
ows2json_io
(previously marked with FIXME).Improve typing definitions for CWL elements to help identify invalid parsing methods during development.
Improve listing speed of remote providers that require data fetch when some of them might have become unreachable.
Fixes:¶
Avoid failing WPS-1/2 processes conversion to corresponding OGC-API process if metadata fields are omitted.
Fix invalid function employed for
GET /providers/{prov}/processes/{proc}
route (some error handling was bypassed).
2.0.0 (2021-02-22)¶
Changes:¶
Add support of YAML format for loading
weaver.data_sources
definition.Pre-install
Docker
CLI inworker
image to avoid bad practice of mounting it from the host.Adjust WPS request dispatching such that process jobs get executed by
Celery
worker as intended (see #21 and #126).Move WPS XML endpoint functions under separate
weaver.wps.utils
andweaver.wps.views
to remove the need to constantly handle circular imports issues due to processing related operations that share some code.Move core processing of job operation by
Celery
worker underweaver.processes.execution
in order to separate those components from functions specific for producing WPS-REST API responses.Handle WPS-1/2 requests submitted by GET KVP or POST XML request with
application/json
inAccept
header to return the same body content as if directly calling their corresponding WPS-REST endpoints.Remove
request
parameter of every database store methods since they were not used nor provided most of the time.Changed all forbidden access responses related to visibility status to return
403
instead of401
.Add more tests for Docker applications and test suite execution with Github Actions.
Add more details in sample configurations and provide an example
docker-compose.yml
configuration that defines a typical Weaver API / Worker combination withdocker-proxy
for sibling container execution.Add captured
stdout
andstderr
details in job log following CWL execution error when retrievable.Document the WPS KVP/XML endpoint within the generated OpenAPI specification.
Disable auto-generation of
request_options.yml
file from corresponding empty example file and allow application to start if no such configuration was provided.Remove every Python 2 backward compatibility references and operations.
Drop Python 2 and Python 3.5 support.
Fixes:¶
Target
PyWPS-4.4
to resolve multiple invalid dependency requirements breaking installed packages over builtin Python packages and other compatibility fixes (see geopython/pywps #568).Fix retrieval of database connexion to avoid warning of
MongoClient
opened before fork of processes.Fix indirect dependency
oauthlib
missing fromesgf-compute-api
(cwt
) package.Fix inconsistent
python
reference resolution ofbuiltin
applications when executed locally and in tests (using virtual/conda environment) compared to within Weaver Docker image (using OS python).Fix many typing definitions.
1.14.0 (2021-01-11)¶
Changes:¶
Add
data
input support for CWL Workflow step referring to WPS-3 Process.Add documentation example references to Application Package and Process
Deploy
/Execute
repositories.Add parsing of
providers
inwps_processes.yml
to directly register remote WPS providers that will dynamically fetch underlying WPS processes, instead of static per-service processes stored locally.Add field
visible
towps_processes.yml
entries to allow directly defining the registered processes visibility.Adjust response of remote provider processes to return the same format as local processes.
Fixes:¶
Fix
stdout
/stderr
log file not permitted directly within CWL Workflow (must be inside intermediate steps).Fix missing S3 bucket location constraint within unittests.
1.13.1 (2020-07-17)¶
Changes:¶
No change.
Fixes:¶
Create an
stdout.log
orstderr.log
file in casecwltool
hasn’t created it.
1.13.0 (2020-07-15)¶
Changes:¶
Add AWS S3 bucket support for process input reference files.
Add
weaver.wps_output_s3_bucket
setting to upload results to AWS S3 bucket instead of local directory.Add
weaver.wps_output_s3_region
setting to allow override parameter extracted from AWS profile otherwise.Add more documentation about supported file reference schemes.
Add documentation references to ESGF-CWT Compute API.
Add conditional input file reference fetching (depending on ADES/EMS, process type from CWL
hints
) to take advantage of request-options and all supported scheme formats by Weaver, instead of relying on PyWPS and/or CWL wherever how far downstream the URL reference was reaching.
Fixes:¶
Adjust some docstrings to better indicate raised errors.
Adjust
weaver.processes.wps_package.WpsPackage
to use its internal logger when running the process in order to preserve log entries under its job execution. They were otherwise lost over time across all process executions.
1.12.0 (2020-07-03)¶
Changes:¶
Add multiple CWL ESGF processes and workflows, namely
SubsetNASAESGF
,SubsetNASAESGF
and many more.Add tests for ESGF processes and workflows.
Add documentation for
ESGF-CWTRequirement
processes.Add
file2string_array
andmetalink2netcdf
builtins.Add
esgf_process
Wps1Process
extension, to handleESGF-CWTRequirement
processes and workflows.
Fixes:¶
Reset
MongoDatabase
connection when we are in a forked process.
1.11.0 (2020-07-02)¶
Changes:¶
Generate Weaver OpenAPI specification for readthedocs publication.
Add some sections for documentation (#61).
Add support of documentation RST file redirection to generated HTML for reference resolution in both Github source and Readthedocs served pages.
Improve documentation links, ReadTheDocs format and TOC references.
Avoid logging
stdout/stderr
in workflows.Add tests to make sure processes
stdout/stderr
are logged.Remove Python 2.7 version as not officially supported.
Move and update WPS status location and status check functions into
weaver.wps
module.
Fixes:¶
Fix reported WPS status location to handle when starting with
/
although not representing an absolute path.
1.10.1 (2020-06-03)¶
Changes:¶
No change.
Fixes:¶
Pin
celery==4.4.2
to avoid import error on missingfutures.utils
called internally in following versions.
1.10.0 (2020-06-03)¶
Changes:¶
Add support of value-typed metadata fields for process description.
Enforce
rel
field when specifying anhref
JSON link to match corresponding XML requirement.
1.9.0 (2020-06-01)¶
Changes:¶
Add
weaver.wps_workdir
configuration setting to define the location where the underlyingcwltool
application should be executed under. This can allow more control over the scope of the mounted volumes for Application Package running a docker image.Add mapping of WPS results from the
Job
’s UUID to generated PyWPS UUID for outputs, status and log locations.Add experimental configuration settings
weaver.cwl_euid
andweaver.cwl_egid
to provide effective user/group identifiers to employ when running the CWL Application Package. Using these require good control of the directory and process I/O locations as invalid permissions could break a previously working job execution.Add more logging configuration and apply them to
cwltool
before execution of Application Package.Enforce
no_match_user=False
andno_read_only=False
ofcwltool
’sRuntimeContext
to ensure that docker application is executed with same user asweaver
and that process input files are not modified inplace (readonly) where potentially inaccessible (according to settings). Definition of CWL package will need to add InitialWorkDirRequirement as per defined by reference specification to stage those files if they need to be accessed with write permissions (see: example). Addresses some issues listed in #155.Enforce removal of some invalid CWL hints/requirements that would break the behaviour offered by
Weaver
.Use
weaver.request_options
for WPS GetCapabilities and WPS Check Status requests under the running job.Change default
DOCKER_REPO
value defined inMakefile
to point to reference mentioned inREADME.md
and considered as official deployment location.Add
application/x-cwl
MIME-type supported with updatedEDAM 1.24
ontology.Add
application/x-yaml
MIME-type to known formats.Add
application/x-tar
andapplication/tar+gzip
MIME-type (not official) but resolved as synonymapplication/gzip
(official) to preserve compressed file support during CWL format validation.
Fixes:¶
Set
get_cwl_file_format
default argumentmust_exist=True
instead ofFalse
to retrieve original default behaviour of the function. Since CWL usually doesn’t need to addFile.format
field when no corresponding reference actually exists, this default also makes more sense.
1.8.1 (2020-05-22)¶
Changes:¶
Add Travis-CI smoke test of built docker images for early detection of invalid setup or breaking code to boot them.
Add Travis-CI checks for imports. This check was not validated previously although available.
Adjust
weaver.ini.example
to reflect working demo server configuration (employed by smoke test).Move
weaver
web application toweaver.app
to reduce chances of breakingsetup.py
installation from import errors due toweaver
dependencies not yet installed. Redirect to new location makes this change transparent when loaded with the usualweaver.ini
configuration.
Fixes:¶
Fix base docker image to install Python 3 development dependencies in order to compile requirements with expected environment Python version. Package
python-dev
for Python 2 was being installed instead.Fix failing docker image boot due to incorrectly placed
yaml
import during setup installation.Fix imports according to
Makefile
targetscheck-imports
andfix-imports
.Fix parsing of
PyWPS
metadata to correctly employ values provided byweaver.ini
.
1.8.0 (2020-05-21)¶
Changes:¶
Modify
weaver.utils.request_retry
toweaver.utils.request_extra
to include more requests functionality and reuse it across the whole code base.Add
requests_extra
SSL verification option using specific URL regex(es) matches from configuration settings.Add
file://
transport scheme support directly to utilityrequests_extra
to handle local file paths.Add file
weaver.request_options
INI configuration setting to specify per-request method/URL options.Add
requests_extra
support ofRetry-After
response header (if any available on429
status) which indicates how long to wait until next request to avoid automatically defined response right after.Add
weaver.wps_workdir
configuration setting with allow setting correspondingpywps.workdir
directory.
Fixes:¶
Modify
Dockerfile-manager
to run web application usingpserve
asgunicorn
doesn’t correctly handles worker options anymore when loaded formweaver.ini
with--paste
argument. Also simplifies the command which already required multiple patches such as reapplying the host/port binding from INI file.Fix handling of Literal Data I/O
type
when retrieved fromOWSLib.wps
object with remote WPS XML body.Adjust
make start
target to use newmake install-run
target which installs the dependencies and package in edition mode so that configuration files present locally can be employed for running the application. Previously, one would have to move their configurations to thesite-package
install location of the active Python.Fix
celery>4.2
not found because of application path modification.Fix invalid handling of
wps_processes.yml
reference inweaver.ini
when specified as relative path to configuration directory.Fix handling of
WPS<->CWL
I/O merge ofdata_format
field againstsupported_formats
withpywps>=4.2.4
.Fix installation of
yaml
-related packages for Python 2 backward compatibility.
1.7.0 (2020-05-15)¶
Changes:¶
Add additional status log for
EOImage
input modification with OpenSearch during process execution.Add captured
stderr/stdout
logging of underlying CWL application being executed to resultingJob
logs (addresses first step of #131).Use
weaver.utils.request_retry
in even more places and extend convenience arguments offered by it to adapt it to specific use cases.
Fixes:¶
Fix handling of WPS-REST output matching a JSON file for multiple-output format specified with a relative local path as specified by job output location. Only remote HTTP references where correctly parsed. Also avoid failing the job if the reference JSON parsing fails. It will simply return the original reference URL in this case without expanded data (relates to #25).
Fix CWL job logs to be timezone aware, just like most other logs that will report UTC time.
Fix JSON response parsing of remote provider processes.
Fix parsing of CWL ordered parsing when I/O is specified as shorthand
"<id>":"<type>"
directly under theinputs
oroutputs
dictionary instead of extended JSON object variant such as{"input": {"type:" "<type>", "format": [...]}}
(fixes #137).
1.6.0 (2020-05-07)¶
Changes:¶
Reuse
weaver.utils.request_retry
function across a few locations that where essentially reimplementing the core functionality.Add even more failure-permissive request attempts when validating a MIME-type against IANA website.
Add auto-resolution of common extensions known under PyWPS as well as employing their specific encoding.
Add
geotiff
format type support via PyWPS (#100).Make WPS status check more resilient to failing WPS outputs location not found in case the directory path can be resolved to a valid local file representing the XML status (i.e.: don’t depend as much on the HTTP WPS output route).
Ensure backward support of generic/default
text/plain
I/O when extracted from a referenced WPS-1/2 XML remote process which provides insufficient format details. For CWL output generated from it, replace the glob pattern to match anything (<id>.*
) instead of<id>.txt
extracted fromtext/plain
to simulate MIME-type as*/*
. Issue log warning message for future use cases.
Fixes:¶
Fix invalid
AllowedValue
parsing when usingLiteralData
inputs that resulted inAnyValue
being parsed as a"None"
string. This was transparent in case of string inputs and breaking for other types like integer when they attempted conversion.Fix erroneous
Metadata
keywords passed down toowslib.wps.Metadata
objects in case of more verbose detailed not allowed by this implementation.Fix parsing of explicitly-typed optional array CWL I/O notation that was not considered (i.e.: using
type
as list with additional"null"
instead oftype: "<type>?"
shorthand).Fix parsing of MIME-type from
format
field to exclude additional parameters (e.g.:; charset=UTF-8
for remote IANA validation.
1.5.1 (2020-03-26)¶
Changes:¶
Add unittest of utility function
fetch_file
.Split some unittest utility functions to allow more reuse.
Fixes:¶
Fix invalid
retry
parameter not handled automatically by request.
1.5.0 (2020-03-25)¶
Changes:¶
Adjust incorrectly parsed href file reference as WPS complex input which resulted in failing location retrieval.
Partially address unnecessary fetch of file that has to be passed down to CWL, which will in turn request the file as required. Need update from PyWPS to resolve completely (#91, geopython/pywps#526).
Adjust WPS output results to use relative HTTP path in order to recompose the output URL if server settings change.
Support WPS output results as value (WPS literal data). Everything was considered an href file beforehand.
Add additional
timeout
andretry
during fetching of remote file for processjsonarray2netcdf
to avoid unnecessary failures during edge case connexion problems.Add support of
title
andversion
field ofbuiltin
processes.
Fixes:¶
Patch
builtin
process execution failing sincecwltool 2.x
update.Avoid long fetch operation using streamed request that defaulted to chuck size of 1. Now, we use an appropriate size according to available memory.
1.3.0 (2020-03-10)¶
Changes:¶
Provide a way to override the external URL reported by WPS-1/2 and WPS-REST via configuration settings allowing for more advanced server-side results in response bodies.
1.2.0 (2020-03-06)¶
Changes:¶
Add WPS languages for other wps requests types:
DescribeProcess
andGetCapabilities
.
Fixes:¶
Fix a bug where the validation of
OneOf
items was casting the value to the first valid possibility.
1.1.0 (2020-02-17)¶
Changes:¶
Simplify docker image generation and make base/manager/worker variants all available under the same docker repo docker-registry.crim.ca/ogc/weaver with different tags (#5).
Add planned future support of
Accept-Language
header for WPS-1/2 (geopython/OWSLib 0.20.0
) (#74).Improved job logs update with message and progress to allow better tracking of internal operations and/or problems.
Allow WPS builtin process
jsonarray2netcdf
to fetch a remote file.Change doc to point to DockerHub pavics/weaver images.
Adjust CI rule long-lasting failures until it gets patched by original reference (gitleaks-actions#3).
Fixes:¶
Fix readthedocs documentation generation.
Fix
.travis
docker image build condition.Fix
geopython/OWSLib>=0.19.1
requirement for Python 3.8 support (#62).Fix job update filling due to status location incorrectly resolved according to configured PyWPS output path.
1.0.0 (2020-01-28)¶
New Features:¶
Add
notification_email
field toJob
datatype that stores an encrypted email (according to settings) when provided in the job submission body (#44).Add ability to filter jobs with
notification_email
query parameter (#44).Add jobs statistics grouping by specific fields using comma-separated list
groups
query parameter (#46).Add some tests to evaluate new job search methods / grouping results and responses (#44, #46).
Add handling of multiple CWL field
format
forFile
type.Add missing ontology reference support for CWL field
format
by defaulting to IANA namespace.Add support for I/O
array
ofenum
(ie: multiple values ofAllowedValues
for a given input) (#30).Add support of
label
synonym astitle
for inputs and process description (CWL specifying alabel
will set it in WPS process) (#31)Add support of input
minOccurs
andmaxOccurs
asint
while maintainingstr
support (#14).Add conformance route with implementation links (#53).
Add additional landing page link details (#54).
Add
weaver.wps_restapi.colander_extras.DropableNoneSchema
to auto-handle some schema JSON deserialization.Add
weaver.wps_restapi.colander_extras.VariableMappingSchema
to auto-handle some schema JSON deserialization.
Changes:¶
Use
bump2version
and move all config undersetup.cfg
.Remove enforced
text/plain
for CWLFile
when missingformat
field.Replace bubbling up of too verbose unhandled exceptions (500 Internal Server Error) by summary message and additional internal logging for debugging the cause using an utility exception log decorator.
Use the same exception log decorator to simplify function definitions when HTTP exceptions are already handled.
Make
null
reference a singleton so that multiple instantiation calls all refer to the same instance and produce the expected behaviour of<x> is null
instead of hard-to-identify errors because of english syntax.Remove unused function
weaver.utils.replace_caps_url
and corresponding tests.Remove
weaver.processes.utils.jsonify_value
duplicated byweaver.processes.wps_package.complex2json
.Use more JSON body schema validation using API schema definitions deserialization defined by
weaver.datatype
.Enforce
builtin
processes registration on startup to receive applicable updates.Provide 2 separate docker images for Weaver manager and worker, corresponding to the EMS/ADES API and the
celery
job runner respectively.Update Apache license.
Fixes:¶
Adjust some typing definitions incorrectly specified.
Fix I/O field ordering preserved as specified in payload or loaded reference file.
Fix setting
minOccurs=0
when adefault
is specified in the corresponding CWL I/O (#17, #25).Fix incorrectly overridden
maxOccurs="unbounded"
bymaxOccurs="1"
when a partial array input definition is specified without explicitmaxOccurs
in WPS payload (#17, #25).Fix case where omitted
format[s]
in both CWL and WPS deploy bodies generated a process description with complex I/O (file) without requiredformats
field. Defaulttext/plain
format is now automatically added.Fix case where
format[s]
lists between CWL and WPS where incorrectly merged.Fix
metadata
field within a WPS I/O incorrectly parsed when provided by a WPS-1/2 XML process definition.Fix invalid JSON response formatting on failing schema validation of process deployment body.
Fix docker images to support
pserve
when usinggunicorn>=20.x
dropping support of--paste
config feature.Fix multiple Python 2/3 compatibility issues.
0.2.0 (2019-03-26)¶
Fixes to handle invalid key characters
"$"
and"."
during CWL package read/write operations to database.Fixes some invalid CWL package generation from WPS-1 references.
More cases handled for WPS-1 to CWL
WPS1Requirement
conversion (AllowedValues
,Default
,SupportedFormats
,minOccurs
,maxOccurs
).Add file format validation to generated CWL package from WPS-1 MIME-types.
Allow auto-deployment of WPS-REST processes from WPS-1 references specified by configuration.
Add many deployment and execution validation tests for
WPS1Requirement
.Add
builtin
application packages support for common operations.
0.1.3 (2019-03-07)¶
Add useful Makefile targets for deployment.
Add badges indications in
README.rst
for tracking from repo landing page.Fix security issue of PyYAML requirement.
Fix some execution issues for
Wps1Process
.Fix some API schema erroneous definitions.
Additional logging of unhandled errors.
Improve some typing definitions.
0.1.2 (2019-03-05)¶
Introduce
WPS1Requirement
and correspondingWps1Process
to run a WPS-1 process under CWL.Remove mongodb requirement, assume it is running on an external service or docker image.
Add some typing definitions.
Fix some problematic imports.
Fix some PEP8 issues and PyCharm warnings.
0.1.1 (2019-03-04)¶
Modify Dockerfile to use lighter
debian:latest
instead ofbirdhouse/bird-base:latest
.Modify Dockerfile to reduce build time by reusing built image layers (requirements installation mostly).
Make some buildout dependencies optional to also reduce build time and image size.
Some additional striping of deprecated or invalid items from Twitcher.
FAQ¶
This section present some commonly encountered use-cases and basic solutions regarding ADES/EMS operation or more specifically related to CWL specification.
How to specify the Docker image reference?¶
In most situations, the CommandLineTool
process will need to run a Docker image. Doing so is as simple as
adding the DockerRequirement
(reference) as follows to the Application Package definition:
{
"cwlVersion": "v1.0",
"requirements": {
"DockerRequirement": {
"dockerPull": "<docker-url>"
}
},
"inputs": ["<...>"],
"outputs": ["<...>"],
}
Note
The Docker image reference must be publicly accessible to allow CWL to pull it. Alternatively, a private Docker reference can be used if the image is locally available. The process will fail to execute if it cannot resolve the reference.
The Application Package can be provided during process deployment. Please refer to below references for more details.
See also
Fixing permission error on input files¶
Some processes expect their inputs to be writable (e.g.: ZIP files). When running an Application Package based on a Docker image, Weaver mounts the input files as volumes in read-only mode for security reasons. This causes these processes to immediately fail as the running user cannot override nor write temporary files in the same directory (where the volume was mounted to), as it is marked with read permissions.
To resolve this issue, the application developer should add the InitialWorkDirRequirement
(reference, example) to his CWL package definition. This tells CWL to stage the files into the
Docker container into the running directory where the user will be allowed to generate outputs, and therefore,
also allow edition of the inputs or generation of temporary files as when unpacking a compressed file.
As example, the CWL definition could be similar to the following:
{
"cwlVersion": "v1.0",
"class": "CommandLineTool",
"requirements": {
"DockerRequirement": {
"dockerPull": "<docker-url>"
},
"InitialWorkDirRequirement": {
"listing": [{
"entry": "$(inputs.input_file)",
"writable": true
}
]
}
},
"arguments": ["$(runtime.outdir)"],
"inputs": {
"input_file": {
"type": "File"
}
}
Note that $(inputs.input_file)
within InitialWorkDirRequirement
tells which input to resolve for staging using
the "writable": True
parameter. All files listed there will be mounted with write permissions into working runtime
directory of the executed Docker container.
Where can I find references to CWL specification and examples?¶
There exist multiple sources, but official ones provided below have a create amount of examples and are being continuously improved by the developers (including being updated according to changes).
See also below.
Where can I find examples of Process Deployment, Execution and Application Package definitions?¶
Many examples are reported in detail in the Examples chapter.
Glossary¶
- ADES¶
- Application Deployment and Execution ServiceSee Processes section for details. Alternative operation modes are described in Configuration Settings.
- AOI¶
- Area of Interest.Corresponds to a region, often provided by OGC WKT definition, employed for OpenSearch queries in the context of EOImage inputs.
- Application Package¶
General term that refers to “what and how the :term:`Process` will execute”. Application Packages provide the core details about the execution methodology of the underlying operation the Process provides, and are therefore always contained within a Process definition. This is more specifically represented by a CWL specification in the case of Weaver implementation, but could technically be defined by another similar approach. See Application Package section for all relevant details.
- AWS¶
Amazon Web Services
- CWL¶
- Representation of the internal Application Package of the Process to provide execution methodology of the referenced Docker image or other supported definitions. See application-package section for further details.
- Docker¶
Containerized and isolated environment platform that allows all required dependencies of an application or software to be packaged in a single image in order to correctly execute the virtualized application.
- EDAM¶
Ontology that regroups multiple definitions, amongst which Weaver looks up some of its known and supported MIME-types (EDAM media types) when resolving file formats. It is used as extension to IANA media types by providing additional formats that are more specifics to some data domains.
- EMS¶
- Execution Management ServiceSee Processes section for details. Alternative operation modes are described in Configuration Settings.
- EOImage¶
- Earth Observation ImageInput that interprets additional parameters in order to infer specific images applicable with filters following search results within a remote catalog.
See also
OpenSearch Data Source section.
- ESGF¶
- ESGF-CWT¶
- HREF¶
- Hyperlink ReferenceOften shortened to simply reference. Represents either a locally or remotely accessible item, such as a file or a Process depending on context, that uses explicit
<protocol>://<host/path>
representation to define its location. See also File Reference Types for typical examples. - HYBRID¶
- See Processes section for details. Alternative operation modes are described in Configuration Settings.
- I/O¶
Inputs and/or Outputs of CWL and/or WPS depending on context.
- IANA¶
Ontology that regroups multiple definitions, amongst which Weaver looks up most of its known and supported MIME-types (IANA media types) when resolving file formats.
- Job¶
Definition of a Process execution state with applicable operation metadata.
- JSON¶
- JavaScript Object NotationDefault data representation of all objects contained in the application or for their creation.
- MIME-types¶
- OGC¶
- OGC API - Processes¶
The new API that defines JSON REST-binding representation of WPS Process collection.
- OpenSearch¶
Protocol of lookup and retrieval of remotely stored files. Please refer to OpenSearch Data Source for details.
- Process¶
Entity that describes the required inputs, produced outputs, and any applicable metadata for the execution of the defined script, calculation, or operation.
- Provider¶
Entity that offers an ensemble of Process under it. It is typically a reference to a remote service, where any Process it provides is fetched dynamically on demand.
- S3¶
Simple Storage Service (AWS S3), bucket file storage.
- TOI¶
- Time of Interest.Corresponds to a date/time interval employed for OpenSearch queries in the context of EOImage inputs.
- WKT¶
Well-Known Text geometry representation.
- WPS¶
- Web Processing Service.From a formal standpoint, this is the previous OGC standard iteration that was employed prior to OGC API - Processes to represent a server that host one or more Process for execution. When compared against CWL context or generally across Weaver documentation and code, this term refers to attributes that are specific to typical Process description, in contrast to specialized attributes introduced by other concepts, such as for example CWL-specific implementation details.
- XML¶
- Extensible Markup LanguageAlternative representation of some data object provided by the application. Requires appropriate
Accept
header to return this format. See OpenAPI Specification for details.